diff --git a/lib/oga/xpath/compiler.rb b/lib/oga/xpath/compiler.rb index 0809651..940a093 100644 --- a/lib/oga/xpath/compiler.rb +++ b/lib/oga/xpath/compiler.rb @@ -1398,9 +1398,12 @@ module Oga ns, name = *ast condition = nil + name_str = string(name) + zero = literal(0) if name != STAR - condition = input.name.eq(string(name)) + condition = input.name.eq(name_str) + .or(input.name.casecmp(name_str).eq(zero)) end if ns and ns != STAR diff --git a/spec/oga/xpath/compiler/paths_spec.rb b/spec/oga/xpath/compiler/paths_spec.rb index 1d3c197..0b4745d 100644 --- a/spec/oga/xpath/compiler/paths_spec.rb +++ b/spec/oga/xpath/compiler/paths_spec.rb @@ -16,6 +16,12 @@ describe Oga::XPath::Compiler do end end + describe '/A' do + it 'returns a NodeSet' do + evaluate_xpath(@document).should == node_set(@a1) + end + end + describe '/' do it 'returns a NodeSet' do evaluate_xpath(@document).should == node_set(@document)