Skip to content

Commit

Permalink
fix: 修复降级后页面无法渲染的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yiludege committed Mar 29, 2023
1 parent 8981b7b commit 1883f59
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/wujie-core/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,15 @@ export function localGenerator(
// 代理 document
const proxyDocument = {};
const sandbox = iframe.contentWindow.__WUJIE;
const rawCreateElement = iframe.contentWindow.__WUJIE_RAW_DOCUMENT_CREATE_ELEMENT__;
const rawCreateTextNode = iframe.contentWindow.__WUJIE_RAW_DOCUMENT_CREATE_TEXT_NODE__;
// 特殊处理
Object.defineProperties(proxyDocument, {
createElement: {
get: () => {
return function (...args) {
const element = rawCreateElement.apply(iframe.contentDocument, args);
const element = iframe.contentWindow.__WUJIE_RAW_DOCUMENT_CREATE_ELEMENT__.apply(
iframe.contentDocument,
args
);
patchElementEffect(element, iframe.contentWindow);
return element;
};
Expand All @@ -259,7 +260,10 @@ export function localGenerator(
createTextNode: {
get: () => {
return function (...args) {
const element = rawCreateTextNode.apply(iframe.contentDocument, args);
const element = iframe.contentWindow.__WUJIE_RAW_DOCUMENT_CREATE_TEXT_NODE__.apply(
iframe.contentDocument,
args
);
patchElementEffect(element, iframe.contentWindow);
return element;
};
Expand Down

0 comments on commit 1883f59

Please sign in to comment.