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

Repeated elements may retain old event handlers #34

Closed
RubaXa opened this issue Feb 1, 2016 · 4 comments
Closed

Repeated elements may retain old event handlers #34

RubaXa opened this issue Feb 1, 2016 · 4 comments
Assignees
Labels

Comments

@RubaXa
Copy link

RubaXa commented Feb 1, 2016

If depending on conditions the element is replaced by another and oldTag.name === newTag.name, then old events saved.

Bug example: http://jsfiddle.net/zrmu855c/1/

@developit
Copy link
Member

@RubaXa Confirmed! Great catch, I will have a fix in for this tonight. There is a @todo in the code directly related to this:
https://github.com/developit/preact/blob/master/src/preact.js#L925

Thanks for giving me a simple way to reproduce it!

@developit developit added the bug label Feb 1, 2016
@developit developit self-assigned this Feb 1, 2016
@developit developit changed the title The problem with events. Recycled elements may retain old event handlers Feb 1, 2016
@developit developit changed the title Recycled elements may retain old event handlers Repeated elements may retain old event handlers Feb 2, 2016
@developit
Copy link
Member

@RubaXa This fix has landed in the 3.0 beta branch. Please test via npm i preact@beta if possible, thanks!

@RubaXa
Copy link
Author

RubaXa commented Feb 3, 2016

👌

@developit
Copy link
Member

Thanks for your demo fiddle, that helped immensely. Here's the same code running on preact 3.0 (preact@beta), and it now works as intended:
http://jsfiddle.net/developit/zrmu855c/2/

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