utils/dom/getlayoutparentnode
Functions
getLayoutParentNode( node ) → ParentNode | nullmodule:utils/dom/getlayoutparentnode~getLayoutParentNodeReturns the node one step up the flattened tree, the one the browser lays out and paints.
The layout-aware counterpart of
getParentNode, which walks the node tree. The two agree everywhere except for slotted content: assigning a node to a<slot>does not move it, so it stays a child of the host in the node tree while rendering inside the slot. A node-tree walk out of such a node therefore leaves into the light DOM and skips every element of the shadow tree that actually lays it out.Use this one for questions about geometry – what scrolls a node, what clips it, what it renders inside – and
getParentNodefor questions about structure, such as what a node is a descendant of for the purposes of DOM manipulation or event retargeting. Both cross shadow boundaries and both work for open and closed roots alike.Note:
Element#assignedSlotisnullwhen the slot lives in a closed shadow root, which the DOM standard does not expose. For slotted content inside a closed root this falls back to the node tree and answers exactly asgetParentNodedoes.Parameters
node: NodeThe node to step up from.
Returns
ParentNode | null