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

Unlock selectors on discovery #30

Closed
theKashey opened this issue Aug 4, 2021 · 1 comment
Closed

Unlock selectors on discovery #30

theKashey opened this issue Aug 4, 2021 · 1 comment

Comments

@theKashey
Copy link
Owner

Currently, any selector will be inlined when the last part of it is found, however we can accept only those ones, which first part was found before as well

.dark-theme .header
⬇️
<div class='header'>does nothing</div>

<div class="dark-theme"> "unlocks .dark-theme"
 <div class='header'>uses style</div> 
@theKashey
Copy link
Owner Author

The idea is around the sequential nature of nested selectors:

// `dark-theme` is introduced first
<div class="dark-theme"> "unlocks .dark-theme"
// dependent selectors are always follow
  <div class='header'>uses style</div> 

This allows embedding a check into usedFilter - a function before preventing duplication of selectors.

  • before: if selector has been introduced - skip
  • now: and if parent part of a selector has NOT been introduced - skip

It does not handle proper gating, and absolutely ignores DOM structure. But it does the job

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

No branches or pull requests

1 participant