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: 修复子应用媒体元素资源路径错误的问题 #439

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions packages/wujie-core/src/iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ declare global {
HTMLLinkElement: typeof HTMLLinkElement;
// script type
HTMLScriptElement: typeof HTMLScriptElement;
// media type
HTMLMediaElement: typeof HTMLMediaElement;
EventTarget: typeof EventTarget;
Event: typeof Event;
ShadowRoot: typeof ShadowRoot;
Expand Down Expand Up @@ -576,6 +578,7 @@ function patchRelativeUrlEffect(iframeWindow: Window): void {
fixElementCtrSrcOrHref(iframeWindow, iframeWindow.HTMLSourceElement, "src");
fixElementCtrSrcOrHref(iframeWindow, iframeWindow.HTMLLinkElement, "href");
fixElementCtrSrcOrHref(iframeWindow, iframeWindow.HTMLScriptElement, "src");
fixElementCtrSrcOrHref(iframeWindow, iframeWindow.HTMLMediaElement, "src");
}

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/wujie-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ export function fixElementCtrSrcOrHref(
| typeof HTMLAnchorElement
| typeof HTMLSourceElement
| typeof HTMLLinkElement
| typeof HTMLScriptElement,
| typeof HTMLScriptElement
| typeof HTMLMediaElement,
attr
): void {
// patch setAttribute
Expand Down