document.createAttributeNS() deprecated - warning in Firefox
In Firefox, there are a few warnings on the console on loading the Saxon-JS documentation:
1. "Use of document.createAttributeNS() is deprecated. Use element.setAttributeNS() instead."
We previously added the context.createElement(uri, name) method (see transform.js) to overcome a similar issue for creating elements in the browser. Looks like we should be doing something similar for attributes.
2. "Use of setAttributeNodeNS() is deprecated. Use setAttributeNS() instead."
In the same sort of area?
#1 Updated by Debbie Lockett over 1 year ago
- Status changed from New to In Progress
Introduced a new type AttributeNode (rather like our existing NamespaceNode).
The reason for the warnings is that the Attr type has changed (it used to inherit from Node, but not since DOM4), as well as the methods available for constructing these. The underlying problem we face is that we want to construct attributes and later attach them to the DOM tree. However, DOM4 does not provide a way to do this (attributes can apparently now only be constructed by adding them directly to elements). By using the AttributeNode type we can get around this problem.
As suggested in 1, added context.createAttribute(uri, name) method (which constructs an AttributeNode).
(Changes committed to JS src under 9.8 dev, but leaving open to do some more testing.)
Please register to edit this issue