diff --git a/src/ShadowRenderer.js b/src/ShadowRenderer.js
index 5cb99a0..2924228 100644
--- a/src/ShadowRenderer.js
+++ b/src/ShadowRenderer.js
@@ -266,6 +266,7 @@
* the real DOM tree and make minimal changes as needed.
*/
function RenderNode(node) {
+ this.skip = false;
this.node = node;
this.childNodes = [];
}
@@ -278,6 +279,9 @@
},
sync: function(opt_added) {
+ if (this.skip)
+ return;
+
var nodeWrapper = this.node;
// plain array of RenderNodes
var newChildren = this.childNodes;
@@ -390,6 +394,7 @@
if (isShadowHost(node)) {
var renderer = getRendererForHost(node);
+ renderNode.skip = !renderer.dirty;
renderer.render(renderNode);
} else {
// We associate the parent of a content/shadow with the renderer
diff --git a/test/js/test.js b/test/js/test.js
index ec6165b..77ab735 100644
--- a/test/js/test.js
+++ b/test/js/test.js
@@ -451,4 +451,18 @@ suite('Shadow DOM', function() {
assert.equal(a.childNodes.length, 2);
});
+ test('nested shadow hosts (issue 245)', function() {
+ var outer = document.createElement('outer');
+ var inner = outer.appendChild(document.createElement('inner'));
+
+ // Inner first. Order matters.
+ var innerShadowRoot = inner.createShadowRoot();
+ innerShadowRoot.textContent = 'inner';
+
+ var outerShadowRoot = outer.createShadowRoot();
+ outerShadowRoot.innerHTML = 'outer';
+
+ assert.equal(getVisualInnerHtml(outer), 'innerouter');
+ });
+
});
\ No newline at end of file