Parsing support for the :empty pseudo.
This commit is contained in:
parent
1b870406de
commit
de04c61df9
|
@ -550,6 +550,15 @@ end
|
|||
return s(:eq, s(:call, 'last'), s(:int, 1))
|
||||
end
|
||||
|
||||
##
|
||||
# Generates the AST for the `:empty` selector.
|
||||
#
|
||||
# @return [AST::Node]
|
||||
#
|
||||
def on_pseudo_class_empty
|
||||
return s(:call, 'not', s(:axis, 'child', s(:type_test, 'node')))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::CSS::Parser do
|
||||
context ':empty pseudo class' do
|
||||
example 'parse the :empty pseudo class' do
|
||||
parse_css(':empty').should == parse_xpath(
|
||||
'descendant-or-self::*[not(node())]'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue