In this case, it will be passed to Motion (or select directly from document in getNodeElement) since it's neither a single & nor pass the /^\s*&\s*>/, hence the result from parseStringSelector is { isSelf: false, selector: "& *" }
The (easy) solution is just make the behavior correct and call it a day, for now.
Problem
After applied to my project, I've found out that this function
https://github.com/rootEnginear/svelte-action-motionone/blob/ac963c726ad058a47e30564911cda847e69c490d/src/lib/utils/selector.ts#L3-L8
is so SO WRONG! — let's look at it from case by case.
&>*
(child combinator)In this case, it will be evaluated to
{ isSelf: false, selector: "*" }
which is WRONG! Because*
means EVERYTHING, not only the direct children.& *
,&+*
,&~*
(descendant, next-sibling, subsequent-sibling combinator)In this case, it will be passed to Motion (or select directly from
document
ingetNodeElement
) since it's neither a single&
nor pass the/^\s*&\s*>/
, hence the result fromparseStringSelector
is{ isSelf: false, selector: "& *" }
The (easy) solution is just make the behavior correct and call it a day, for now.