Skip to content

Commit

Permalink
Allow implicitLoop over HTMLCollection/NodeList
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasqueirozb committed Dec 6, 2023
1 parent 898345a commit df103fe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/_hyperscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,15 @@
*/
implicitLoop(value, func) {
if (this.shouldAutoIterate(value)) {
for (const x of value) func(x);
for (const x of value) {
if (x instanceof NodeList || x instanceof HTMLCollection) {
for (const y of x) {
func(y);
}
} else {
func(x);
}
}
} else {
func(value);
}
Expand Down

0 comments on commit df103fe

Please sign in to comment.