You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
isNodeShadowed/isNodeFromTemplate – legacy API used by Locker
"portals" aka MutationObserver – the patched MutationObserver has to know which nodes come from synthetic shadow roots
This could be much more efficient, though, if we computed it on-demand. Rather than traversing through the whole DOM tree to set this value on every node (not just elements – nodes!), we could compute it on-demand based on the parent/host of the node.
This would 1) restrict the cost to only when isNodeShadowed/MutationObserver is invoked, and 2) be more efficient in general, since walking up the tree is faster than traversing down the tree.
OTOH we would probably have to do some caching to avoid recomputing this for expensive MutationObserver calls.
The text was updated successfully, but these errors were encountered:
As described in #4088, we have a function called
recursivelySetShadowResolver
:lwc/packages/@lwc/synthetic-shadow/src/faux-shadow/shadow-token.ts
Lines 49 to 56 in 55112b7
This is called at the top level for all static fragments. For non-static fragments, we set it on all nodes in
linkNodeToShadow
:lwc/packages/@lwc/engine-core/src/framework/rendering.ts
Lines 526 to 535 in 55112b7
This serves two purposes:
isNodeShadowed
/isNodeFromTemplate
– legacy API used by LockerThis could be much more efficient, though, if we computed it on-demand. Rather than traversing through the whole DOM tree to set this value on every node (not just elements – nodes!), we could compute it on-demand based on the parent/host of the node.
This would 1) restrict the cost to only when
isNodeShadowed
/MutationObserver is invoked, and 2) be more efficient in general, since walking up the tree is faster than traversing down the tree.OTOH we would probably have to do some caching to avoid recomputing this for expensive MutationObserver calls.
The text was updated successfully, but these errors were encountered: