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: 修复qiankun本身在沙箱下运行时,可能出现无法劫持document.createElement元素问题 #1046

Merged
merged 2 commits into from
Nov 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/sandbox/patchers/dynamicAppend/forStrictSandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function patchDocumentCreateElement() {
): HTMLElement {
const element = rawDocumentCreateElement.call(this, tagName, options);
if (isHijackingTag(tagName)) {
const attachProxy = documentAttachProxyMap.get(this);
// 这里使用document来获取比this更加健壮,因为之前set的时候是传入的document:
// 因为document不一定是原生的document,这种情况出现在qiankun本身就在另一个沙箱下运行的情况,而那个沙箱可能连document都重写了。
const attachProxy = documentAttachProxyMap.get(document);
if (attachProxy) {
const proxyContainerConfig = proxyAttachContainerConfigMap.get(attachProxy);
if (proxyContainerConfig) {
Expand Down