Document.createElementNS not implemented in saxon-js 2.2
I am currently using saxon-js 2.0.3, and my project runs without issues. I am using
createElementNS to create qualified elements.
I have been trying to upgrade to saxon-js 2.2.0. However, my project now gets the following error. The
createElementNS method is no longer defined. How does one create qualified elements in the newer version?
const linkElement = document.createElementNS("http://www.w3.org/1999/xhtml", "h:a"); ^ TypeError: document.createElementNS is not a function
Updated by Michael Kay over 2 years ago
How was the variable
Saxon on Node.js includes a third-party DOM library, and a document node created using this library certainly does have the
createElementNS() method. But your document object might have been created some other way, and be using a different DOM implementation. We would need to see a full repro that demonstrates the problem, I think.
It's also possible that the problem is something to do with the way the Closure compiler renames methods. It's possible that we omitted to mark this as a method name that's externally visible to the application and therefore shouldn't be renamed: we can check that.
Updated by Martin Honnen over 2 years ago
I have never tried to use the W3C DOM API with Saxon-JS 2 but a simple test with Saxon-JS 2.2 and Node.js of
const SaxonJS = require("saxon-js") const document = SaxonJS.XPath.evaluate(`parse-xml('<html xmlns="http://www.w3.org/1999/xhtml"><body></body></html>')`, ); console.log(document); console.log(typeof document.createElement); console.log(typeof document.createElementNS);
Please register to edit this issue