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

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

Closed
evolzzz opened this issue Dec 16, 2023 · 0 comments · Fixed by #758
Closed

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

evolzzz opened this issue Dec 16, 2023 · 0 comments · Fixed by #758

Comments

@evolzzz
Copy link
Contributor

evolzzz commented Dec 16, 2023

描述bug
某些页面使用降级模式,发现一些事件监听器丢失。
经排查,此处:
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.99%的情况。

如何复现
给出详细的复现步骤
1、第一步 xxx
2、 第二步 xxx

错误截图
如果有可以将截图带上

最小复现仓库或者地址
重要!!!,请尽量给出复现仓库,这样能极大加快bug解决速度

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 a pull request may close this issue.

1 participant