Bug 170068

Summary: [testcase] [CSS 2.1 Conformance] identifiers (class, id) can not start with a hyphen followed by a digit
Product: [Applications] konqueror Reporter: Gérard Talbot (no longer involved) <browserbugs2>
Component: khtml parsingAssignee: Konqueror Developers <konq-bugs>
Status: VERIFIED FIXED    
Severity: normal CC: germain
Priority: NOR    
Version: 4.1.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
URL: http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/HyphenFollowedByADigitInIdentifiers.html
Latest Commit: Version Fixed In:
Attachments: introduce needed CSS tokenizer states for proper contextual #{ident|hexcolor} parsing

Description Gérard Talbot (no longer involved) 2008-08-30 07:55:11 UTC
Testcase:
http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/HyphenFollowedByADigitInIdentifiers.html

Bug entry:
http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/#bug59

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 and CSS 2.1, G.2 Lexical scanner
both gives
 ident -?{nmstart}{nmchar}*
 nmstart [_a-z]|{nonascii}|{escape}

In the testcase, the 2nd <p> is red, not green.

Relevant code:

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

  <p class="two">This should be green.</p>

Since an id identifier can not start with an hyphen followed by a digit, the 2nd rule should be rejected and only the first rule should apply.

Regards, Gérard
Comment 1 Germain Garand 2008-09-02 22:44:09 UTC
Created attachment 27194 [details]

    introduce needed CSS tokenizer states for proper contextual
    #{ident|hexcolor} parsing
 

    introduce needed CSS tokenizer states for proper contextual
    #{ident|hexcolor} parsing
Comment 2 Germain Garand 2008-09-02 23:44:16 UTC
SVN commit 856458 by ggarand:

introduce needed CSS tokenizer states for proper contextual
#{ident|hexcolor} parsing

BUG: 170068


 M  +2 -0      cssparser.cpp  
 M  +2 -0      maketokenizer  
 M  +405 -404  parser.cpp  
 M  +82 -80    parser.h  
 M  +2 -1      parser.y  
 M  +630 -560  tokenizer.cpp  
 M  +15 -9     tokenizer.flex  
Comment 3 Gérard Talbot (no longer involved) 2008-12-06 20:41:54 UTC
Konqueror 4.1.2 passes the 2nd test

Marking as VERIFIED