From a586a512b86dfb74ff90023fb7a85c51107e9a56 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 5 Nov 2014 00:45:40 +0100 Subject: [PATCH] Removed support for CSS such as "|X" This expression could be used to get all elements that _don't_ have any namespace. The problem is that this can't be expressed as just a node test, instead the resulting XPath would have to look something like the following: X[local-name() = name()] However, since the XPath predicates are already created for pseudo classes and such, also injecting the above into it would be a real big pain. As such I've decided not to support it. --- lib/oga/css/parser.y | 3 --- spec/oga/css/evaluator/paths_spec.rb | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/lib/oga/css/parser.y b/lib/oga/css/parser.y index 0aaa524..5aa8dfa 100644 --- a/lib/oga/css/parser.y +++ b/lib/oga/css/parser.y @@ -109,9 +109,6 @@ rule # ns|foo | T_IDENT T_PIPE T_IDENT { [val[0], val[2]] } - - # |foo - | T_PIPE T_IDENT { [nil, val[1]] } ; predicates diff --git a/spec/oga/css/evaluator/paths_spec.rb b/spec/oga/css/evaluator/paths_spec.rb index 2174d01..dfd9e1b 100644 --- a/spec/oga/css/evaluator/paths_spec.rb +++ b/spec/oga/css/evaluator/paths_spec.rb @@ -108,20 +108,4 @@ describe 'CSS selector evaluation' do @set[2].should == @document.children[0].children[2] end end - - context 'paths without namespaces and with name wildcards' do - before do - @set = evaluate_css(@document, 'a |*') - end - - it_behaves_like :node_set, :length => 2 - - example 'include the first node' do - @set[0].should == @document.children[0].children[0] - end - - example 'include the second node' do - @set[1].should == @document.children[0].children[1] - end - end end