[csswg-drafts] [selectors-4] Whitespace in attribute selectors

NOVALISTIC has just created a new issue for https://github.com/w3c/csswg-drafts:

== [selectors-4] Whitespace in attribute selectors ==
The [Selectors 3 grammar](https://drafts.csswg.org/selectors-3/#w3cselgrammar) explicitly allows whitespace inside attribute selectors, namely after the `[`, around the matcher, and before the `]`:

```
attrib
  : '[' S* [ namespace_prefix ]? IDENT S*
        [ [ PREFIXMATCH |
            SUFFIXMATCH |
            SUBSTRINGMATCH |
            '=' |
            INCLUDES |
            DASHMATCH ] S* [ IDENT | STRING ] S*
        ]? ']'
  ;
```

This makes `[ href $= ".html" ]` valid. This old representation of the grammar existed up to the May 2013 WD of Selectors 4.

However, the whitespace rules listed under the [Selectors 4 grammar](https://drafts.csswg.org/selectors-4/#grammar) as of the Feb 2018 WD and later don't list attribute selectors as an exception:

> * White space is forbidden between tokens except:
>    * Around commas (denoted with the # multiplier)
>    * Around or in place of a <combinator>
>    * Between the parentheses and argument of a functional <pseudo-class-selector> or <pseudo-element-selector>.

This breaks `[ href $= ".html" ]`. Is this an oversight or an intentional change? Coincidentally, [it did break in Firefox 57](https://bugzilla.mozilla.org/show_bug.cgi?id=1418152), but it was fixed in 58 with no mention of this change to the spec, so I'm guessing (and hoping) this is an oversight in the rewritten text. Ideally, it would say:

>    * After the opening bracket, around the matcher token *[any better name for this?]*, before the `i` flag (if present), and before the closing bracket of an <attribute-selector>.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3151 using your GitHub account

Received on Tuesday, 25 September 2018 16:40:40 UTC