1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +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:
Shannon Booth 2023-09-03 01:09:33 +12:00 committed by Sam Atkins
parent d4a890080d
commit a53459192f
44 changed files with 52 additions and 43 deletions

View file

@ -160,6 +160,14 @@ WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name
return {}; 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 // https://dom.spec.whatwg.org/#validate-and-extract
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, DeprecatedFlyString namespace_, DeprecatedFlyString qualified_name) WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, DeprecatedFlyString namespace_, DeprecatedFlyString qualified_name)
{ {

View file

@ -96,6 +96,7 @@ public:
DeprecatedString get_attribute_value(DeprecatedFlyString const& local_name, DeprecatedFlyString const& namespace_ = {}) const; DeprecatedString get_attribute_value(DeprecatedFlyString const& local_name, DeprecatedFlyString const& namespace_ = {}) const;
virtual WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, DeprecatedString const& value); 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); 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_ = {}); 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&); WebIDL::ExceptionOr<JS::GCPtr<Attr>> set_attribute_node(Attr&);

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlbrelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlbrelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLBRElement : HTMLElement { interface HTMLBRElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -2,7 +2,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/sections.html#htmlbodyelement // https://html.spec.whatwg.org/multipage/sections.html#htmlbodyelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLBodyElement : HTMLElement { interface HTMLBodyElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmldataelement // https://html.spec.whatwg.org/multipage/semantics.html#htmldataelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLDataElement : HTMLElement { interface HTMLDataElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmldivelement // https://html.spec.whatwg.org/multipage/semantics.html#htmldivelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLDivElement : HTMLElement { interface HTMLDivElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlembedelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlembedelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLEmbedElement : HTMLElement { interface HTMLEmbedElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlfontelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlfontelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLFontElement : HTMLElement { interface HTMLFontElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlframeelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlframeelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLFrameElement : HTMLElement { interface HTMLFrameElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -2,7 +2,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlframesetelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlframesetelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLFrameSetElement : HTMLElement { interface HTMLFrameSetElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlhrelement // https://html.spec.whatwg.org/multipage/grouping-content.html#htmlhrelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLHRElement : HTMLElement { interface HTMLHRElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlheadingelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlheadingelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLHeadingElement : HTMLElement { interface HTMLHeadingElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlhtmlelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlhtmlelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLHtmlElement : HTMLElement { interface HTMLHtmlElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -2,7 +2,7 @@
#import <DOM/Document.idl> #import <DOM/Document.idl>
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#htmliframeelement // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#htmliframeelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLIFrameElement : HTMLElement { interface HTMLIFrameElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/embedded-content.html#htmlimageelement // 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 { interface HTMLImageElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmllielement // https://html.spec.whatwg.org/multipage/grouping-content.html#htmllielement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLLIElement : HTMLElement { interface HTMLLIElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/forms.html#htmllabelelement // https://html.spec.whatwg.org/multipage/forms.html#htmllabelelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLLabelElement : HTMLElement { interface HTMLLabelElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/form-elements.html#htmllegendelement // https://html.spec.whatwg.org/multipage/form-elements.html#htmllegendelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLLegendElement : HTMLElement { interface HTMLLegendElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmllinkelement // https://html.spec.whatwg.org/multipage/semantics.html#htmllinkelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLLinkElement : HTMLElement { interface HTMLLinkElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/image-maps.html#htmlmapelement // https://html.spec.whatwg.org/multipage/image-maps.html#htmlmapelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLMapElement : HTMLElement { interface HTMLMapElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/obsolete.html#htmlmarqueeelement // https://html.spec.whatwg.org/multipage/obsolete.html#htmlmarqueeelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLMarqueeElement : HTMLElement { interface HTMLMarqueeElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlmetaelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlmetaelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLMetaElement : HTMLElement { interface HTMLMetaElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/edits.html#htmlmodelement // https://html.spec.whatwg.org/multipage/edits.html#htmlmodelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLModElement : HTMLElement { interface HTMLModElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlolistelement // https://html.spec.whatwg.org/multipage/grouping-content.html#htmlolistelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLOListElement : HTMLElement { interface HTMLOListElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/form-elements.html#htmloptgroupelement // https://html.spec.whatwg.org/multipage/form-elements.html#htmloptgroupelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLOptGroupElement : HTMLElement { interface HTMLOptGroupElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlparagraphelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlparagraphelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLParagraphElement : HTMLElement { interface HTMLParagraphElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/obsolete.html#htmlparamelement // https://html.spec.whatwg.org/multipage/obsolete.html#htmlparamelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLParamElement : HTMLElement { interface HTMLParamElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlquoteelement // https://html.spec.whatwg.org/multipage/grouping-content.html#htmlquoteelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLQuoteElement : HTMLElement { interface HTMLQuoteElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/scripting.html#htmlslotelement // https://html.spec.whatwg.org/multipage/scripting.html#htmlslotelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLSlotElement : HTMLElement { interface HTMLSlotElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/embedded-content.html#htmlsourceelement // https://html.spec.whatwg.org/multipage/embedded-content.html#htmlsourceelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLSourceElement : HTMLElement { interface HTMLSourceElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -3,7 +3,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/semantics.html#htmlstyleelement // https://html.spec.whatwg.org/multipage/semantics.html#htmlstyleelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLStyleElement : HTMLElement { interface HTMLStyleElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/tables.html#htmltablecaptionelement // https://html.spec.whatwg.org/multipage/tables.html#htmltablecaptionelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTableCaptionElement : HTMLElement { interface HTMLTableCaptionElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/tables.html#htmltablecellelement // https://html.spec.whatwg.org/multipage/tables.html#htmltablecellelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTableCellElement : HTMLElement { interface HTMLTableCellElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/tables.html#htmltablecolelement // https://html.spec.whatwg.org/multipage/tables.html#htmltablecolelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTableColElement : HTMLElement { interface HTMLTableColElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -5,7 +5,7 @@
#import <DOM/HTMLCollection.idl> #import <DOM/HTMLCollection.idl>
// https://html.spec.whatwg.org/multipage/tables.html#htmltableelement // https://html.spec.whatwg.org/multipage/tables.html#htmltableelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTableElement : HTMLElement { interface HTMLTableElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -3,7 +3,7 @@
#import <HTML/HTMLTableCellElement.idl> #import <HTML/HTMLTableCellElement.idl>
// https://html.spec.whatwg.org/multipage/tables.html#htmltablerowelement // https://html.spec.whatwg.org/multipage/tables.html#htmltablerowelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTableRowElement : HTMLElement { interface HTMLTableRowElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -3,7 +3,7 @@
#import <HTML/HTMLTableRowElement.idl> #import <HTML/HTMLTableRowElement.idl>
// https://html.spec.whatwg.org/multipage/tables.html#htmltablesectionelement // https://html.spec.whatwg.org/multipage/tables.html#htmltablesectionelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTableSectionElement : HTMLElement { interface HTMLTableSectionElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/form-elements.html#htmltextareaelement // https://html.spec.whatwg.org/multipage/form-elements.html#htmltextareaelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTextAreaElement : HTMLElement { interface HTMLTextAreaElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#htmltimeelement // https://html.spec.whatwg.org/multipage/text-level-semantics.html#htmltimeelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTimeElement : HTMLElement { interface HTMLTimeElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/media.html#htmltrackelement // https://html.spec.whatwg.org/multipage/media.html#htmltrackelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLTrackElement : HTMLElement { interface HTMLTrackElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLElement.idl> #import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/grouping-content.html#htmlulistelement // https://html.spec.whatwg.org/multipage/grouping-content.html#htmlulistelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLUListElement : HTMLElement { interface HTMLUListElement : HTMLElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -1,7 +1,7 @@
#import <HTML/HTMLMediaElement.idl> #import <HTML/HTMLMediaElement.idl>
// https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement // https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface HTMLVideoElement : HTMLMediaElement { interface HTMLVideoElement : HTMLMediaElement {
[HTMLConstructor] constructor(); [HTMLConstructor] constructor();

View file

@ -337,7 +337,7 @@ WebIDL::ExceptionOr<void> Page::toggle_media_loop_state()
if (media_element->has_attribute(HTML::AttributeNames::loop)) if (media_element->has_attribute(HTML::AttributeNames::loop))
media_element->remove_attribute(HTML::AttributeNames::loop); media_element->remove_attribute(HTML::AttributeNames::loop);
else else
TRY(media_element->set_attribute(HTML::AttributeNames::loop, {})); TRY(media_element->set_attribute(HTML::AttributeNames::loop, OptionalNone {}));
return {}; return {};
} }
@ -353,7 +353,7 @@ WebIDL::ExceptionOr<void> Page::toggle_media_controls_state()
if (media_element->has_attribute(HTML::AttributeNames::controls)) if (media_element->has_attribute(HTML::AttributeNames::controls))
media_element->remove_attribute(HTML::AttributeNames::controls); media_element->remove_attribute(HTML::AttributeNames::controls);
else else
TRY(media_element->set_attribute(HTML::AttributeNames::controls, {})); TRY(media_element->set_attribute(HTML::AttributeNames::controls, OptionalNone {}));
return {}; return {};
} }

View file

@ -1,7 +1,7 @@
#import <CSS/LinkStyle.idl> #import <CSS/LinkStyle.idl>
#import <SVG/SVGElement.idl> #import <SVG/SVGElement.idl>
[Exposed=Window, UseDeprecatedAKString] [Exposed=Window]
interface SVGStyleElement : SVGElement { interface SVGStyleElement : SVGElement {
[Reflect] attribute DOMString type; [Reflect] attribute DOMString type;
[Reflect] attribute DOMString media; [Reflect] attribute DOMString media;