mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: use URL API (#28583)
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user