Skip to content

Bug in handling @scope rule - "to" as a part of a selector #90

Description

@ChrisKuBa

Hi,

I found a bug that make it impossible to use the @scope rule in my case:

@scope (.innerActionsWrapper) to (.inputInnerButtons > * > *, :global(.tkx-inputComponentButtons) > * > *) {
    --button-variant: 'transparent';
}


This line do not split by token, it splits by word. The word "to" is included in the selector itselft also.
So splitting by token will fix this issue

const splitScopeParams = (params) => {
    const ast = valueParser(params);

    const before = [];
    const after = [];
    let current = before;

    for (const node of ast.nodes) {
        if (node.type === 'word' && node.value === 'to') {
            current = after;
            continue;
        }
        current.push(node);
    }

    return [
        valueParser.stringify(before).trim(),
        valueParser.stringify(after).trim()
    ];
}

...

atRule.params = splitScopeParams(atRule.params)
  .map((item) => {

...

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions