Add replaceNode switch

This commit is contained in:
Behind The Math
2018-03-13 23:56:58 -04:00
parent 5e41a32cf4
commit d22262e5a7
2 changed files with 7 additions and 0 deletions

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 = []