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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
}