Wednesday, 23 January 2019

Is createAttribute("href") the same as createAttributeNS(null, "href")

Is createAttribute("href") the same as createAttributeNS(null, "href")?

Answer:


No! As explained in section 1.1.8 XML Namespaces, they're different and not really interoperable. DOM Level 1 methods solely identify attribute nodes by theirnodeName while DOM Level 2 methods related to namespaces, identify attribute nodes by their namespaceURI and localName. Unless you are writing a pure DOM 1.0 application, don't use the non-namespace-aware version of these calls.

No comments:

Post a Comment