Closed Bug 827642 Opened 11 years ago Closed 11 years ago

CSS parser rearranges selector text into canonical format

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: fryn, Unassigned)

Details

I discovered while debugging a patch for bug 821859 that the CSS parser rearranges selector text into its own preferred canonical format and then returns this for the selectorText property of the CSSRule interface.

This can lead to unexpected failures when trying to loop through style sheets to match rules by selector text.

Is this behavior intended?
For example,
a:not([c])[b]
becomes
a[b]:not([c])
This happens with any object model.  The DOM does similar things.

So insofar as there's an object model involved, yes this is intended.  We don't store the text; we store an object with some fields; when you ask for .cssText we serialize the object.
(In reply to Boris Zbarsky (:bz) from comment #2)
> This happens with any object model.  The DOM does similar things.

Good point. That makes sense. Thanks for the concise explanation. :)
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Blocks: 978663
No longer blocks: 978663
You need to log in before you can comment on or make changes to this bug.