aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/dom/selector-engine.js.map
blob: 61622fb827f9b9bee89239b9beb6c26a8e8fef95 (plain) (blame)
1
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.2.0): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { isDisabled, isVisible } from '../util/index'\n\n/**\n * Constants\n */\n\nconst SelectorEngine = {\n  find(selector, element = document.documentElement) {\n    return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n  },\n\n  findOne(selector, element = document.documentElement) {\n    return Element.prototype.querySelector.call(element, selector)\n  },\n\n  children(element, selector) {\n    return [].concat(...element.children).filter(child => child.matches(selector))\n  },\n\n  parents(element, selector) {\n    const parents = []\n    let ancestor = element.parentNode.closest(selector)\n\n    while (ancestor) {\n      parents.push(ancestor)\n      ancestor = ancestor.parentNode.closest(selector)\n    }\n\n    return parents\n  },\n\n  prev(element, selector) {\n    let previous = element.previousElementSibling\n\n    while (previous) {\n      if (previous.matches(selector)) {\n        return [previous]\n      }\n\n      previous = previous.previousElementSibling\n    }\n\n    return []\n  },\n  // TODO: this is now unused; remove later along with prev()\n  next(element, selector) {\n    let next = element.nextElementSibling\n\n    while (next) {\n      if (next.matches(selector)) {\n        return [next]\n      }\n\n      next = next.nextElementSibling\n    }\n\n    return []\n  },\n\n  focusableChildren(element) {\n    const focusables = [\n      'a',\n      'button',\n      'input',\n      'textarea',\n      'select',\n      'details',\n      '[tabindex]',\n      '[contenteditable=\"true\"]'\n    ].map(selector => `${selector}:not([tabindex^=\"-\"])`).join(',')\n\n    return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))\n  }\n}\n\nexport default SelectorEngine\n"],"names":["SelectorEngine","find","selector","element","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","matches","parents","ancestor","parentNode","closest","push","prev","previous","previousElementSibling","next","nextElementSibling","focusableChildren","focusables","map","join","el","isDisabled","isVisible"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;EACA;;AAEA,QAAMA,cAAc,GAAG;IACrBC,IAAI,CAACC,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACjD,IAAA,OAAO,GAAGC,MAAH,CAAU,GAAGC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP,CAAA;KAFmB;;IAKrBS,OAAO,CAACT,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;MACpD,OAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP,CAAA;KANmB;;EASrBW,EAAAA,QAAQ,CAACV,OAAD,EAAUD,QAAV,EAAoB;EAC1B,IAAA,OAAO,GAAGI,MAAH,CAAU,GAAGH,OAAO,CAACU,QAArB,CAA+BC,CAAAA,MAA/B,CAAsCC,KAAK,IAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CAA/C,CAAP,CAAA;KAVmB;;EAarBe,EAAAA,OAAO,CAACd,OAAD,EAAUD,QAAV,EAAoB;MACzB,MAAMe,OAAO,GAAG,EAAhB,CAAA;MACA,IAAIC,QAAQ,GAAGf,OAAO,CAACgB,UAAR,CAAmBC,OAAnB,CAA2BlB,QAA3B,CAAf,CAAA;;EAEA,IAAA,OAAOgB,QAAP,EAAiB;QACfD,OAAO,CAACI,IAAR,CAAaH,QAAb,CAAA,CAAA;QACAA,QAAQ,GAAGA,QAAQ,CAACC,UAAT,CAAoBC,OAApB,CAA4BlB,QAA5B,CAAX,CAAA;EACD,KAAA;;EAED,IAAA,OAAOe,OAAP,CAAA;KAtBmB;;EAyBrB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