From 164873104c8c09eed68e864058ca176842780542 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 26 Oct 2020 16:27:00 +0200 Subject: [PATCH] WIP --- js/src/dom/polyfill.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/js/src/dom/polyfill.js b/js/src/dom/polyfill.js index fd52a77e3e68..d757ab5ad00e 100644 --- a/js/src/dom/polyfill.js +++ b/js/src/dom/polyfill.js @@ -13,7 +13,7 @@ let find = Element.prototype.querySelectorAll let findOne = Element.prototype.querySelector const scopeSelectorRegex = /:scope\b/ -const supportScopeQuery = (() => { +const supportsScopeQuery = (() => { const element = document.createElement('div') try { @@ -25,7 +25,7 @@ const supportScopeQuery = (() => { return true })() -if (!supportScopeQuery) { +if (!supportsScopeQuery) { find = function (selector) { if (!scopeSelectorRegex.test(selector)) { return this.querySelectorAll(selector) @@ -57,11 +57,7 @@ if (!supportScopeQuery) { const matches = find.call(this, selector) - if (typeof matches[0] !== 'undefined') { - return matches[0] - } - - return null + return matches[0] ? matches[0] : null } }