From d917377f2e548f58c5d8f6bd3e65b7aa3e53ce72 Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Thu, 26 Sep 2013 18:08:09 -0700 Subject: [PATCH] Fix issue with syncing render nodes --- src/ShadowRenderer.js | 2 +- test/js/HTMLContentElement.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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 = '';