mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibWeb: Add Optional<String> overload for Element::set_attribute
Which for now will just call the DeprecatedString version of this function. This is intended to be used in porting code over to using the new String equivalent with the end goal of removing the DeprecatedString version of this function. This allows us to port a whole heap of IDL interfaces from DeprecatedString to String.
This commit is contained in:
parent
d4a890080d
commit
a53459192f
44 changed files with 52 additions and 43 deletions
|
@ -160,6 +160,14 @@ WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name
|
|||
return {};
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name, Optional<String> const& value)
|
||||
{
|
||||
if (!value.has_value())
|
||||
return set_attribute(name, DeprecatedString {});
|
||||
|
||||
return set_attribute(name, value->to_deprecated_string());
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#validate-and-extract
|
||||
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, DeprecatedFlyString namespace_, DeprecatedFlyString qualified_name)
|
||||
{
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
DeprecatedString get_attribute_value(DeprecatedFlyString const& local_name, DeprecatedFlyString const& namespace_ = {}) const;
|
||||
|
||||
virtual WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, DeprecatedString const& value);
|
||||
WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, Optional<String> const& value);
|
||||
WebIDL::ExceptionOr<void> set_attribute_ns(DeprecatedFlyString const& namespace_, DeprecatedFlyString const& qualified_name, DeprecatedString const& value);
|
||||
void set_attribute_value(DeprecatedFlyString const& local_name, DeprecatedString const& value, DeprecatedFlyString const& prefix = {}, DeprecatedFlyString const& namespace_ = {});
|
||||
WebIDL::ExceptionOr<JS::GCPtr<Attr>> set_attribute_node(Attr&);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlbrelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLBRElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/sections.html#htmlbodyelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLBodyElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmldataelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLDataElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmldivelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLDivElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlembedelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLEmbedElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlfontelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLFontElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlframeelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLFrameElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlframesetelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLFrameSetElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlhrelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLHRElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlheadingelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLHeadingElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlhtmlelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLHtmlElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#import <DOM/Document.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#htmliframeelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLIFrameElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/embedded-content.html#htmlimageelement
|
||||
[Exposed=Window, LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height), UseDeprecatedAKString]
|
||||
[Exposed=Window, LegacyFactoryFunction=Image(optional unsigned long width, optional unsigned long height)]
|
||||
interface HTMLImageElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmllielement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLLIElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#htmllabelelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLLabelElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#htmllegendelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLLegendElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmllinkelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLLinkElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/image-maps.html#htmlmapelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLMapElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/obsolete.html#htmlmarqueeelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLMarqueeElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlmetaelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLMetaElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/edits.html#htmlmodelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLModElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlolistelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLOListElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#htmloptgroupelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLOptGroupElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlparagraphelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLParagraphElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/obsolete.html#htmlparamelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLParamElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlquoteelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLQuoteElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#htmlslotelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLSlotElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/embedded-content.html#htmlsourceelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLSourceElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/semantics.html#htmlstyleelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLStyleElement : HTMLElement {
|
||||
[HTMLConstructor] constructor();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#htmltablecaptionelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTableCaptionElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#htmltablecellelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTableCellElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#htmltablecolelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTableColElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#import <DOM/HTMLCollection.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#htmltableelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTableElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#import <HTML/HTMLTableCellElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#htmltablerowelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTableRowElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#import <HTML/HTMLTableRowElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#htmltablesectionelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTableSectionElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#htmltextareaelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTextAreaElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#htmltimeelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTimeElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#htmltrackelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLTrackElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlulistelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLUListElement : HTMLElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <HTML/HTMLMediaElement.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface HTMLVideoElement : HTMLMediaElement {
|
||||
|
||||
[HTMLConstructor] constructor();
|
||||
|
|
|
@ -337,7 +337,7 @@ WebIDL::ExceptionOr<void> Page::toggle_media_loop_state()
|
|||
if (media_element->has_attribute(HTML::AttributeNames::loop))
|
||||
media_element->remove_attribute(HTML::AttributeNames::loop);
|
||||
else
|
||||
TRY(media_element->set_attribute(HTML::AttributeNames::loop, {}));
|
||||
TRY(media_element->set_attribute(HTML::AttributeNames::loop, OptionalNone {}));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ WebIDL::ExceptionOr<void> Page::toggle_media_controls_state()
|
|||
if (media_element->has_attribute(HTML::AttributeNames::controls))
|
||||
media_element->remove_attribute(HTML::AttributeNames::controls);
|
||||
else
|
||||
TRY(media_element->set_attribute(HTML::AttributeNames::controls, {}));
|
||||
TRY(media_element->set_attribute(HTML::AttributeNames::controls, OptionalNone {}));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import <CSS/LinkStyle.idl>
|
||||
#import <SVG/SVGElement.idl>
|
||||
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface SVGStyleElement : SVGElement {
|
||||
[Reflect] attribute DOMString type;
|
||||
[Reflect] attribute DOMString media;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue