diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-04 03:27:20 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-04 03:27:20 +0000 |
commit | b537823f3d1f7ad0eb4f05b68b21a3c9a0a0d295 (patch) | |
tree | 6a798fa4d08c2d3bdd6a85a97bf84bd66b6273a0 /lib | |
parent | d050a28f769b43e89bd0a06d36810c69de882412 (diff) |
rexml: Fix a XPath bug of @attribute/parent
[Bug #14600]
* lib/rexml/functions.rb: Fix a bug that "@attribute/parent" doesn't
return element of its attribute.
* test/rexml/test_jaxen.rb: Enable more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rexml/xpath_parser.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb index 6a32a06440..cab32b3a37 100644 --- a/lib/rexml/xpath_parser.rb +++ b/lib/rexml/xpath_parser.rb @@ -236,8 +236,16 @@ module REXML nodeset = new_nodeset when :parent - nodeset = nodeset.collect{|n| n.parent}.compact - #nodeset = expr(path_stack.dclone, nodeset.collect{|n| n.parent}.compact) + new_nodeset = [] + nodeset.each do |node| + if node.is_a?(Attribute) + parent = node.element + else + parent = node.parent + end + new_nodeset << parent if parent + end + nodeset = new_nodeset node_types = ELEMENTS when :ancestor |