CSS class selector .NNN don't match XML nodes
Reported by
sebastie...@gmail.com,
Sep 22 2016
|
||||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/52.0.2743.116 Chrome/52.0.2743.116 Safari/537.36 Example URL: http://ffctn.com/doc/chrome-test-style.xml Steps to reproduce the problem: 1. Open http://ffctn.com/doc/chrome-test-style.xml 2. Open http://ffctn.com/doc/chrome-test-style.html What is the expected behavior? Look at the color of the rectangles in (1) and (2). They should all be green. What went wrong? CSS rules matching classes (eg. `.GREEN`) do no match XML nodes with non HTML/SVG-namespaced nodes with a `class='GREEN'` attribute. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? Yes Chrome version: 52.0.2743.116 Channel: n/a OS Version: Ubuntu 16.04 Flash Version:
,
Sep 23 2016
I think Gecko is wrong. [1] says which attribute is a class is document language specific. The bookmarks namespace used in that test is unknown to Blink and we should not assume the class attribute is a class. [1] https://drafts.csswg.org/selectors-4/#class-html
,
Sep 23 2016
Well,in practice that means that we can't use `.NNN` selectors in CSS to style XML nodes. It's true that you can't expect XML nodes to have a class attribute, or the class attribute to mean the same thing as in HTML, but that shouldn't prevent you from styling it. More to the point, if a node in any namespace has a class attribute, it would seem natural to expect that the `.NNN` works the same as `*[class=~"NNN"]`. I have updated the examples and you'll see that while `.NNN` does not work, the more verbose form does. http://ffctn.com/doc/chrome-test-style.xml Wouldn't you agree that if the `.NNN` and `*[class=~"NNN"]` forms are semantically equivalent (modulo the selector priority), they should behave, consistently?
,
Sep 26 2016
I agree it would be convenient if the attribute named class behaves as a class in terms of class selectors for every xml document type. If so, I think the relevant CSS spec needs to change. You could try bringing this up as an issue for the Selectors spec at w3c. If both Gecko and Edge treats all attributes named class the same, we should probably reconsider. I've re-opened this for now marked it as an interop issue.
,
Sep 26 2016
,
Sep 26 2016
This one too: https://bugzilla.mozilla.org/show_bug.cgi?id=89982 I'm not able to find an issue where Gecko actually decided to support it.
,
Sep 26 2016
I filed an issue in the Selectors spec, https://github.com/w3c/csswg-drafts/issues/534
,
Sep 26 2016
This might be relevant as well: https://bugzilla.mozilla.org/show_bug.cgi?id=741295 (ie. Gecko treating @class and @id in the same way for any element).
,
Sep 26 2016
So here's the DOM spec https://dom.spec.whatwg.org/#dom-element-classname "id, class, and slot are effectively superglobal attributes as they can appear on any element, regardless of that element’s namespace." So it would make sense to follow Gecko's interpretation https://bugzilla.mozilla.org/show_bug.cgi?id=741295
,
Sep 26 2016
OK. Changing component as a fix would happen in the DOM code so that blink::Element::classNames() returns a SpaceSplitString for class in other namespaces than HTML and SVG as well.
,
Sep 27 2016
Thank you both for digging into this. I'll tag this with XML since it's an issue for people using XML, even if the fix is in DOM.
,
Sep 27 2016
Awesome, thanks!
,
Jul 11 2017
,
Jul 11
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 11
Problem is still occurring as of 2018-07-11 67.0.3396.99
,
Jul 25
Yes, nobody has touched this one. |
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by f...@opera.com
, Sep 23 2016