mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/HTML: Implement HTMLTemplateElement.content to spec
No real behaviour change - it just means we VERIFY before returning the value we returned before.
This commit is contained in:
parent
a25cb679fb
commit
37d0741099
Notes:
github-actions[bot]
2025-11-27 10:27:12 +00:00
Author: https://github.com/AtkinsSJ
Commit: 37d0741099
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6951
3 changed files with 13 additions and 1 deletions
|
|
@ -76,6 +76,16 @@ WebIDL::ExceptionOr<void> HTMLTemplateElement::cloned(Node& copy, bool subtree)
|
|||
return {};
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#dom-template-content
|
||||
GC::Ref<DOM::DocumentFragment> HTMLTemplateElement::content_for_bindings() const
|
||||
{
|
||||
// 1. Assert: this's template contents is not a ShadowRoot node.
|
||||
VERIFY(!m_content->is_shadow_root());
|
||||
|
||||
// 2. Return this's template contents.
|
||||
return *m_content;
|
||||
}
|
||||
|
||||
void HTMLTemplateElement::set_template_contents(GC::Ref<DOM::DocumentFragment> contents)
|
||||
{
|
||||
m_content = contents;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ public:
|
|||
GC::Ref<DOM::DocumentFragment> content() { return *m_content; }
|
||||
GC::Ref<DOM::DocumentFragment> const content() const { return *m_content; }
|
||||
|
||||
GC::Ref<DOM::DocumentFragment> content_for_bindings() const;
|
||||
|
||||
void set_template_contents(GC::Ref<DOM::DocumentFragment>);
|
||||
|
||||
virtual void adopted_from(DOM::Document&) override;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ interface HTMLTemplateElement : HTMLElement {
|
|||
|
||||
[HTMLConstructor] constructor();
|
||||
|
||||
readonly attribute DocumentFragment content;
|
||||
[ImplementedAs=content_for_bindings] readonly attribute DocumentFragment content;
|
||||
[Reflect=shadowrootmode, Enumerated=ShadowRootMode, CEReactions] attribute DOMString shadowRootMode;
|
||||
[Reflect=shadowrootdelegatesfocus, CEReactions] attribute boolean shadowRootDelegatesFocus;
|
||||
[Reflect=shadowrootclonable, CEReactions] attribute boolean shadowRootClonable;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue