1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Handle currently ignored WebIDL::ExceptionOr<T>s

This commit is contained in:
Linus Groh 2022-10-30 17:50:04 +00:00
parent f01d90aa63
commit acfb546048
38 changed files with 153 additions and 149 deletions

View file

@ -52,21 +52,21 @@ JS::ThrowCompletionOr<JS::Object*> OptionConstructor::construct(FunctionObject&)
auto text = TRY(vm.argument(0).to_string(vm));
if (!text.is_empty()) {
auto new_text_node = vm.heap().allocate<DOM::Text>(realm, document, text);
option_element->append_child(*new_text_node);
MUST(option_element->append_child(*new_text_node));
}
}
// 4. If value is given, then set an attribute value for option using "value" and value.
if (vm.argument_count() > 1) {
auto value = TRY(vm.argument(1).to_string(vm));
option_element->set_attribute(HTML::AttributeNames::value, value);
MUST(option_element->set_attribute(HTML::AttributeNames::value, value));
}
// 5. If defaultSelected is true, then set an attribute value for option using "selected" and the empty string.
if (vm.argument_count() > 2) {
auto default_selected = vm.argument(2).to_boolean();
if (default_selected) {
option_element->set_attribute(HTML::AttributeNames::selected, "");
MUST(option_element->set_attribute(HTML::AttributeNames::selected, ""));
}
}