Revert "Fixed XPath AST for :last-of-type"

Axes can't be used in combination with functions.

This reverts commit b0b572a584.
This commit is contained in:
Yorick Peterse 2014-11-14 23:49:49 +01:00
parent 8f3553f8f1
commit 2d6a2be2e8
2 changed files with 2 additions and 6 deletions

View File

@ -528,11 +528,7 @@ end
# @return [AST::Node]
#
def on_pseudo_class_last_of_type
return s(
:eq,
s(:call, 'count', s(:axis, 'following-sibling', s(:call, 'name'))),
s(:int, 0)
)
return s(:eq, s(:call, 'position'), s(:call, 'last'))
end
##

View File

@ -4,7 +4,7 @@ describe Oga::CSS::Parser do
context ':last-of-type pseudo class' do
example 'parse the :last-of-type pseudo class' do
parse_css(':last-of-type').should == parse_xpath(
'descendant::*[count(following-sibling::name()) = 0]'
'descendant::*[position() = last()]'
)
end
end