Skip to content

Commit 7cd7d22

Browse files
committed
Add support for deep options
1 parent 4bfde43 commit 7cd7d22

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/util/find-selected-options.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function findSelectedOptions(node, properties) {
4747
}
4848

4949
function findOptions(node) {
50-
var isOptionGroup = is(node, 'optgroup')
5150
var children = node.children
5251
var length = children.length
5352
var index = -1
@@ -57,12 +56,12 @@ function findOptions(node) {
5756
while (++index < length) {
5857
child = children[index]
5958

60-
if (!has(child, 'disabled')) {
61-
if (is(child, 'option')) {
59+
if (is(child, 'option')) {
60+
if (!has(child, 'disabled')) {
6261
results.push(child)
63-
} else if (!isOptionGroup && is(child, 'optgroup')) {
64-
results = results.concat(findOptions(child))
6562
}
63+
} else if ('children' in child) {
64+
results = results.concat(findOptions(child))
6665
}
6766
}
6867

test/fixtures/form/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Create account
6262

6363
Homepage: [Google](https://www.google.com/)
6464

65-
Enter a breed:·
65+
Enter a breed: (none selected)
6666

6767
Mail Account
6868

0 commit comments

Comments
 (0)