Add switchElementsAlt() to the default switches

Fixes #83.
This commit is contained in:
Behind The Math
2017-12-19 15:56:48 -05:00
parent a7b584c469
commit 0781f820ee
2 changed files with 18 additions and 2 deletions

View File

@@ -15,6 +15,20 @@ module.exports = {
this.onSwitch()
},
switchElementsAlt: function(oldEl, newEl) {
oldEl.innerHTML = newEl.innerHTML
// Copy attributes from the new element to the old one
if (newEl.hasAttributes()) {
const attrs = newEl.attributes;
for (var i = 0; i < attrs.length; i++) {
oldEl.attributes.setNamedItem(attrs[i])
}
}
this.onSwitch()
},
sideBySide: function(oldEl, newEl, options, switchOptions) {
var forEach = Array.prototype.forEach
var elsToRemove = []