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

Commit c0b1c00

Browse files
committed
Always return an array for getDisributedNodes
1 parent 308a7c2 commit c0b1c00

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/ShadowRenderer.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@
116116
}
117117

118118
function getDistributedChildNodes(insertionPoint) {
119-
return distributedChildNodesTable.get(insertionPoint);
119+
var rv = distributedChildNodesTable.get(insertionPoint);
120+
if (!rv)
121+
distributedChildNodesTable.set(insertionPoint, rv = []);
122+
return rv;
120123
}
121124

122125
function getChildNodesSnapshot(node) {

test/js/HTMLContentElement.js

+5
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,9 @@ suite('HTMLContentElement', function() {
223223
host.offsetHeight;
224224
assert.equal(unwrap(host).innerHTML, '<b>fallback</b>');
225225
});
226+
227+
test('getDistributedNodes outside shadow dom', function() {
228+
var content = document.createElement('content');
229+
assert.deepEqual(content.getDistributedNodes(), []);
230+
});
226231
});

0 commit comments

Comments
 (0)