Closed Bug 264609 Opened 20 years ago Closed 20 years ago

getElementsByTagName methods should be consistant

Categories

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

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.8alpha5

People

(Reporter: yan.morin, Assigned: bzbarsky)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041010 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041010 Firefox/0.10.1

Depending one the content-type sent by the browser, getElementsByTagName with
XHTML is not consistant when you send him a capitalize tagName.
In text/html, he should lowercase all tagName.
In application/xhtml+xml, he shouldn't lowercase tagName

Reproducible: Always
Steps to Reproduce:
1. do a document.getElementsByTagName('CAPITALIZE_TAG') in application/xhtml+xml
or 
2. do a element.getElementsByTagNameNS('*','CAPITALIZE_TAG') in text/html

Actual Results:  
with my test case: 
text/html: 4, 0, 4, 4
application/xhtml+xml: 1, 1, 3, 1
text/xml: 1, 1, 1, 1
application/xml: 1, 1, 1, 1

Expected Results:  
with my test case:
text/html: 4, 4, 4, 4
application/xhtml+xml: 1, 1, 1, 1
text/xml: 1, 1, 1, 1
application/xml: 1, 1, 1, 1

http://lxr.mozilla.org/aviarybranch/source/content/html/document/src/nsHTMLDocument.cpp#1501
VS
http://lxr.mozilla.org/aviarybranch/source/content/html/document/src/nsHTMLDocument.cpp#2490

And
"Since XHTML is based on XML, in XHTML everything is case sensitive"
http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-5353782642
Attached patch PatchSplinter Review
Comment on attachment 163177 [details] [diff] [review]
Patch

jst?  Thoughts?

The document change is definitely right.  The element change, I don't know. 
getElementsByTagNameNS is sorta wacky in tag-soup...
Attachment #163177 - Flags: superreview?(jst)
Attachment #163177 - Flags: review?(jst)
Comment on attachment 163177 [details] [diff] [review]
Patch

r+sr=jst
Attachment #163177 - Flags: superreview?(jst)
Attachment #163177 - Flags: superreview+
Attachment #163177 - Flags: review?(jst)
Attachment #163177 - Flags: review+
Taking.
Assignee: general → bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → mozilla1.8alpha5
Fixed.  Yan Morin, thank you for pointing out the code in question and for the
excellent testcase!
er... actually fixed.  As of comment 5, so for 1.8a5.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: