From 755ca7998ef0e3779a73bb269e023bd290e1457e Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Fri, 20 Nov 2020 11:30:32 -0600 Subject: [PATCH] Replace String.match() with RegExp.test(); it's slightly more efficient when we don't need the actual result --- Shared/Article Rendering/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index 9eed62e59..0b42889bd 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -46,7 +46,7 @@ function convertImgSrc() { document.querySelectorAll("img").forEach(element => { if (element.hasAttribute("data-canonical-src")) { element.src = element.getAttribute("data-canonical-src") - } else if (!element.src.match(/^[a-z]+\:\/\//i)) { + } else if (!/^[a-z]+\:\/\//i.test(element.src)) { element.src = new URL(element.src, document.baseURI).href; } });