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

feat(selector-parser): group nodes by compound selector #33

Merged
merged 17 commits into from Aug 3, 2021

Conversation

idoros
Copy link
Collaborator

@idoros idoros commented Jul 14, 2021

This PR add a new type of selector: CompoundSelector, which represents a list of Selectors that query a single element in the DOM. And tools to group AST into the new compound selector and flatten it back (resolve #23 ).

  • CompoundSelector
    • AST
    • non-standard nodes (Nesting|CommentsWithSpacing|Invalid|CompoundSelector|Selector)
    • SimpleSelector type
    • test in walk
  • groupCompoundSelectors / splitCompoundSelectors
    • group valid nodes
    • mark invalid - universal | type must only be placed as the first node
    • place out-of-context/unexpected nodes out of compound (nth types for now)
    • spread group nodes - selector | compound
    • accepts deep read only ast
    • handle comments
    • default split pseudo-element into a separate compound (with option to override behavior)
  • documentation

- new util to group selector parts by dom target
- added new grouped_selector AST type
@idoros idoros requested a review from barak007 July 14, 2021 09:38
@idoros idoros added css-selector-parser enhancement New feature or request labels Jul 14, 2021
idoros and others added 3 commits July 15, 2021 09:10
- new AST selector type for a list of AST that targets a DOM element
- new AST type for comment with no spacing
- added a bunch of type conditions to selector test-kit createNode
- change groupSelectorTargets to use new CompoundSelector AST
  - return input selector/s with shallow grouping of compound selectors
@idoros idoros changed the title feat(selector-parser): group selectors by target feat(selector-parser): group nodes by compound selector Jul 27, 2021
Copy link
Collaborator

@barak007 barak007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@barak007 barak007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work

@idoros idoros merged commit 98ea64f into master Aug 3, 2021
@idoros idoros deleted the ido/split-merge-selector-targets branch August 3, 2021 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

css selector seperateChunks / mergeChunks utils
2 participants