Don't modify raw namespaces.
When calling Element#available_namespaces the list of namespaces returned by Element#namespaces must not be modified.
This commit is contained in:
parent
a4459c866f
commit
804646cc5e
|
@ -273,7 +273,7 @@ module Oga
|
||||||
# @return [Hash]
|
# @return [Hash]
|
||||||
#
|
#
|
||||||
def available_namespaces
|
def available_namespaces
|
||||||
merged = namespaces
|
merged = namespaces.dup
|
||||||
node = parent
|
node = parent
|
||||||
|
|
||||||
while node && node.respond_to?(:namespaces)
|
while node && node.respond_to?(:namespaces)
|
||||||
|
|
|
@ -418,6 +418,10 @@ describe Oga::XML::Element do
|
||||||
example 'return the "baz" namespace for the parent' do
|
example 'return the "baz" namespace for the parent' do
|
||||||
@parent_ns['baz'].uri.should == 'yyy'
|
@parent_ns['baz'].uri.should == 'yyy'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
example 'do not modify the list of direct namespaces' do
|
||||||
|
@child.namespaces.key?('foo').should == false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context '#self_closing?' do
|
context '#self_closing?' do
|
||||||
|
|
Loading…
Reference in New Issue