Issue 4178: photos.svg demo. Fails in Chromium, works in
Opera/Gecko/Webkit (even Safari)
http://code.google.com/p/chromium/issues/detail?id=4178
Comment #2 by [EMAIL PROTECTED]:
The line that causes the problem is "img = new Image()". The behavior of
this
statement differs in Chrome from Safari, Opera, and Firefox. In the latter,
it always
creates an HTMLImageElement. In Chrome, while in the context of an SVG
document, it
creates a bare element. This element has no idea how to handle an attempt
to set the
SRC attribute, nor how to fire an onLoad when it completes.
I ran the following quick-and-dirty test script in Chrome, Opera, Safari,
and
Firefox, both in an SVG document and an HTML document:
function loaded() {
alert(
"IMAGE: "+document.createElement('image') + "\n" +
"IMG: "+document.createElement('img') + "\n" +
"new Image(): "+(new Image()));
}
Results as follows
Chrome SVG: Chrome HTML:
IMAGE: [object Element] IMAGE: [object HTMLImageElement]
IMG: [object Element] IMG: [object HTMLImageElement]
new Image(): [object Element] new Image(): [object
HTMLImageElement]
Safari SVG: Safari HTML:
IMAGE: [object Element] IMAGE: [object HTMLImageElement]
IMG: [object Element] IMG: [object HTMLImageElement]
new Image(): [object HTMLImageElement] new Image(): [object
HTMLImageElement]
Opera SVG: Opera HTML:
IMAGE: [object SVGImageElement] IMAGE: [object HTMLImageElement]
IMG: [object SVGElement] IMG: [object HTMLImageElement]
new Image(): [object HTMLImageElement] new Image(): [object
HTMLImageElement]
Firefox SVG: Firefox HTML:
IMAGE: [object Element] IMAGE: [object HTMLSpanElement]
IMG: [object Element] IMG: [object HTMLImageElement]
new Image(): [object HTMLImageElement] new Image(): [object
HTMLImageElement]
Weirdnesses worth noting: document.createElement("image") /
document.createElement("img") creates an SVGImageElement in an SVG document
in Opera
only. This behavior is, it seems to me, most likely correct and perhaps
other
browsers should change to conform. I wouldn't expect
document.createElement('image')
to work at all, since the correct tag is 'img', but it does indeed produce
expected
behavior in all browsers in HTML, with the exception of Firefox which
produces an
HTMLSpanElement (WTF?). All browsers but Chrome however use new Image() to
create an
HTMLImageElement only. Chrome (specifically V8) aliases new Image() to
document.createElement("image"), which is the problem. Replacing it with
createElementNS() in the HTML namespace should fix the problem. I'll send a
patch to
V8.
Issue attribute updates:
Status: Assigned
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Chromium-bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/chromium-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---