* Finds all elements that matche `selector`, scoped inside `root` * for user-agents that do not support native scoping. * * This method isn't required for modern builds, can be removed. * TODO(#37136): This will fail if `root` is a `ShadowRoot`. * * @param {Element|ShadowRoot} root * @param {
(root, selector)
| 31 | * @return {NodeList} |
| 32 | */ |
| 33 | function scopedQuerySelectionFallback(root, selector) { |
| 34 | const {classList} = /** @type {Element} */ (root); |
| 35 | |
| 36 | const unique = 'i-amphtml-scoped'; |
| 37 | classList.add(unique); |
| 38 | const scopedSelector = prependSelectorsWith(selector, `.${unique}`); |
| 39 | const elements = root./*OK*/ querySelectorAll(scopedSelector); |
| 40 | classList.remove(unique); |
| 41 | return elements; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Finds the first element that matches `selector`, scoped inside `root`. |
no test coverage detected