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

destroy时移除了额外的dom事件 #55

Closed
lianqin7 opened this issue Jul 1, 2013 · 5 comments
Closed

destroy时移除了额外的dom事件 #55

lianqin7 opened this issue Jul 1, 2013 · 5 comments
Labels

Comments

@lianqin7
Copy link
Member

lianqin7 commented Jul 1, 2013

代码在这:https://github.com/aralejs/widget/blob/master/src/widget.js#L324

this.element.off() 方法移除了 element 上的全部jquery绑定的 dom 事件,但是 如果element本来就有dom事件,而且和widget无关呢 。这样的使用就 误伤了

@afc163
Copy link
Member

afc163 commented Jul 1, 2013

#38

@lianqin7
Copy link
Member Author

lianqin7 commented Jul 1, 2013

@afc163 误伤问题还是没有解决啊, this.element.off() 的调用 完全没有判断是否是由template生成的

@lianqin7
Copy link
Member Author

lianqin7 commented Jul 1, 2013

@afc163 @popomore

this.undelegateEvents 已经解决了由这个widget绑定的dom事件的销毁问题,为什么又再调用一次 this.element.off(),说实话这里我非常不明白。

@lianqin7
Copy link
Member Author

lianqin7 commented Jul 1, 2013

特别是外部传入 element 的情况,很难保证原来在这个 element 上没有别的dom事件的绑定,直接一个 this.element.off() 处理,处理面太广了吧

@popomore
Copy link
Member

popomore commented Jul 1, 2013

也加个判断好了,如果是 widget 生成的才做处理

popomore added a commit that referenced this issue Jul 1, 2013
@popomore popomore closed this as completed Jul 1, 2013
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

3 participants