diff --git a/lib/oga/xpath/evaluator.rb b/lib/oga/xpath/evaluator.rb index 48f265a..2627603 100644 --- a/lib/oga/xpath/evaluator.rb +++ b/lib/oga/xpath/evaluator.rb @@ -724,11 +724,11 @@ module Oga right = process(ast_node.children[1], context) if left.is_a?(XML::NodeSet) - left = left.text + left = first_node_text(left) end if right.is_a?(XML::NodeSet) - right = right.text + right = first_node_text(right) end if left.is_a?(Numeric) and !right.is_a?(Numeric) diff --git a/spec/oga/xpath/evaluator/operators/eq_spec.rb b/spec/oga/xpath/evaluator/operators/eq_spec.rb index 9d46f1d..b0411c3 100644 --- a/spec/oga/xpath/evaluator/operators/eq_spec.rb +++ b/spec/oga/xpath/evaluator/operators/eq_spec.rb @@ -46,5 +46,13 @@ describe Oga::XPath::Evaluator do example 'return true if a node set and a string are equal' do @evaluator.evaluate('root/a = "10"').should == true end + + example 'return true if a node set wildcard and a number are equal' do + @evaluator.evaluate('root/* = 10').should == true + end + + example 'return true if a number and a node set wildcard are equal' do + @evaluator.evaluate('10 = root/*').should == true + end end end