- From: Jonathan Chan via GitHub <sysbot+gh@w3.org>
- Date: Sat, 15 Jul 2017 08:02:46 +0000
- To: public-css-archive@w3.org
jyc has just created a new issue for https://github.com/w3c/csswg-drafts: == [cssom] Should clarify spec for serializing universal selector in compound selectors == The spec is confusingly worded on what to do when serializing compound selectors containing universal selectors, and doesn't seem to agree with the `cssom/serialize-namespaced-type-selectors.html` web platform test (whose behavior seems to be what would be expected, can be described concisely, and also happens to be what is actually implemented by browsers). The spec says: > 1. If there is only one simple selector in the compound selectors which is a universal selector, append the result of serializing the universal selector to s. > 2. Otherwise, for each simple selector in the compound selectors that is not a universal selector of which the namespace prefix maps to a namespace that is not the default namespace serialize the simple selector and append the result to s. > > – https://drafts.csswg.org/cssom/#serialize-a-selector The double-negative is hard to parse and doesn't seem to actually capture what the test case [cssom/serialize-namespaced-type-selectors.html]( https://github.com/w3c/web-platform-tests/blob/master/cssom/serialize-namespaced-type-selectors.html) asserts (I've included some test cases below, which pass in Firefox, Chrome and Safari): Let `ns` be some non-default namespace and `nsdefault` be the default namespace (only defined in the third column): Selector | No default namespace | Has default namespace --- | --- | --- `*` | `*` | `*` `\|*` | `\|*` | `\|*` `*\|*` | `*\|*` |`*\|*` `ns\|*` | `ns\|*` | `ns\|*` `nsdefault\|*` | (not in tests) | `*` `*.c` | `.c` | `.c` `\|*.c` | `\|*.c` | `\|*.c` `*\|*.c`| `.c` | `*\|*.c` `ns\|*.c` | `ns\|*.c` | `ns\|*.c` `nsdefault\|*.c` | (not in tests) | `.c` The behavior in the test case seems to be described by the following: 1. If there is only one simple selector in the compound selectors which is a universal selector, append the result of serializing the universal selector to s. 2. Otherwise, for each simple selector in the compound selectors, unless 1. the simple selector is the universal selector, 2. the compound selector is equivalent (as used to in CSS Selectors) to one in which the namespace prefix (if any) is omitted entirely, and serialize the simple selector and append the result to s. This revised spec corresponds to the principle of serializing to the shortest form. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1606 using your GitHub account
Received on Saturday, 15 July 2017 08:02:52 UTC