From d3f0b609f593718c01432fd56797541c6754df6f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 21 Feb 2019 15:37:52 +0100 Subject: [PATCH] use URL instead of creating new a element --- src/matrix-to.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/matrix-to.js b/src/matrix-to.js index d997be12f9..c9040e04af 100644 --- a/src/matrix-to.js +++ b/src/matrix-to.js @@ -260,12 +260,7 @@ function getServerName(userId) { function getHostnameFromMatrixDomain(domain) { if (!domain) return null; - - // The hostname might have a port, so we convert it to a URL and - // split out the real hostname. - const parser = document.createElement('a'); - parser.href = "https://" + domain; - return parser.hostname; + return new URL(`https://${domain}`).hostname; } function isHostInRegex(hostname, regexps) {