HTMLSelectElement: fix selectedOptions when selectedIndex < 0

Closes https://github.com/dart-lang/sdk/pull/54618

Also adds a comment to go.sh mentioning vpython3 comes with
depot_tools.

GitOrigin-RevId: 5e057703067c24d9d41bac75b6251c8f3a2fddd3
Change-Id: I937d8618c24602b4c0844d8a52ff00095836bca8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
Graciliano Monteiro Passos
2024-01-22 20:15:26 +00:00
committed by Commit Queue
parent 4983ea79be
commit 5d18799eae
3 changed files with 7 additions and 2 deletions
+2 -1
View File
@@ -27715,7 +27715,8 @@ class SelectElement extends HtmlElement {
var options = this.options.where((o) => o.selected).toList();
return new UnmodifiableListView(options);
} else {
return [this.options[this.selectedIndex!]];
var i = this.selectedIndex!;
return i < 0 ? [] : [this.options[i]];
}
}
}
+3
View File
@@ -35,6 +35,9 @@ if [[ "$1" != "" ]] ; then
fi
fi
# vpython3 is available through depot_tools. See
# https://github.com/dart-lang/sdk/wiki/Building for instructions on installing
# depot_tools.
reset && \
vpython3 ./dartdomgenerator.py --systems="$SYSTEMS" --logging=40 --update-dom-metadata --gen-interop "$ARG_OPTION"
@@ -20,7 +20,8 @@ $!MEMBERS
var options = this.options.where((o) => o.selected).toList();
return new UnmodifiableListView(options);
} else {
return [this.options[this.selectedIndex$NULLASSERT]];
var i = this.selectedIndex$NULLASSERT;
return i < 0 ? [] : [this.options[i]];
}
}
}