mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibWeb: Make the innerHTML setter spec compliant
This adds innerHTML to ShadowRoot in the process.
This commit is contained in:
parent
f62477c093
commit
8e0f3436a2
8 changed files with 109 additions and 9 deletions
|
@ -4,8 +4,10 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOMParsing/InnerHTML.h>
|
||||
#include <LibWeb/Layout/BlockBox.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
@ -33,4 +35,22 @@ RefPtr<Layout::Node> ShadowRoot::create_layout_node()
|
|||
return adopt_ref(*new Layout::BlockBox(document(), this, CSS::ComputedValues {}));
|
||||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml
|
||||
String ShadowRoot::inner_html() const
|
||||
{
|
||||
return serialize_fragment(/* FIXME: Providing true for the require well-formed flag (which may throw) */);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml
|
||||
ExceptionOr<void> ShadowRoot::set_inner_html(String const& markup)
|
||||
{
|
||||
auto result = DOMParsing::InnerHTML::inner_html_setter(*this, markup);
|
||||
if (result.is_exception())
|
||||
return result.exception();
|
||||
|
||||
set_needs_style_update(true);
|
||||
document().invalidate_layout();
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue