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

HTMLElement 代理和事件托管 #2

Open
harttle opened this issue Apr 13, 2018 · 0 comments
Open

HTMLElement 代理和事件托管 #2

harttle opened this issue Apr 13, 2018 · 0 comments

Comments

@harttle
Copy link
Collaborator

harttle commented Apr 13, 2018

要严格地控制事件就必须代理 HTMLElement,但考虑到这个代理工作量巨大,设计上只代理根元素,即 document.documentElement。容器内部的 Element 直接交由业务代码使用。这样做有这几个假设:

  • 在根元素与 DOM disconnect 后,根元素的所有子元素的事件都会停止触发。
  • 业务代码不会恶意地从子 HTMLElement 获取祖先元素以产生全局影响。
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

No branches or pull requests

1 participant