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

fix: 修复降级模式会丢失事件监听器 #758

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

evolzzz
Copy link
Contributor

@evolzzz evolzzz commented Dec 16, 2023

某些页面使用降级模式,发现一些事件监听器丢失。
经排查,此处:
recordEventListeners:
if (!elementListenerList.find((listener) => listener.handler === handler)) {

这个判断只判断handler一样就是认为是相同事件监听器,不进行缓存,根据addEventListener的参数,type、handler、options、useCapture、wantsuntrusted五元组共同组成不同事件监听器,因此type不同、handler相同也应该缓存下来。

改为:
if (!elementListenerList.find((listener) => listener.type === type && listener.handler === handler))

应该能兼容99%的情况。

  • 提交符合commit规范
详细描述

fixes #757

@yiludege yiludege merged commit 534e865 into Tencent:master Dec 18, 2023
@yiludege
Copy link
Collaborator

感谢贡献!

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

Successfully merging this pull request may close these issues.

降级模式下,事件监听器可能会丢失
2 participants