diff --git a/lib/oga/xml/element.rb b/lib/oga/xml/element.rb index bfc7907..2d990c6 100644 --- a/lib/oga/xml/element.rb +++ b/lib/oga/xml/element.rb @@ -273,7 +273,7 @@ module Oga # @return [Hash] # def available_namespaces - merged = namespaces + merged = namespaces.dup node = parent while node && node.respond_to?(:namespaces) diff --git a/spec/oga/xml/element_spec.rb b/spec/oga/xml/element_spec.rb index 3d6ee54..44c51c3 100644 --- a/spec/oga/xml/element_spec.rb +++ b/spec/oga/xml/element_spec.rb @@ -418,6 +418,10 @@ describe Oga::XML::Element do example 'return the "baz" namespace for the parent' do @parent_ns['baz'].uri.should == 'yyy' end + + example 'do not modify the list of direct namespaces' do + @child.namespaces.key?('foo').should == false + end end context '#self_closing?' do