MoOx / pjax

Easily enable fast Ajax navigation on any website (using pushState + xhr)
MIT License
1.46k stars 125 forks source link

DOMException in switchElementsAlt when copying <head> attributes #103

Closed robinnorth closed 6 years ago

robinnorth commented 6 years ago

The new switchElementsAlt switch method throws a DOMException for me when trying to copy <head> attributes:

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.

Cloning the attribute node before setting it on oldEl when switching resolves this issue.

BehindTheMath commented 6 years ago

Fixed by #104.