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.8-preview] detached not getting called when the element being removed is in the localDom of another element. #1145

Closed
frankiefu opened this issue Jan 29, 2015 · 1 comment
Assignees
Labels

Comments

@frankiefu
Copy link
Member

Under CustomElements polyfill (e.g. Safari, Firefox), detached is not getting called when trying to remove an element (x-foo) which is in the localDom of another element (x-app).

<script>
  Polymer({
    is: 'x-foo',
    detached: function() {
      console.log('x-foo.detached');
    }
  });
</script>

<dom-module id="x-app">
  <template>
    <x-foo id="foo"></x-foo>
  </template>
</dom-module>

<script>
  Polymer({
    is: 'x-app',
    removeFoo: function() {
      this.$.foo.remove();
    }
  });
</script>

In the above, calling removeFoo() will not trigger x-foo's detached callback.

This is because in ready.html, host is being added to the element but in CustomElements/observe.js we also use host to determine if the element is inDocument.

@sorvell sorvell added 0.8 and removed 0.8 labels Mar 5, 2015
@sorvell
Copy link
Contributor

sorvell commented Mar 5, 2015

Fixed via webcomponents/webcomponentsjs@a8ec8d6

@sorvell sorvell closed this as completed Mar 5, 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