Herby Vojčík 4 years ago
parent
commit
6c4e54c495
1 changed files with 3 additions and 2 deletions
  1. 3 2
      lib/read.js

+ 3 - 2
lib/read.js

@@ -40,8 +40,9 @@ function* eachFormElementInTree (form) {
         for (let value of form[tag]) {
             let shouldCancel = false;
             const cancel = () => shouldCancel = true;
-            yield {tag, value, cancel};
-            if (DIVE_TAGS[tag] && !shouldCancel) yield* eachFormElementInTree(value);
+            const dive = () => eachFormElementInTree(value);
+            yield {tag, value, cancel, dive};
+            if (DIVE_TAGS[tag] && !shouldCancel) yield* dive();
         }
     }
 }