The child nodes (must not be modified directly!)
The ClassList
of the element (will never change and must not be modified!)
The parent slot element in composed tree (must not be modified directly!)
The shadow-root which owns the element (will never change and must not be modified!)
The index in parentNode.childNodes (-1 if no parentNode) (must not be modified directly!)
The parent element (must not be modified directly!)
The index in containingSlot.slotNodes (must not be modified directly!)
The slot content nodes composed tree (must not be modified directly!)
Static
isStatic
isStatic
isAdd an event listener on the element
Optional
options: EventListenerOptionsApply slot value updates
Cast a node to an element (native node, virtual node, or component node)
Returns null
if the element is not a text node.
Cast an element to a general component
Returns null
if the element is not a component
Cast an element to the instance of the specified component
Returns null
if the element is not the instance of the specified component.
Cast an element to a native node
Returns null
if the element is not a native node.
Cast an element to a shadow root
Returns null
if the element is not a shadow root.
Cast an element to a virtual node
Returns null
if the element is not a virtual node.
Find whether this component is placeholding or not
This method will only find in the component using
list and generics
list.
If not found, returns undefined
.
If the placeholder will be used, returns true
; false
otherwise.
Collect the marks on the element
The marks includes the marks on ancestors (in shadow tree) of the element. If multiple marks on different elements shares the same name, the mark value on the child-most element is accepted.
Create a component if possible
Placeholding status should be checked with checkComponentPlaceholder
.
This function may create a native node if the using target is native node.
Optional
usingKey: stringOptional
genericTargets: { Optional
placeholderCallback: ((c) => void)Optional
initPropValues: ((comp) => void)Create a component if the given tag name is a component in the space, or a native node if not
The component using
map is not used.
Consider using checkComponentPlaceholder
to check if the tag name is in the using
map.
The global using registered with ComponentSpace.prototype.getGlobalUsingComponent
is still used.
Optional
genericTargets: { Optional
initPropValues: ((comp) => void)Create an intersection observer
The relativeElement
is the element to calculate intersection with ( null
for the viewport).
The relativeElementMargin
is the margins of the relativeElement
.
The thresholds
is a list of intersection ratios to trigger the listener
.
The listener always triggers once immediately after this call.
Optional
initPropValues: ((comp) => void)Optional
virtualName: stringDestroy backend element for the whole subtree.
It will destroy backend elements for the whole subtree (shadow tree) recursively. If a backend element for a component is destroyed, any backend element in the shadow tree of the component will also be destroyed.
Trigger an event with specified event object on the element
Iterate composed child nodes (including virtual nodes)
if f
returns false
then the iteration is interrupted.
Returns true
if that happens.
Iterate through elements ahd their corresponding slots (including slots-inherited nodes)
A function to execute for each element. Return false to break the iteration.
A boolean indicating whether the iteration is complete.
Iterate through elements of a specified slot (including slots-inherited nodes)
A function to execute for each element. Return false to break the iteration.
A boolean indicating whether the iteration is complete.
Iterate non-virtual composed child nodes
if f
returns false
then the iteration is interrupted.
Returns true
if that happens.
Iterate slots
Iterate through elements ahd their corresponding slots (NOT including slots-inherited nodes)
A function to execute for each element. Return false to break the iteration.
A boolean indicating whether the iteration is complete.
Iterate through elements of a specified slot (NOT including slots-inherited nodes)
A function to execute for each element. Return false to break the iteration.
A boolean indicating whether the iteration is complete.
Get the backend context
Get the backend element
Get the backend mode
Get composed parent (including virtual nodes)
Get the slot element for the slot content
The provided node must be a valid child node of the host of this shadow root. Otherwise the behavior is undefined.
Get the bounding client rect
Return zero values when the backend element is invalid or it does not have layout information.
Get the elements that should be composed in specified slot
This method always returns a new array (or null if the specified slot is invalid).
It is convenient but less performant.
For better performance, consider using forEachNodeInSpecifiedSlot
.
Get the slot element with the specified name
Check whether a node is connected to this shadow root
Test whether the target in this subtree matches the selector
Select the first descendant which matches the selector
Select all descendants which matches the selector
Remove an event listener on the element
Optional
options: EventListenerOptionsUpdate a slot value
The updated value should be applied with applySlotValueUpdates
call.
Set the dynamic slot handlers
If the handlers have not been set yet,
the insertSlotHandler
will be called for each slot that has been added to the shadow tree,
otherwise call updateSlotHandler
for each slots.
Set the node class
Optional
index: StyleSegmentIndexSet the node style
Optional
index: StyleSegmentIndexToggle the node class
Optional
force: booleanOptional
index: StyleSegmentIndexTrigger an event on the element
Optional
detail: unknownOptional
options: EventOptionsUse the same dynamic slot handlers with the source
Static
_$spliceStatic
_$updateStatic
createStatic
forIterate elements with their slots (slots-inherited nodes included)
Static
forIterate elements in specified slot (slots-inherited nodes included)
Static
forIterate elements with their slots (slots-inherited nodes NOT included)
Static
forIterate elements in specified slot (slots-inherited nodes NOT included)
Static
getGet whether the slot-inherit mode is set or not
Static
getGet the slot name of the element
Static
hasGet whether a node has any subtree MutationObserver
attached to it
If there is, then tree update may have more performance impact.
Static
insertStatic
isCheck the element is attached or not
Static
matchTest whether the target matches the selector
Static
parseParse a selector string so that it can be used multiple queries
Static
pretendMake the element looks like attached.
If the element will never be attached to backend or it has no backend element at all,
this can be used to trigger attached
life-time.
Static
pretendMake the element looks like detached.
This can be used to trigger detached
life-time without remove the element in the backend.
Static
replaceAttach the element into the backend, swapping out a placeholder element in the backend.
The element
must not be a child node of another element,
must not be attached before,
and must not have a ownerShadowRoot
.
The element
targetParent
and targetNode
must be in the same backend context.
The element
replaces the targetNode
in the targetParent
.
Static
setSet the virtual node to slot-inherit mode
In slot-inherit mode of an element, the child nodes of the element will be treated as siblings and can have different target slot.
Static
setSet the binding slot of specific node
Necessary if node belongs to a dynamic slot, which cannot be identified by slot name.
Static
setSet the slot name of the element
Once this method is called for an element
,
it will be treated as a slot which can contain child nodes in composed tree.
This method should not be used in components,
otherwise the slot content will always be dangled.
Optional
name: string
A general element
An element can be a
NativeNode
, aComponent
, or aVirtualNode
.