module Nokogiri::HTML5::Node
def add_child_node_and_reparent_attrs(node)
annoying with attribute names like xml:lang since libxml2 will
and tries to create an attribute in a namespace. This is especially
Nokogiri::XML::Node#[]= treats names with colons as a prefixed QName
HTML elements can have attributes that contain colons.
def add_child_node_and_reparent_attrs(node) return super unless document.is_a?(HTML5::Document) # I'm not sure what this method is supposed to do. Reparenting # namespaces is handled by libxml2, including child namespaces which # this method wouldn't handle. # https://github.com/sparklemotion/nokogiri/issues/1790 add_child_node(node) # node.attribute_nodes.find_all { |a| a.namespace }.each do |attr| # attr.remove # ns = attr.namespace # a["#{ns.prefix}:#{attr.name}"] = attr.value # end end