Closed
Bug 469304
Opened 16 years ago
Closed 15 years ago
Attribute nodes set with setAttributeNode get mutated
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: roc, Assigned: smaug)
References
()
Details
Attachments
(3 files, 1 obsolete file)
805 bytes,
text/html
|
Details | |
12.65 KB,
patch
|
sicking
:
review+
sicking
:
superreview+
|
Details | Diff | Splinter Review |
12.64 KB,
patch
|
Details | Diff | Splinter Review |
See the Webkit testcase. We get failures like this:
FAIL testAttribNodeNamePreservesCaseGetNode() should be A,A. Was a,a.
The attribute name in the attribute node has been lowercased after we set it. That seems wrong.
Assignee | ||
Comment 1•16 years ago
|
||
Note to myself, need to verify this is actually valid.
Assignee | ||
Comment 2•16 years ago
|
||
The testcase tests something which isn't specified anywhere.
Attributes are by default lowercase in HTML (per web compatibility).
So what I'd like to do is to make testAttribNodeNamePreservesCaseGetNode2()
fail because testAttribNodeNamePreservesCaseGetNode() fails and
make attrib.name fail because node.getAttributeNode('myattrib').name fails.
That way we would handle attributes consistently within HTML elements.
(and those are both the same bug anyway and it is a real bug.)
We could perhaps do the lowercasing already when creating attribute nodes in HTML document.
I really don't want to do what webkit does here. With latest webkit it is
possible to add attribute nodes which values aren't available using .getAttribute().
Assignee | ||
Comment 3•16 years ago
|
||
Assignee | ||
Comment 4•16 years ago
|
||
Taking so that I can fix the testAttribNodeNamePreservesCaseGetNode2() case.
Assignee: nobody → Olli.Pettay
Assignee | ||
Comment 5•16 years ago
|
||
Actually, I'll fix this in a bit different way.
DOMAttr.nodeName and DOMAttr.name could keep their caseness, but
getAttribute should still work correctly.
This should fix other cases than (new XMLSerializer).serializeToString(node) should be <div myAttrib="XXX"></div>. Was <DIV myattrib="XXX"/>.
(which we do correctly IMO, because in HTML attributes are in lowercase).
Patch coming.
Assignee | ||
Comment 6•16 years ago
|
||
Attachment #352785 -
Flags: superreview?(jonas)
Attachment #352785 -
Flags: review?(jonas)
Comment 7•16 years ago
|
||
(In reply to comment #2)
> The testcase tests something which isn't specified anywhere.
> Attributes are by default lowercase in HTML (per web compatibility).
> So what I'd like to do is to make testAttribNodeNamePreservesCaseGetNode2()
> fail because testAttribNodeNamePreservesCaseGetNode() fails and
> make attrib.name fail because node.getAttributeNode('myattrib').name fails.
> That way we would handle attributes consistently within HTML elements.
> (and those are both the same bug anyway and it is a real bug.)
FYI, this test should match IE, Opera and WebKit behaviours [1]. By failing part of it, you will be the only one to have this behaviour.
When fixing this bug on WebKit, I did not find any specification too and decided to side with IE and Opera as they had a more consistent behaviour.
> I really don't want to do what webkit does here. With latest webkit it is
> possible to add attribute nodes which values aren't available using
> .getAttribute().
Seems like a bug. Could you file a bug about that on the WebKit bugzilla?
[1] https://bugs.webkit.org/attachment.cgi?id=22610&action=view (part of the bug https://bugs.webkit.org/show_bug.cgi?id=20247)
Assignee | ||
Comment 8•16 years ago
|
||
Julien, see the comment 5 ;)
The patch makes Gecko to pass all the other case
except XMLSerializer (). That test fails on Opera too, although in a different
way than Gecko.
Gecko serializes HTML to <DIV myattrib="XXX"/>
Opera <div myAttrib="XXX"/>
WebKit <div myAttrib=\"XXX\"></div>
Comment 9•16 years ago
|
||
(In reply to comment #8)
> Julien, see the comment 5 ;)
Oh, I had missed that. The changes you are proposing are great, sorry for the noise.
Assignee | ||
Comment 10•16 years ago
|
||
Comment on attachment 352785 [details] [diff] [review]
possible patch
This isn't working atm.
Attachment #352785 -
Flags: superreview?(jonas)
Attachment #352785 -
Flags: review?(jonas)
Assignee | ||
Comment 11•16 years ago
|
||
Added also xmlns, at least temporarily. Depends on what we want to do with
Bug 501226.
Attachment #352785 -
Attachment is obsolete: true
Attachment #385984 -
Flags: superreview?(jonas)
Attachment #385984 -
Flags: review?(jonas)
Assignee | ||
Comment 12•16 years ago
|
||
Jonas, ping
Assignee | ||
Comment 13•15 years ago
|
||
Jonas, re-ping.
Attachment #385984 -
Flags: superreview?(jonas)
Attachment #385984 -
Flags: superreview+
Attachment #385984 -
Flags: review?(jonas)
Attachment #385984 -
Flags: review+
Assignee | ||
Comment 14•15 years ago
|
||
Assignee | ||
Comment 15•15 years ago
|
||
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•