lib/niceogiri/xml/node.rb in niceogiri-1.0.1 vs lib/niceogiri/xml/node.rb in niceogiri-1.0.2
- old
+ new
@@ -63,11 +63,12 @@
def namespace=(namespaces)
case namespaces
when Nokogiri::XML::Namespace
self.nokogiri_namespace = namespaces
when String
- self.add_namespace nil, namespaces
+ ns = self.add_namespace nil, namespaces
+ self.nokogiri_namespace = ns
when Hash
self.add_namespace nil, ns if ns = namespaces.delete(nil)
namespaces.each do |p, n|
ns = self.add_namespace p, n
self.nokogiri_namespace = ns
@@ -130,10 +131,10 @@
# Inherit the attributes and children of an XML::Node
#
# @param [XML::Node] node the node to inherit
# @return [self]
def inherit(node)
- set_namespace node.namespace if node.namespace
+ nokogiri_namespace = node.namespace
inherit_attrs node.attributes
node.children.each { |c| self << c.dup }
self
end