From: Johann-S Date: Sat, 26 Aug 2017 22:57:27 +0000 (+0200) Subject: Second element of find and findOne should be optional, not the first one X-Git-Tag: v5.0.0-alpha1~1330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b5850212e0c3a9f5f82d22eda0f6240d01f2f5a;p=thirdparty%2Fbootstrap.git Second element of find and findOne should be optional, not the first one --- diff --git a/js/src/alert.js b/js/src/alert.js index d23c4659c0..1bdd9706a4 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -84,7 +84,7 @@ class Alert { let parent = false if (selector) { - parent = SelectorEngine.find(selector)[0] + parent = SelectorEngine.findOne(selector) } if (!parent) { diff --git a/js/src/dom/selectorEngine.js b/js/src/dom/selectorEngine.js index bef6169884..0cff83ef97 100644 --- a/js/src/dom/selectorEngine.js +++ b/js/src/dom/selectorEngine.js @@ -46,19 +46,19 @@ const SelectorEngine = { return fnMatches.call(element, selector) }, - find(element = document, selector) { + find(selector, element = document) { if (typeof selector !== 'string') { return null } if (selector.indexOf('#') === 0) { - return SelectorEngine.findOne(element, selector) + return SelectorEngine.findOne(selector, element) } return element.querySelectorAll(selector) }, - findOne(element = document, selector) { + findOne(selector, element = document) { if (typeof selector !== 'string') { return null }