lib/blather/xmpp_node.rb in blather-0.4.2 vs lib/blather/xmpp_node.rb in blather-0.4.3
- old
+ new
@@ -249,10 +249,14 @@
##
# Inherit all of <tt>stanza</tt>'s attributes and children
def inherit(stanza)
set_namespace stanza.namespace if stanza.namespace
inherit_attrs stanza.attributes
- stanza.children.each { |c| self << c.dup }
+ stanza.children.each do |c|
+ self << (n = c.dup)
+ ns = n.namespace_definitions.find { |ns| ns.prefix == c.namespace.prefix }
+ n.namespace = ns if ns
+ end
self
end
##
# Inherit only <tt>stanza</tt>'s attributes