Skip to content

Commit

Permalink
Update LegacyElementMixin.distributeContent
Browse files Browse the repository at this point in the history
This should no longer be needed and is provided only for backwards compatibility.
  • Loading branch information
Steven Orvell committed Jul 14, 2017
1 parent c96350b commit 2daf9de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
9 changes: 3 additions & 6 deletions lib/legacy/legacy-element-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,12 @@

/**
* Force this element to distribute its children to its local dom.
* This is necessary only when ShadyDOM is used and only in cases that
* are not automatically handled. For example,
* a user should call `distributeContent` if distribution has been
* invalidated due to an element being added or removed from the shadowRoot
* that contains an insertion point (`<slot>`) inside its subtree.
* This should not be necessary as of Polymer 2.0.2 and is provided only
* for backwards compatibility.
*/
distributeContent() {
if (window.ShadyDOM && this.shadowRoot) {
this.shadowRoot.forceRender();
ShadyDOM.flush();
}
}

Expand Down
2 changes: 0 additions & 2 deletions test/unit/shady-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,6 @@
frag.appendChild(dist);
el.root.insertBefore(frag, el.$.dist2);
// Note, special call required here
//el.distributeContent(true);
ShadyDOM.flush();

});
Expand All @@ -1349,7 +1348,6 @@
// Remove first element with nested content to the end
el.root.appendChild(el.$.dist1);
// Note, special call required here
//el.distributeContent(true);
ShadyDOM.flush();

});
Expand Down
2 changes: 1 addition & 1 deletion test/unit/shady-dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@
assert.equal(nd.root.children.length, 1, 'root children length not decremented due to element removal');
});

test('distributeContent correctly distributes changes to light dom', function() {
test('modifying slots correctly distributes changes to light dom', function() {
function testNoAttr() {
assert.equal(allInsertionPoints(child)[0], d.$.notTestContent, 'child not distributed logically');
if (checkUnpatchedDom) {
Expand Down

0 comments on commit 2daf9de

Please sign in to comment.