mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
LibWeb: Return DOMException instead of crashing when setting attributes
This commit is contained in:
committed by
Andreas Kling
parent
6891676fce
commit
5d3b7a5ecc
@@ -72,14 +72,16 @@ JS::GCPtr<HTMLTableCaptionElement> HTMLTableElement::caption()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#dom-table-caption
|
||||
void HTMLTableElement::set_caption(HTMLTableCaptionElement* caption)
|
||||
WebIDL::ExceptionOr<void> HTMLTableElement::set_caption(HTMLTableCaptionElement* caption)
|
||||
{
|
||||
// On setting, the first caption element child of the table element, if any, must be removed,
|
||||
// and the new value, if not null, must be inserted as the first node of the table element.
|
||||
delete_caption();
|
||||
|
||||
if (caption)
|
||||
MUST(pre_insert(*caption, first_child()));
|
||||
TRY(pre_insert(*caption, first_child()));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/tables.html#dom-table-createcaption
|
||||
|
||||
Reference in New Issue
Block a user