mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 10:20:22 +00:00
LibWeb: Update spec text for set_value_of_indexed_property
https://github.com/whatwg/html/pull/11932 resolved the AD-HOC comment and adjusted the spec text.
This commit is contained in:
parent
48f08ba09d
commit
7e50dcb687
Notes:
github-actions[bot]
2026-01-06 12:04:53 +00:00
Author: https://github.com/lpas
Commit: 7e50dcb687
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6749
Reviewed-by: https://github.com/Psychpsyo
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/konradekk
Reviewed-by: https://github.com/shannonbooth
1 changed files with 7 additions and 7 deletions
|
|
@ -99,18 +99,18 @@ WebIDL::ExceptionOr<void> HTMLOptionsCollection::set_value_of_indexed_property(u
|
|||
auto root_element = root();
|
||||
|
||||
if (index >= length) {
|
||||
// 3. Let n be index minus length.
|
||||
auto n = index - length;
|
||||
// 3. Let delta be index minus length
|
||||
auto delta = index - length;
|
||||
|
||||
// 4. If n is greater than zero, then append a DocumentFragment consisting of n-1 new option elements with no attributes and no child nodes to the select element on which the HTMLOptionsCollection is rooted.
|
||||
if (n > 0) {
|
||||
// AD-HOC: https://github.com/whatwg/html/issues/11905
|
||||
for (WebIDL::UnsignedLong i = 0; i < n; i++) {
|
||||
// 4. If delta is greater than zero, then append a DocumentFragment consisting of delta new option elements with
|
||||
// no attributes and no child nodes to the select element on which the HTMLOptionsCollection is rooted.
|
||||
if (delta > 0) {
|
||||
for (WebIDL::UnsignedLong i = 0; i < delta; i++) {
|
||||
TRY(root_element->append_child(TRY(DOM::create_element(root_element->document(), HTML::TagNames::option, Namespace::HTML))));
|
||||
}
|
||||
}
|
||||
|
||||
// 5. If n is greater than or equal to zero, append value to the select element.
|
||||
// 5. If delta is greater than or equal to zero, append value to the select element.
|
||||
TRY(root_element->append_child(option));
|
||||
} else {
|
||||
// 5 (cont). Otherwise, replace the indexth element in the collection by value.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue