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

主应用拦截原生的createElement可能导致子应用内instanceof异常 #274

Closed
Xusenbiao opened this issue Nov 21, 2022 · 0 comments

Comments

@Xusenbiao
Copy link
Contributor

描述bug
当主应用需要拦截原生的createElement时,自然会将createElementthis指向主应用的document
然而,目前在wujieproxyDocument中,是统一使用主应用的createElement,并尝试将this指向iframedocument

在使用过程中发现,如果wujieproxyDocument中,执行了被主应用改写过的createElement导致this最终指向主应用的document,会导致子应用内的节点,element instanceof HTMLElement 得到false

因此,是否应该改为使用同域iframecreateElement方法?

如何复现
1、第一步
主应用拦截window.document.createElement,并将调用时的this总是指向window.document
2、 第二步
用wujie加载子应用
3、第三步
在子应用内调用:const element = window.document.createElement("div")
结果:element instanceof HTMLElement得到false

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