Fixed precedence of ID/class CSS selectors

This commit is contained in:
Yorick Peterse 2014-10-07 23:05:34 +02:00
parent 91f9cc984b
commit ed0cd7826e
2 changed files with 19 additions and 1 deletions

View File

@ -11,7 +11,7 @@ token T_NTH T_INT T_STRING T_ODD T_EVEN T_DOT T_HASH
options no_result_var
prechigh
left T_COLON
left T_COLON T_HASH T_DOT
left T_CHILD T_FOLLOWING T_FOLLOWING_DIRECT
left T_DOT T_HASH
preclow

View File

@ -20,6 +20,24 @@ describe Oga::CSS::Parser do
)
end
example 'parse an > axis followed by an element with an ID' do
parse_css('x > foo#bar').should == s(
:axis,
'child',
s(:test, nil, 'x'),
s(:id, 'bar', s(:test, nil, 'foo'))
)
end
example 'parse an > axis followed by an element with a class' do
parse_css('x > foo.bar').should == s(
:axis,
'child',
s(:test, nil, 'x'),
s(:class, 'bar', s(:test, nil, 'foo'))
)
end
example 'parse the + axis' do
parse_css('x + y').should == s(
:axis,