Skip to content

Commit c8b92a8

Browse files
committed
Use correct Set.add invocation in Checkbox Validator
The [Set.add]() method doesn't accept variable arguments. To replace the `...` splatting, this commit loops over values and adds them individually. [Set.add](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/add)
1 parent dd26529 commit c8b92a8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
* Use `Set.add` correctly
10+
11+
*Sean Doyle*
12+
913
## 0.1.1 - 2024-09-27
1014

1115
* Expand version matrix to include `[email protected]` and `[email protected]`

app/javascript/constraint_validations/validators/checkbox_validator.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ function querySelectorAllNodes(selector, nodes, elements = new Set) {
147147
elements.add(node)
148148
}
149149

150-
elements.add(...querySelectorAllNodes(selector, node.children, elements))
150+
const childNodes = querySelectorAllNodes(selector, node.children, elements)
151+
152+
for (const childNode of childNodes) {
153+
elements.add(childNode)
154+
}
151155
}
152156
}
153157

0 commit comments

Comments
 (0)