Closed
Bug 414612
Opened 17 years ago
Closed 15 years ago
getElementsByTagName returns no results for namespace type tag names
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: ali, Unassigned)
Details
Attachments
(1 file)
2.06 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Given an XML tag <abc:TheTag>xxx</abc:TheTag>
FF3 correctly returns a collection of these when I call:
xmlDoc.getElementsByTagName("abc:TheTag");
However, FF2 actually requires that the abc: namespace is removed else it returns an empty collection.
So only the following works in FF2..
xmlDoc.getElementsByTagName(name.substring(name.indexOf(":") + 1));
IE and Opera are happy with
xmlDoc.getElementsByTagName("abc:TheTag");
but there is a definate change betweeen FF2 and FF3 that will cause grief for applications relying on this function with this sort of tag naming.
Reproducible: Always
Steps to Reproduce:
1. create an xml doc var with
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xml, "text/xml");
where xml contains xml with tags named abc:TheTag
2. Call xmlDoc.getElementsByTagName("abc:TheTag"); in FF2 and FF3
3. FF2 will return nothing, FF3 will return the collection
4. Call xmlDoc.getElementsByTagName("TheTag"); in FF2 and FF3
5. FF2 will return the collection, FF3 will not
Expected Results:
a collection of abc:TheTag
Comment 1•17 years ago
|
||
Shouldn't it be instead:
getElementsByTagNameNS
http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-A6C90942
getElementsByTagNameNS
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-getElBTNNS
i tried
return xmlDoc.getElementsByTagNameNS("qas", "PicklistEntry");
but this fails on all browsers including FF2 and FF3.
so fails
return xmlDoc.getElementsByTagNameNS("qas:PicklistEntry");
so only getElementsByTagName works, just not in FF3 without stripping the qas: prefix.
Comment 3•17 years ago
|
||
This shows the difference in behavior. It also includes a demo of getElementsByTagNameNS, which works consistently between the two versions.
This seems to behave as specified.
xmlDoc.getElementsByTagName("abc:TheTag")
should return a list with 1 element.
xmlDoc.getElementsByTagName("TheTag")
should return a list with 0 element.
getElementsByTagName returns all elements whose .tagName matches the passed in string.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
Updated•10 years ago
|
Resolution: INVALID → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•