Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Fails on some selectors with pseudo-elements #7

@dryabov

Description

@dryabov

CSS processing fails on selectors like .table > :not(caption) > *, because after removing of pseudos it's transformed into an invalid selector: .table > > *.

Currently I've fixed it by using

        matchingElements = query(pseudolessSelector.replace(/(?<=[>+~])\s+(?=[>+~]|$)/g, ' * '));

but it looks like a dirty hack way (e.g. it may corrupt quoted strings in attributes).

The better solution is to check the type of pseudo.prev() in the transformSelector and, if necessary, insert * node (via replaceWith) instead of just remove.

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