Allow CSS identifiers to start with an underscore.
This commit is contained in:
parent
f1316c50fb
commit
61801fe562
|
@ -155,7 +155,7 @@ module Oga
|
|||
# Identifiers are used for element and attribute names. Identifiers have
|
||||
# to start with a letter.
|
||||
|
||||
identifier = '*' | [a-zA-Z]+ [a-zA-Z\-_0-9]*;
|
||||
identifier = '*' | [a-zA-Z_]+ [a-zA-Z\-_0-9]*;
|
||||
|
||||
action emit_identifier {
|
||||
emit(:T_IDENT, ts, te)
|
||||
|
|
|
@ -6,6 +6,10 @@ describe Oga::CSS::Lexer do
|
|||
lex_css('h3').should == [[:T_IDENT, 'h3']]
|
||||
end
|
||||
|
||||
example 'lex a simple path starting with an underscore' do
|
||||
lex_css('_h3').should == [[:T_IDENT, '_h3']]
|
||||
end
|
||||
|
||||
example 'lex a path with two members' do
|
||||
lex_css('div h3').should == [
|
||||
[:T_IDENT, 'div'],
|
||||
|
|
Loading…
Reference in New Issue