diff --git a/src/ShadowRenderer.js b/src/ShadowRenderer.js index 5c117e5..da19591 100644 --- a/src/ShadowRenderer.js +++ b/src/ShadowRenderer.js @@ -324,7 +324,7 @@ } for (var i = lastIndex; i < newChildren.length; i++) { - newChildren[i++].sync(added); + newChildren[i].sync(added); } } }; diff --git a/test/js/HTMLContentElement.js b/test/js/HTMLContentElement.js index 631d3a7..4580bef 100644 --- a/test/js/HTMLContentElement.js +++ b/test/js/HTMLContentElement.js @@ -88,6 +88,21 @@ suite('HTMLContentElement', function() { assertArrayEqual(content.getDistributedNodes(), fooRoot.firstChild.children); }); + test('Adding tree with content again', function() { + var host = document.createElement('div'); + host.innerHTML = '

Content

'; + + var t = document.createElement('template'); + t.innerHTML = '
[]
'; + + var sr = host.createShadowRoot(); + sr.appendChild(t.content.cloneNode(true)); + + host.offsetHeight; + assert.equal(unwrap(host).innerHTML, + '
[

Content

]
'); + }); + test('adding a new content element to a shadow tree', function() { var host = document.createElement('div'); host.innerHTML = '';