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

Behaviors may not run registered if legacy element is subclassed #5567

Closed
dfreedm opened this issue Jul 1, 2019 · 3 comments · Fixed by boikovdv/polymer#1 · May be fixed by #5569
Closed

Behaviors may not run registered if legacy element is subclassed #5567

dfreedm opened this issue Jul 1, 2019 · 3 comments · Fixed by boikovdv/polymer#1 · May be fixed by #5569

Comments

@dfreedm
Copy link
Member

dfreedm commented Jul 1, 2019

Root cause of PolymerElements/iron-a11y-keys-behavior#93

In this scenario:

<script type="module">
  import {Polymer} from '@polymer/polymer/polymer-legacy.js';
  const behavior = {
    registered() {
      this.fizz = {};
    }
  };
  Polymer({
    is: 'x-foo',
    behaviors: [behavior]
  });

  class XBar extends customElements.get('x-foo') {}
  customElements.define(XBar.is, XBar);
</script>

<x-bar></x-bar>

<script>
  addEventListener('load', () => {
    const el = document.createElement('x-foo');
    document.body.appendChild(el);
  })
</script>

x-bar will have registered called on it, and x-foo will not.
This means that fizz will only be set on x-bar, and not on x-foo's class, which is causing the error in iron-a11y-keys-behavior.

@dfreedm
Copy link
Member Author

dfreedm commented Jul 1, 2019

This is caused by moving behavior processing to be more like 1.x, which happened in 3.2.

@stale
Copy link

stale bot commented Jul 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!

@stale stale bot closed this as completed Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment