mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Introduce the slottable concept for DOM elements and text nodes
A slottable is either a DOM element or a DOM text node. They may be assigned to slots (HTMLSlotElement) either automatically or manually. Automatic assignment occurs by matching a slot's `name` attribute to a slottable's `slot` attribute. Manual assignment occurs by using the slot's (not yet implemented) `assign` API. This commit does not perform the above assignments. It just sets up the slottable concept via IDL and hooks the slottable mixin into the element and text nodes.
This commit is contained in:
parent
b85a252753
commit
45b36bd08a
Notes:
sideshowbarker
2024-07-17 00:25:35 +09:00
Author: https://github.com/trflynn89
Commit: 45b36bd08a
Pull-request: https://github.com/SerenityOS/serenity/pull/20965
Reviewed-by: https://github.com/Lubrsi
Reviewed-by: https://github.com/shannonbooth
12 changed files with 116 additions and 1 deletions
|
@ -930,6 +930,15 @@ Element* Node::parent_or_shadow_host_element()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Slottable Node::as_slottable()
|
||||
{
|
||||
VERIFY(is_slottable());
|
||||
|
||||
if (is_element())
|
||||
return JS::NonnullGCPtr { static_cast<Element&>(*this) };
|
||||
return JS::NonnullGCPtr { static_cast<Text&>(*this) };
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<NodeList> Node::child_nodes()
|
||||
{
|
||||
if (!m_child_nodes) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue