mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:57:45 +00:00
LibWeb: Port AttributeNames to FlyString
This commit is contained in:
parent
6a3f27509f
commit
e4f8c59210
93 changed files with 148 additions and 149 deletions
|
@ -46,14 +46,14 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> AudioConstructor::construct(
|
|||
auto audio = TRY(Bindings::throw_dom_exception_if_needed(vm, [&]() { return DOM::create_element(document, HTML::TagNames::audio, Namespace::HTML); }));
|
||||
|
||||
// 3. Set an attribute value for audio using "preload" and "auto".
|
||||
MUST(audio->set_attribute(HTML::AttributeNames::preload, "auto"sv));
|
||||
MUST(audio->set_attribute(HTML::AttributeNames::preload, "auto"_string));
|
||||
|
||||
auto src_value = vm.argument(0);
|
||||
|
||||
// 4. If src is given, then set an attribute value for audio using "src" and src.
|
||||
// (This will cause the user agent to invoke the object's resource selection algorithm before returning.)
|
||||
if (!src_value.is_undefined()) {
|
||||
auto src = TRY(src_value.to_deprecated_string(vm));
|
||||
auto src = TRY(src_value.to_string(vm));
|
||||
MUST(audio->set_attribute(HTML::AttributeNames::src, move(src)));
|
||||
}
|
||||
|
||||
|
|
|
@ -48,13 +48,13 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> ImageConstructor::construct(
|
|||
// 3. If width is given, then set an attribute value for img using "width" and width.
|
||||
if (vm.argument_count() > 0) {
|
||||
u32 width = TRY(vm.argument(0).to_u32(vm));
|
||||
MUST(image_element->set_attribute(HTML::AttributeNames::width, DeprecatedString::formatted("{}", width)));
|
||||
MUST(image_element->set_attribute(HTML::AttributeNames::width, MUST(String::formatted("{}", width))));
|
||||
}
|
||||
|
||||
// 4. If height is given, then set an attribute value for img using "height" and height.
|
||||
if (vm.argument_count() > 1) {
|
||||
u32 height = TRY(vm.argument(1).to_u32(vm));
|
||||
MUST(image_element->set_attribute(HTML::AttributeNames::height, DeprecatedString::formatted("{}", height)));
|
||||
MUST(image_element->set_attribute(HTML::AttributeNames::height, MUST(String::formatted("{}", height))));
|
||||
}
|
||||
|
||||
// 5. Return img.
|
||||
|
|
|
@ -61,7 +61,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> OptionConstructor::construct
|
|||
|
||||
// 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_deprecated_string(vm));
|
||||
auto value = TRY(vm.argument(1).to_string(vm));
|
||||
MUST(option_element->set_attribute(HTML::AttributeNames::value, value));
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> OptionConstructor::construct
|
|||
if (vm.argument_count() > 2) {
|
||||
auto default_selected = vm.argument(2).to_boolean();
|
||||
if (default_selected) {
|
||||
MUST(option_element->set_attribute(HTML::AttributeNames::selected, ""));
|
||||
MUST(option_element->set_attribute(HTML::AttributeNames::selected, String {}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue