diff --git a/index.js b/index.js index 68a58e9..4a7581f 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,5 @@ var assert = require('assert') var morph = require('./lib/morph') -var rootLabelRegex = /^data-onloadid/ - -var ELEMENT_NODE = 1 module.exports = nanomorph @@ -22,8 +19,6 @@ module.exports = nanomorph function nanomorph (oldTree, newTree) { assert.equal(typeof oldTree, 'object', 'nanomorph: oldTree should be an object') assert.equal(typeof newTree, 'object', 'nanomorph: newTree should be an object') - - persistStatefulRoot(newTree, oldTree) var tree = walk(newTree, oldTree) return tree } @@ -87,17 +82,3 @@ function updateChildren (newNode, oldNode) { newIndex = newStartIndex } } - -function persistStatefulRoot (newNode, oldNode) { - if (!newNode || !oldNode || oldNode.nodeType !== ELEMENT_NODE || newNode.nodeType !== ELEMENT_NODE) return - var oldAttrs = oldNode.attributes - var attr, name - for (var i = 0, len = oldAttrs.length; i < len; i++) { - attr = oldAttrs[i] - name = attr.name - if (rootLabelRegex.test(name)) { - newNode.setAttribute(name, attr.value) - break - } - } -} diff --git a/test.js b/test.js index 09f6f17..f263bdd 100644 --- a/test.js +++ b/test.js @@ -229,29 +229,6 @@ function abstractMorph (morph) { }) } -tape('should skip over data-onload attributes at root', function (t) { - var a = html` -
- -
- ` - var b = html` -
- - -
- ` - var c = html` -
- - -
- ` - var d = nanomorph(a, b) - t.ok(c.isEqualNode(d), 'is equal') - t.end() -}) - tape('use id as a key hint', function (t) { t.test('append an element', function (t) { var a = html`