Skip to content

Commit

Permalink
fix: 修复子应用切换模板样式重复问题 (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
yiludege committed Sep 22, 2022
1 parent bf0fb18 commit 80e1b4b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/wujie-core/src/shadow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import {
WUJIE_LOADING_STYLE,
WUJIE_LOADING_SVG,
} from "./constant";
import { getWujieById, rawElementAppendChild, rawElementRemoveChild, relativeElementTagAttrMap } from "./common";
import {
getWujieById,
rawAppendChild,
rawElementAppendChild,
rawElementRemoveChild,
relativeElementTagAttrMap,
} from "./common";
import { getExternalStyleSheets } from "./entry";
import Wujie from "./sandbox";
import { patchElementEffect } from "./iframe";
Expand Down Expand Up @@ -132,14 +138,14 @@ function replaceHeadAndBody(html: HTMLHtmlElement, head: HTMLHeadElement, body:
const bodyElement = html.querySelector("body");
if (headElement) {
while (headElement.firstChild) {
head.appendChild(headElement.firstChild.cloneNode(true));
rawAppendChild.call(head, headElement.firstChild.cloneNode(true));
headElement.removeChild(headElement.firstChild);
}
headElement.parentNode.replaceChild(head, headElement);
}
if (bodyElement) {
while (bodyElement.firstChild) {
body.appendChild(bodyElement.firstChild.cloneNode(true));
rawAppendChild.call(body, bodyElement.firstChild.cloneNode(true));
bodyElement.removeChild(bodyElement.firstChild);
}
bodyElement.parentNode.replaceChild(body, bodyElement);
Expand Down

0 comments on commit 80e1b4b

Please sign in to comment.