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

Commit

Permalink
Always return an array for getDisributedNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
arv committed Feb 12, 2014
1 parent 308a7c2 commit c0b1c00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ShadowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@
}

function getDistributedChildNodes(insertionPoint) {
return distributedChildNodesTable.get(insertionPoint);
var rv = distributedChildNodesTable.get(insertionPoint);
if (!rv)
distributedChildNodesTable.set(insertionPoint, rv = []);
return rv;
}

function getChildNodesSnapshot(node) {
Expand Down
5 changes: 5 additions & 0 deletions test/js/HTMLContentElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,9 @@ suite('HTMLContentElement', function() {
host.offsetHeight;
assert.equal(unwrap(host).innerHTML, '<b>fallback</b>');
});

test('getDistributedNodes outside shadow dom', function() {
var content = document.createElement('content');
assert.deepEqual(content.getDistributedNodes(), []);
});
});

0 comments on commit c0b1c00

Please sign in to comment.