[Bug 4999] Validator fails to detect and report id selector starting with hyphen followed by a digit

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4999

           Summary: Validator fails to detect and report id selector
                    starting with hyphen followed by a digit
           Product: CSSValidator
           Version: CSS Validator
          Platform: PC
               URL: http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/Hyph
                    enFollowedByADigitInIdentifiers.html
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: CSS 2.1
        AssignedTo: dave.null@w3.org
        ReportedBy: info@gtalbot.org
         QAContact: www-validator-cvs@w3.org


CSS validator, profile 2.1, incorrectly reports validity for case of id
selector starting with hyphen followed by a digit.

Steps to reproduce
------------------
1. Load provided URL
2. Submit to CSS validator (profile CSS 2.1) :
http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.gtalbot.org%2FBrowserBugsSection%2FMSIE7Bugs%2FHyphenFollowedByADigitInIdentifiers.html&warning=2&profile=css21&usermedium=all
or just click the CSS button in that page

Actual results
--------------
CSS validator reports 
Your stylesheet validated (French: "Votre feuille de style CSS validée") :

#-2bar, .two {
color : red;
background-color : white;
}

Expected results
----------------
The CSS validator should detect the id selector starting with an hyphen
followed by a digit and then reject the css rule based on known parsing rules
and report a parse error for that css rule.

References
----------

CSS 2.1, Section 4.1.3 Characters and case (identifiers) says:
"in CSS, identifiers (including element names, classes, and IDs in selectors)
can contain only the characters [a-z0-9] and ISO 10646 characters U+00A1 and
higher, plus the hyphen (-) and the underscore (_); they cannot start with a
digit, or a hyphen followed by a digit."
http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

CSS 2.1, Section 4.1.1 tokenization 
http://www.w3.org/TR/CSS21/syndata.html#tokenization
and 
CSS 2.1, G.2 Lexical scanner 
http://www.w3.org/TR/CSS21/grammar.html#scanner
both gives
ident -?{nmstart}{nmchar}*
nmstart [_a-z]|{nonascii}|{escape}

Please note that I reported this issue at bugzilla.mozilla.org 
https://bugzilla.mozilla.org/show_bug.cgi?id=12385
and at bugzilla.webkit.org
http://bugs.webkit.org/show_bug.cgi?id=14373

Received on Saturday, 1 September 2007 03:40:18 UTC