Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(animations): replace copy of query selector node-list from "spread" to "for" #39646

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/animations/browser/src/render/shared.ts
Expand Up @@ -183,7 +183,17 @@ if (_isNode || typeof Element !== 'undefined') {
_query = (element: any, selector: string, multi: boolean): any[] => {
let results: any[] = [];
if (multi) {
results.push(...element.querySelectorAll(selector));
// DO NOT REFACTOR TO USE SPREAD SYNTAX.
// For element queries that return sufficiently large NodeList objects,
// using spread syntax to populate the results array causes a RangeError
// due to the call stack limit being reached. `Array.from` can not be used
// as well, since NodeList is not iterable in IE 11, see
// https://developer.mozilla.org/en-US/docs/Web/API/NodeList
// More info is available in #38551.
const elems = element.querySelectorAll(selector);
AndrewKushnir marked this conversation as resolved.
Show resolved Hide resolved
for (let i = 0; i < elems.length; i++) {
AndrewKushnir marked this conversation as resolved.
Show resolved Hide resolved
results.push(elems[i]);
}
} else {
const elm = element.querySelector(selector);
if (elm) {
Expand Down