Skip to content

Loading…

[0.9] when I move a dom-repeat element from one parent to another, the items will gone #1498

Closed
jwu opened this Issue · 2 comments

2 participants

@jwu
jwu commented
<dom-module id="custom-element">
  <template>
    <template is="dom-repeat">{{users}}</div>
  </template>
</dom-module>

In the

<div id="first"><custom-element id="my-list"></custom-element></div>
<div id="second"></div>

When I use Polymer.dom(element("#second")).appendChild( element("#my-list") ), the whole list inside it will be removed.

@jwu
jwu commented

Well, I check the Polymer latest code and found this issue relative with the code here: https://github.com/Polymer/polymer/blob/0.8-preview/src/lib/template/dom-repeat.html#L199

In the dom-repeat there is a detached callback that will clear all the list item when the dom detached. I think it should add an attached callback to recover the element, otherwise the dom list will gone, but the Polymer element still have that data keep on it.

Q: When will people detached a list and attach it some where again?
A: I have a panel system that can freely dock itself from one parent to another. If there is a dom-repeat list in it, when the panel moving and dock to other place, the items in the dom-repeat will be detached based on the code I found above, but never recover again when the panel dock to other element. But as you see, the panel element still have the list data, so it should be recovered.

@kevinpschaaf kevinpschaaf added the p2 label
@kevinpschaaf kevinpschaaf self-assigned this
@kevinpschaaf

Yes, dom-repeat needs balanced re-attachment logic to re-insert stamped nodes back into the DOM after having been detached. This will be the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.