Re: [selectors4] ID selector syntax: HASH or #+IDENT?

Le 19/02/2013 13:22, Øyvind Stenhaug a écrit :
>> Internet Explorer 10 only shows this with
>> a green background when in Document Mode: IE5 quirks for me (this mode
>> is used as the quirks mode in IE9 and below). In all other modes (IE7
>> standards, IE8 standards, IE9 standards, IE10 quirks and IE10
>> standards) it does not display green.
> It's a quirk in Opera/Presto as well. In no-quirks mode, we follow the CSS
> 2.1 spec and treat the selector as invalid.

Oh, I hadn’t thought about quirks mode. With a doctype, none of the four 
implementation match a #- or #1 selector:

data:text/html,<!doctype html><body id=-><style>%23-{background:red
data:text/html,<!doctype html><body id=1><style>%231{background:red


CSS escaping makes this a valid identifier:

data:text/html,<!doctype html><body id=-><style>%23\-{background:green
data:text/html,<!doctype html><body id=1><style>%23\31{background:green

(Note: %23 is an URL escape for "#", while \31 is a CSS escape for "1".)


So let’s keep the prose. The grammar should reflect this restriction, 
though. (I was only looking at the grammar and missed that part of the 
prose when rewriting the parser in cssselect, used in WeasyPrint and 
CairoSVG.)

-- 
Simon Sapin

Received on Tuesday, 19 February 2013 15:33:04 UTC