Case insensitive matching of nodes

This re-applies the patch added in #134 to the new XPath compiler.

Fixes #135.
This commit is contained in:
Yorick Peterse 2015-08-30 18:30:04 +02:00
parent bb8b328f5e
commit 604d0d9337
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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)