bool MarkupAccumulator::shouldAddNamespaceAttribute(const Attribute& attribute, Namespaces& namespaces) { // Don't add namespace attributes twice if (attribute.name() == XMLNSNames::xmlnsAttr) { namespaces.set(emptyAtom.impl(), attribute.value().impl()); return false; } QualifiedName xmlnsPrefixAttr(xmlnsAtom, attribute.localName(), XMLNSNames::xmlnsNamespaceURI); if (attribute.name() == xmlnsPrefixAttr) { namespaces.set(attribute.localName().impl(), attribute.value().impl()); return false; } return true; }
bool MarkupAccumulator::shouldAddNamespaceAttribute(const Attribute& attribute, Namespaces& namespaces) { namespaces.checkConsistency(); // Don't add namespace attributes twice // HTML Parser will create xmlns attributes without namespace for HTML elements, allow those as well. if (attribute.name().localName() == xmlnsAtom && (attribute.namespaceURI().isEmpty() || attribute.namespaceURI() == XMLNSNames::xmlnsNamespaceURI)) { namespaces.set(emptyAtom.impl(), attribute.value().impl()); return false; } QualifiedName xmlnsPrefixAttr(xmlnsAtom, attribute.localName(), XMLNSNames::xmlnsNamespaceURI); if (attribute.name() == xmlnsPrefixAttr) { namespaces.set(attribute.localName().impl(), attribute.value().impl()); return false; } return true; }