Add replaceNode switch (#141)

* Add replaceNode switch

* Add test for replaceNode()

* Update TS definitions
This commit was merged in pull request #141.
This commit is contained in:
BehindTheMath authored and GitHub committed 2018-03-20 10:52:55 -04:00
1 parent 5e41a32cf4
commit 75eb83dbc2
4 files changed
+36 -2

No files matched your search

+6
View File
@@ -26,6 +26,12 @@ module.exports = {
this.onSwitch()
},
// Equivalent to outerHTML(), but doesn't require switchElementsAlt() for <head> and <body>
replaceNode: function(oldEl, newEl) {
oldEl.parentNode.replaceChild(newEl, oldEl)
this.onSwitch()
},
sideBySide: function(oldEl, newEl, options, switchOptions) {
var forEach = Array.prototype.forEach
var elsToRemove = []