refactor: use URL API (#28583)
This commit is contained in:
parent
6772e7773e
commit
95e26e2fd4
1 changed files with 1 additions and 6 deletions
|
@ -3,13 +3,8 @@ import { WebViewImpl } from '@electron/internal/renderer/web-view/web-view-impl'
|
||||||
import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants';
|
import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants';
|
||||||
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
||||||
|
|
||||||
// Helper function to resolve url set in attribute.
|
|
||||||
const a = document.createElement('a');
|
|
||||||
|
|
||||||
const resolveURL = function (url?: string | null) {
|
const resolveURL = function (url?: string | null) {
|
||||||
if (!url) return '';
|
return url ? new URL(url, location.href).href : '';
|
||||||
a.href = url;
|
|
||||||
return a.href;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
interface MutationHandler {
|
interface MutationHandler {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue