-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.8] getDistributedNodes() does not update when distributed content changes #1449
Comments
I think you should be using Polymer.dom to remove the nodes. |
I've tried using Polymer.dom, same result. var allPs = document.querySelectorAll('p');
Array.prototype.forEach.call( allPs, function(p) {
Polymer.dom((Polymer.dom(p).parentNode)).removeChild(p);
}); |
Ah, sorry. I see what's wrong. These operations may be async, so you need to call flush() after removing the children. Call http://jsbin.com/rusoro/4/edit?html,console,output I think this was just shorthand in your description, but I believe that getDistributedNodes needs to be called on the content node, not the host element. On async operations: see the note here: https://www.polymer-project.org/0.8/docs/devguide/local-dom.html#dom-api These notes are a little hard to read. I'll try and figure out a way to make this more prominent. |
Thanks for helping out with this. Still not quite up to speed with Polymer dom. |
_distributedNodes array does not get updated when underlying nodes are added/removed.
If you start off with:
bug-distributor.getDistributedNodes().length
is 3.Then you remove all the distributed nodes:
bug-distributor.getDistributedNodes().length
is 3, should be 0.Is there a workaround, call one can make to update the list of distributedNodes?
The text was updated successfully, but these errors were encountered: