ladybird/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp
Timothy Flynn 2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
2023-01-29 00:02:45 +00:00

40 lines
1.0 KiB
C++

/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Assertions.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/HTML/HTMLModElement.h>
namespace Web::HTML {
HTMLModElement::HTMLModElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLElement(document, move(qualified_name))
{
}
HTMLModElement::~HTMLModElement() = default;
JS::ThrowCompletionOr<void> HTMLModElement::initialize(JS::Realm& realm)
{
MUST_OR_THROW_OOM(Base::initialize(realm));
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLModElementPrototype>(realm, "HTMLModElement"));
return {};
}
Optional<DOM::ARIARoles::Role> HTMLModElement::default_role() const
{
// https://www.w3.org/TR/html-aria/#el-del
if (local_name() == TagNames::del)
return DOM::ARIARoles::Role::deletion;
// https://www.w3.org/TR/html-aria/#el-ins
if (local_name() == TagNames::ins)
return DOM::ARIARoles::Role::insertion;
VERIFY_NOT_REACHED();
}
}