Skip to content
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

getDistributedNodes() returns nodes that are already removed under shady dom #2283

Closed
zerodevx opened this issue Aug 16, 2015 · 0 comments
Closed
Assignees
Labels

Comments

@zerodevx
Copy link

Hi, I'm not sure if this is expected behavior. Say I have an element <x-test> that selects and inserts content from its parent,

<x-test>

<dom-module id="x-test">
  <template>
    <div>x-test's distributed nodes:</div><br>
    <content id="content" select="[data-test]"></content>
  </template>
</dom-module>

and from my parent, I call it like that,

<parent-element>

<dom-module id="parent-element">
  <template>
  ...
    <x-test id="app">
      <template is="dom-repeat" items="{{list}}">
        <div data-test>{{item.foo}}</div>
      </template>
    </x-test>
  </template>
</dom-module>

where <parent-element>'s list array looks like

this.push("list", { foo: "item 1" });
this.push("list", { foo: "item 2" });
this.push("list", { foo: "item 3" });

everything works like a champ so far. Calling Polymer.dom(content).getDistributedNodes() returns the 3 items.

However, if I remove an item from the list,

this.splice("list", 2, 1);

while the template renders just fine, getDistributedNodes() still returns the full 3 items - when I expect 2 items. This works correctly under native shadow dom behaviour and I thought it should be normalised.

Here is a repro: http://jsbin.com/xebelufika/edit?html,output

Try adding some items, log the nodes, remove some, log the nodes, then add again. It seems that adding an item corrects this behavior.

Thanks so much,
Jason

sorvell pushed a commit that referenced this issue Aug 17, 2015
…ion points with logical info only if necessary.

Fixes #2283: when a node is removed, we need to potentially distribute not only its host but also its parent.
@sorvell sorvell added the p1 label Aug 18, 2015
@sorvell sorvell self-assigned this Aug 18, 2015
frankiefu added a commit that referenced this issue Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants