Bug 170068 - [testcase] [CSS 2.1 Conformance] identifiers (class, id) can not start with a hyphen followed by a digit
Summary: [testcase] [CSS 2.1 Conformance] identifiers (class, id) can not start with a...
Status: VERIFIED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml parsing (show other bugs)
Version: 4.1.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL: http://www.gtalbot.org/BrowserBugsSec...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-30 07:55 UTC by Gérard Talbot (no longer involved)
Modified: 2013-04-01 21:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
introduce needed CSS tokenizer states for proper contextual #{ident|hexcolor} parsing (138.73 KB, patch)
2008-09-02 22:44 UTC, Germain Garand
Details

Note You need to log in before you can comment on or make changes to this bug.
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