Parsing support for the :first-of-type pseudo.

This commit is contained in:
Yorick Peterse 2014-11-03 23:00:15 +01:00
parent 7a606a11d3
commit 10632eafd4
2 changed files with 18 additions and 0 deletions

View File

@ -514,6 +514,13 @@ end
)
end
##
# @return [AST::Node]
#
def on_pseudo_class_first_of_type
return s(:eq, s(:call, 'position'), s(:int, 1))
end
private
##

View File

@ -0,0 +1,11 @@
require 'spec_helper'
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-or-self::*[position() = 1]'
)
end
end
end