@@ -183,7 +183,17 @@ if (_isNode || typeof Element !== 'undefined') {
|
183 | 183 | _query = (element: any, selector: string, multi: boolean): any[] => { |
184 | 184 | let results: any[] = []; |
185 | 185 | if (multi) { |
186 | | -results.push(...element.querySelectorAll(selector)); |
| 186 | +// DO NOT REFACTOR TO USE SPREAD SYNTAX. |
| 187 | +// For element queries that return sufficiently large NodeList objects, |
| 188 | +// using spread syntax to populate the results array causes a RangeError |
| 189 | +// due to the call stack limit being reached. `Array.from` can not be used |
| 190 | +// as well, since NodeList is not iterable in IE 11, see |
| 191 | +// https://developer.mozilla.org/en-US/docs/Web/API/NodeList |
| 192 | +// More info is available in #38551. |
| 193 | +const elems = element.querySelectorAll(selector); |
| 194 | +for (let i = 0; i < elems.length; i++) { |
| 195 | +results.push(elems[i]); |
| 196 | +} |
187 | 197 | } else { |
188 | 198 | const elm = element.querySelector(selector); |
189 | 199 | if (elm) { |
|