This commit is contained in:
Daniel Fockler 2015-08-14 16:15:49 -07:00
parent 0977be81bb
commit 496811a23f
2 changed files with 9 additions and 1 deletions

View File

@ -1691,7 +1691,9 @@ module Oga
def name_matches?(xml_node, name)
return false unless xml_node.respond_to?(:name)
name == STAR ? true : xml_node.name == name
return true if name == STAR
xml_node.name == name || xml_node.name.downcase == name.downcase
end
##

View File

@ -92,6 +92,12 @@ describe Oga::XPath::Evaluator do
@evaluator.node_matches?(text, s(:test, nil, 'a')).should == false
end
it 'returns true if a node is matched case insensitively' do
node = Oga::XML::Element.new(:name => 'DiV')
@evaluator.node_matches?(node, s(:test, nil, 'div')).should == true
end
end
describe 'with a custom namespace' do