Reverted AST changes for first-of-type
Functions can't be used in combination with axes, so I'll just need to fix the position() function to work properly.
This commit is contained in:
parent
2d6a2be2e8
commit
6daa3e7a00
|
@ -515,11 +515,7 @@ end
|
|||
# @return [AST::Node]
|
||||
#
|
||||
def on_pseudo_class_first_of_type
|
||||
return s(
|
||||
:eq,
|
||||
s(:call, 'count', s(:axis, 'preceding-sibling', s(:call, 'name'))),
|
||||
s(:int, 0)
|
||||
)
|
||||
return s(:eq, s(:call, 'position'), s(:int, 1))
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -4,13 +4,13 @@ describe Oga::CSS::Parser do
|
|||
context ':first-of-type pseudo class' do
|
||||
example 'parse the :first-of-type pseudo class' do
|
||||
parse_css(':first-of-type').should == parse_xpath(
|
||||
'descendant::*[count(preceding-sibling::name()) = 0]'
|
||||
'descendant::*[position() = 1]'
|
||||
)
|
||||
end
|
||||
|
||||
example 'parse the a:first-of-type pseudo class' do
|
||||
parse_css('a:first-of-type').should == parse_xpath(
|
||||
'descendant::a[count(preceding-sibling::name()) = 0]'
|
||||
'descendant::a[position() = 1]'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue