-
Notifications
You must be signed in to change notification settings - Fork 756
Closed
Labels
Description
The Selectors 3 grammar 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 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, but it was hotfixed in 57.0.1 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
iflag (if present), and before the closing bracket of an <attribute-selector>.