perf: lazily create the anchor tag used for URL resolving (#18571)

This commit is contained in:
Samuel Attard
2019-06-03 01:04:21 -07:00
committed by GitHub
parent 449d2752f2
commit 18acda7888

View File

@@ -20,8 +20,9 @@ import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-in
const { defineProperty } = Object
// Helper function to resolve relative url.
const a = window.document.createElement('a')
let a: HTMLAnchorElement
const resolveURL = function (url: string) {
a = a || window.document.createElement('a')
a.href = url
return a.href
}