Closed Bug 571390 Opened 10 years ago Closed 10 years ago

classList is always empty on xul elements

Categories

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

defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: iann_bugzilla, Assigned: smaug)

References

Details

Attachments

(1 file)

Steps to reproduce
1/ Create some xul containing various elements with classes.
2/ Add some JS that uses classList property and associated methods to manipulate the elements' classes.

Expected result
1/ classList contains DOMTokenList of classes and associated methods can be used to manipulate the list.

Actual result
1/ classList is empty, so using add method overwrites anything in className property.
The problem seems to be that DOMTokenList uses GetParsedAttr, but it should
probably use GetAttrInfo, which can handle XULprototypes.
Say you have an xul element which has a class bar.
The DOMTokenList is empty at this point and className is "bar"
If you set the element's className to "foo" then the DOMTokenList gets populated.
Right; see comment 1.
blocking2.0: --- → ?
Assignee: nobody → Olli.Pettay
Attached patch patchSplinter Review
Attachment #450646 - Flags: review?(bzbarsky)
Comment on attachment 450646 [details] [diff] [review]
patch

This looks ok, but we should add a comment to the GetParsedAttr footgun.
Attachment #450646 - Flags: review?(bzbarsky) → review+
Blocks: 529647
http://hg.mozilla.org/mozilla-central/rev/1d5faa6f718e
http://hg.mozilla.org/mozilla-central/rev/5ea4bc6c71f7
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
blocking2.0: ? → final+
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.