Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace css-select with custom implementation #1536

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

TrySound
Copy link
Member

@TrySound TrySound commented Aug 22, 2021

There are a few benefits of custom implementation

  • csstree instead of css-what parser
  • 9 less dependecies
  • only standard features are supported (css-select has :parent from jquery)
  • new implementation allows to get rid of parentNode

Supported features

  • Universal selector
  • Type selector
  • Class selector
  • ID selector
  • [attr] attribute selector
  • [attr=value] attribute selector
  • [attr~=value] attribute selector
  • [attr|=value] attribute selector
  • [attr^=value] attribute selector
  • [attr$=value] attribute selector
  • [attr*=value] attribute selector
  • Selector list
  • Descendant combinator
  • Child combinator
  • General sibling combinator
  • Adjacent sibling combinator
  • :empty pseudo class
  • :nth-child pseudo class
  • :nth-last-child pseudo class
  • :first-child pseudo class
  • :last-child pseudo class
  • :only-child pseudo class
  • :nth-of-type pseudo class
  • :nth-last-of-type pseudo class
  • :first-of-type pseudo class
  • :last-of-type pseudo class
  • :only-of-type pseudo class
  • :has pseudo class
  • :not pseudo class
  • :is and :where pseudo classes
  • other pseudo classes (should be skipped)
  • Pseudo elements (should be skipped)

There are a few benefits of custom implementation

- csstree instead of css-what parser
- 9 less dependecies
- only standard features are supported (css-select has :parent from jquery)
- new implementation allows to get rid of parentNode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant