Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 769c74c

Browse files
committed
The older shadow root should act as a parent tree scope
1 parent 9513e0c commit 769c74c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/wrappers/ShadowRoot.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
// DocumentFragment instance. Override that.
2929
rewrap(node, this);
3030

31-
this.treeScope_ = new TreeScope(this, getTreeScope(hostWrapper));
32-
3331
var oldShadowRoot = hostWrapper.shadowRoot;
3432
nextOlderShadowTreeTable.set(this, oldShadowRoot);
3533

34+
this.treeScope_ =
35+
new TreeScope(this, getTreeScope(oldShadowRoot || hostWrapper));
36+
3637
shadowHostTable.set(this, hostWrapper);
3738
}
3839
ShadowRoot.prototype = Object.create(DocumentFragment.prototype);

test/js/TreeScope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ suite('TreeScope', function() {
7171
assert.equal(ts1.parent, null);
7272
assert.equal(ts2.parent, ts1);
7373
assert.equal(ts3.parent, ts2);
74-
assert.equal(ts4.parent, ts1);
74+
assert.equal(ts4.parent, ts2);
7575

7676
var div2 = document.createElement('div');
7777
div2.appendChild(a);

0 commit comments

Comments
 (0)