From 769c74cc139c0dbfb55228ae63ea24286e9b9f74 Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Fri, 18 Apr 2014 15:43:42 -0400 Subject: [PATCH] The older shadow root should act as a parent tree scope --- src/wrappers/ShadowRoot.js | 5 +++-- test/js/TreeScope.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wrappers/ShadowRoot.js b/src/wrappers/ShadowRoot.js index ccc845a..3e3c8cf 100644 --- a/src/wrappers/ShadowRoot.js +++ b/src/wrappers/ShadowRoot.js @@ -28,11 +28,12 @@ // DocumentFragment instance. Override that. rewrap(node, this); - this.treeScope_ = new TreeScope(this, getTreeScope(hostWrapper)); - var oldShadowRoot = hostWrapper.shadowRoot; nextOlderShadowTreeTable.set(this, oldShadowRoot); + this.treeScope_ = + new TreeScope(this, getTreeScope(oldShadowRoot || hostWrapper)); + shadowHostTable.set(this, hostWrapper); } ShadowRoot.prototype = Object.create(DocumentFragment.prototype); diff --git a/test/js/TreeScope.js b/test/js/TreeScope.js index e54020b..b6025e0 100644 --- a/test/js/TreeScope.js +++ b/test/js/TreeScope.js @@ -71,7 +71,7 @@ suite('TreeScope', function() { assert.equal(ts1.parent, null); assert.equal(ts2.parent, ts1); assert.equal(ts3.parent, ts2); - assert.equal(ts4.parent, ts1); + assert.equal(ts4.parent, ts2); var div2 = document.createElement('div'); div2.appendChild(a);