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

2.x class-based elements don't have behaviors defined in the constructor #4396

Closed
valdrinkoshi opened this issue Mar 9, 2017 · 1 comment

Comments

@valdrinkoshi
Copy link
Member

A legacy element (Polymer({ is: 'my-el' })) will have behaviors defined for each instance.

A class-based element (class MyEl extends Polymer.Element) will instead have behaviors defined in the constructor, so each instance must access via this.constructor.behaviors.
http://jsbin.com/fufikun/1/edit?html,console,output

How should hybrid element authors go about it?

@valdrinkoshi
Copy link
Member Author

valdrinkoshi commented Mar 9, 2017

an example: PolymerElements/iron-a11y-keys-behavior#69
Should iron-a11y-keys-behavior retrieve behaviors like this?

var behaviors = this.behaviors || this.constructor.behaviors

Or should we expect Polymer to set behaviors to the instances?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants