Closed Bug 816012 Opened 9 years ago Closed 9 years ago

Some JavaScript functions do not work properly on namespace-prefixed XHTML

Categories

(Core :: DOM: Core & HTML, defect)

16 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 492933

People

(Reporter: development, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0
Build ID: 20121026114414

Steps to reproduce:

I created the following two test snippets showing the problem clearly. Both use an equivalent DOM and the onload-Javascript is supposed to show the amount of p elements in the document. However, Firefox 16 does not get it right. The only difference is that (b) uses a namespace prefix to designate the XHTML namespace instead of declaring it as default namespace as in (a).

(a) http://sotecware.net/files/persistent/so-lxml-xhtml/js-test.xhtml
(b) http://sotecware.net/files/persistent/so-lxml-xhtml/js-test-prefixed.xhtml


Actual results:

in (a), the correct result (“1”) is shown, in (b), “0” is shown. This breaks a _lot_ of scripts, including jQuery and MathJax.


Expected results:

Both results should be the same, as the DOM is equivalent.
http://www.w3.org/TR/DOM-Level-3-Core/
So Gecko does the correct thing per DOM 3 core. getElementsByTagName uses .tagName which
includes the prefix.


http://dom.spec.whatwg.org
DOM spec say .localName should be used.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 492933
I'm not sure you actually had a look on my example. I am expecting getElementsByTagName to match the localpart, as said in the referenced DOM spec:
> Thus, in an HTML document, document.getElementsByTagName("FOO") will match FOO elements that are not in the HTML namespace, and foo elements that are in the HTML namespace, but not FOO elements that are in the HTML namespace. 

This is certainly not the case in Firefox, otherwise my example would work. Am I totally misreading the proposed Duplicate and the spec?
Uhm, I'm sorry, didn't see the duplicate bug wasn't resolved yet. Ignore my comment and thanks for finding the dupe for me.
Component: DOM: Other → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.