- From: Simon Sapin <simon.sapin@kozea.fr>
- Date: Tue, 19 Feb 2013 09:02:01 +0100
- To: www-style@w3.org
Hi, Since CSS 2.1, the syntax of ID selectors has been defined in prose as '#' followed by an identifier. However, since Level 3, selectors also have a grammar where ID selectors are represented by a HASH token, which is more permissive than #+IDENT. For example, 1 is not a valid IDENT but #1 is a valid HASH. Test case: data:text/html,<body id=1><style>%231{background:green This is green in Opera and IE, not in Firefox and Chrome. The former accept any HASH for ID selectors, while the latter probably restrict the syntax to valid identifiers. Since ID selectors are tokenized as HASH tokens, restricting to valid identifier requires an extra check in implementations. I suggest going with the simpler choice and allow any HASH token. Proposed change: in §6.7 of Selectors 4, replace this sentence: > An ID selector contains a "number sign" (U+0023, #) immediately > followed by the ID value, which must be an CSS identifiers. with > An ID selector is given as a HASH token Perhaps with a link to CSS21/syndata.html#tokenization If we do want to restrict to identifiers, the grammar in §16.1 would need to be fixed somehow. -- Simon Sapin
Received on Tuesday, 19 February 2013 08:02:28 UTC