summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
authorKouhei Sutou <kou@clear-code.com>2019-01-01 05:39:37 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-04 11:54:16 +0900
commit84c3742466fa78b48902d340345cddd04569b81f (patch)
treeb0238d420e7b5e5e77568648d6600982ad1e5fb9 /lib/rexml
parent096e766355f36983676883b7cb83a1b5862be49a (diff)
[ruby/rexml] Revert "xpath: remove needless nil check"
This reverts commit 61b73c1bf8dc64d97fba7f0a8c503c24b11313f5. "*:local_name" becomes prefix=nil. https://github.com/ruby/rexml/commit/9e7dd4cd4e
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/xpath_parser.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb
index df9e7d58ff..47fa4ef84e 100644
--- a/lib/rexml/xpath_parser.rb
+++ b/lib/rexml/xpath_parser.rb
@@ -474,7 +474,9 @@ module REXML
raw_node = node.raw_node
case raw_node.node_type
when :element
- if prefix.empty?
+ if prefix.nil?
+ raw_node.name == name
+ elsif prefix.empty?
if strict?
raw_node.name == name and raw_node.namespace == ""
else
@@ -488,7 +490,9 @@ module REXML
raw_node.name == name and raw_node.namespace == ns
end
when :attribute
- if prefix.empty?
+ if prefix.nil?
+ raw_node.name == name
+ elsif prefix.empty?
# FIXME: This DOUBLES the time XPath searches take
raw_node.name == name and
raw_node.namespace == raw_node.element.namespace