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 7, 2023
1 parent 898345a commit a92a798
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 (typeof NodeList !== 'undefined' && (value instanceof NodeList || value instanceof HTMLCollection)) {
for (const y of x) {
func(y);
}
} else {
func(x);
}
}
} else {
func(value);
}
Expand Down

0 comments on commit a92a798

Please sign in to comment.