Skip to content

Commit 95e26e2

Browse files
authored
refactor: use URL API (electron#28583)
1 parent 6772e77 commit 95e26e2

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/renderer/web-view/web-view-attributes.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@ import { WebViewImpl } from '@electron/internal/renderer/web-view/web-view-impl'
33
import { WEB_VIEW_CONSTANTS } from '@electron/internal/renderer/web-view/web-view-constants';
44
import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
55

6-
// Helper function to resolve url set in attribute.
7-
const a = document.createElement('a');
8-
96
const resolveURL = function (url?: string | null) {
10-
if (!url) return '';
11-
a.href = url;
12-
return a.href;
7+
return url ? new URL(url, location.href).href : '';
138
};
149

1510
interface MutationHandler {

0 commit comments

Comments
 (0)