Fix DOMException in switchElementsAlt()
Clone attribute nodes before setting on `oldEl` to prevent the following error: ``` DOMException: Failed to execute 'setNamedItem' on 'NamedNodeMap': The node provided is an attribute node that is already an attribute of another Element; attribute nodes must be explicitly cloned. ```
This commit was merged in pull request #104.
This commit is contained in:
committed by
BehindTheMath
parent
36ed7079b1
commit
b98e3ef914
@@ -22,7 +22,7 @@ module.exports = {
|
||||
if (newEl.hasAttributes()) {
|
||||
const attrs = newEl.attributes;
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
oldEl.attributes.setNamedItem(attrs[i])
|
||||
oldEl.attributes.setNamedItem(attrs[i].cloneNode())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user