cssRules.selectorText doesn't return authored values correctly with hackish namespace prefix
Reported by
tristan....@gmail.com,
Jan 17 2017
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:51.0) Gecko/20100101 Firefox/51.0 Steps to reproduce the problem: 1. set a rule set in the hackish [ns\:attr] form 2. try to read this rule-set via document.styleSheets[n].cssRules[n].selectorText What is the expected behavior? It should return [ns\:attr] What went wrong? It returns [ns:attr] which is not a valid selector, hence, making this selector unusable for further use. Did this work before? No Does this work in other browsers? No Works as expected in FF Doesn't work in Safari either Chrome version: 55.0.2883.95 (64-bit) Channel: stable OS Version: OS X 10.9 Flash Version: Shockwave Flash 24.0 r0 I know the [ns\:attr] syntax is an hack and is not valid CSS namespace prefix at first, but unfortunately, this hack is being used by some big libraries (https://docs.angularjs.org/api/ng/directive/ngCloak). Also, this bug is almost impossible to workaround since FF does keep the authored value, which seems more friendly IMO (Safari has the same behavior as chrome and I don't know what IE does).
,
Jan 18 2017
Could you please let us know what is the expected value and where to check from Chrome Te side to further triage it.
,
Jan 18 2017
Please have a look at: https://jsfiddle.net/e9oogu4v/1/
,
Jan 18 2017
I'm not sure what should be the correct value. Specs only talk about the correct [ns|attr] (U+007C) https://drafts.csswg.org/cssom/#serializing-selectors, but not about how incorrect characters forced by \ (U+005C) should be serialized. But as a user I did expect the serialization to return what was authored (i.e with the \ ). If you can confirm that chromium behavior is the correct one, I'm ok to open an issue in Firefox's bug-tracker.
,
Jan 18 2017
In a html-document, [my\:ms] is the only way to select namespaced attributes http://stackoverflow.com/questions/24390558/css-attribute-namespace-selector-in-svg If i escape an id-selector e.g. "#id\:" it works as expected.
,
Jan 19 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/97b5d7d2b375ae960a7b8084591815e30ae19832 commit 97b5d7d2b375ae960a7b8084591815e30ae19832 Author: fs <fs@opera.com> Date: Thu Jan 19 16:52:24 2017 Serialize type and attribute selectors as identifiers Per [1], both the element name of a type selector and the attribute name of an attribute selector - as well as their corresponding namespace prefix (if any) - should be serialized as identifiers [2]. [1] https://drafts.csswg.org/cssom/#serialize-a-simple-selector [2] https://drafts.csswg.org/cssom/#serialize-an-identifier BUG= 681814 Review-Url: https://codereview.chromium.org/2645563002 Cr-Commit-Position: refs/heads/master@{#444766} [add] https://crrev.com/97b5d7d2b375ae960a7b8084591815e30ae19832/third_party/WebKit/LayoutTests/cssom/serialize-attribute-selectors.html [modify] https://crrev.com/97b5d7d2b375ae960a7b8084591815e30ae19832/third_party/WebKit/LayoutTests/cssom/serialize-namespaced-type-selectors.html [modify] https://crrev.com/97b5d7d2b375ae960a7b8084591815e30ae19832/third_party/WebKit/Source/core/css/CSSSelector.cpp
,
Jan 19 2017
,
Jan 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0b9363c48f13ffd33d88dd9e810697fd86c2b301 commit 0b9363c48f13ffd33d88dd9e810697fd86c2b301 Author: fs <fs@opera.com> Date: Fri Jan 20 13:28:35 2017 '*' is not a valid attribute selector Per the CSS Selectors specification [1], a '*' is not allowed as the name of an attribute. [1] https://drafts.csswg.org/selectors-4/#typedef-attribute-selector BUG= 681814 Review-Url: https://codereview.chromium.org/2646493002 Cr-Commit-Position: refs/heads/master@{#445046} [modify] https://crrev.com/0b9363c48f13ffd33d88dd9e810697fd86c2b301/third_party/WebKit/LayoutTests/cssom/serialize-attribute-selectors.html [modify] https://crrev.com/0b9363c48f13ffd33d88dd9e810697fd86c2b301/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp [modify] https://crrev.com/0b9363c48f13ffd33d88dd9e810697fd86c2b301/third_party/WebKit/Source/core/css/parser/CSSSelectorParserTest.cpp |
|||
►
Sign in to add a comment |
|||
Comment 1 by dominicc@chromium.org
, Jan 18 2017