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

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

Closed
jwu opened this issue May 7, 2015 · 2 comments
Assignees
Labels

Comments

@jwu
Copy link

jwu commented May 7, 2015

<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
Copy link
Author

jwu commented May 9, 2015

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 self-assigned this May 21, 2015
@kevinpschaaf
Copy link
Member

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.

sorvell pushed a commit that referenced this issue Jun 4, 2015
Re-insert rows when re-attaching. Fixes #1498. Fixes #1714.
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