refactor: use URL API (#28583)

This commit is contained in:
Shelley Vohr 2021-04-09 21:22:18 +00:00 committed by GitHub
parent 6772e7773e
commit 95e26e2fd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 { 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) {
if (!url) return '';
a.href = url;
return a.href;
return url ? new URL(url, location.href).href : '';
};
interface MutationHandler {