has-selector
/has-selector
Przegląda style i komponenty, w których JavaScript przełącza klasy rodzica według stanu dziecka, wartości pól lub obecności treści, i wskazuje miejsca, gdzie selektor CSS :has() może zastąpić skrypt.
- Autor
- thedaviddias ↗
- Repozytorium
- front-end-checklist ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 06.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 2
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 2
Brak sygnałów. Repozytorium zmienione 06.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Przegląda style i komponenty, w których JavaScript przełącza klasy rodzica według stanu dziecka, wartości pól lub obecności treści, i wskazuje miejsca, gdzie selektor CSS :has() może zastąpić skrypt.
Oryginalny opis (EN)
Use when reviewing stylesheets or components that use JavaScript to toggle classes on parent elements based on child state, form input values, or content presence — :has() may replace the JavaScript entirely.
Jak działa
- Quick Reference
- Check
- Fix
- Explain
- Code Review
Podgląd SKILL.md
--- name: has-selector description: "Use when reviewing stylesheets or components that use JavaScript to toggle classes on parent elements based on child state, form input values, or content presence — :has() may replace the JavaScript entirely." metadata: category: css priority: low difficulty: intermediate estimatedTime: "20" source: frontendchecklist.io url: https://frontendchecklist.io/rules/css/has-selector --- # Use :has() to style parent elements based on their descendants Before :has(), styling a parent based on its children required JavaScript: detecting state, toggling classes, and keeping DOM and styles in sync. This created coupling between styling logic and application logic. :has() moves that relationship back into CSS where it belongs, reducing JavaScript complexity, eliminating class-toggling boilerplate, and making styling intent readable in the stylesheet itself. ## Quick Reference - :has() selects an element when a matching descendant exists inside it - It is the parent selector CSS has needed for decades - Baseline support since late 2023 — all major browsers include it - Avoid complex :has() selectors in hot reflow paths — they can affect layout performance ## Check Look for patterns in this code where JavaScript toggles a class on a parent element based on the state or content of a child element. These are candidates for replacement with :has(). ## Fix Replace the JavaScript class-toggling logic with a CSS :has() selector. Show the selector that targets the parent element when the relevant child condition is met. ## Explain Explain how the :has() pseudo-class works, how it differs from :is() and :not(), what descendant vs child combinators mean inside :has(), and how browser support stands today. ## Code Review Review the stylesheets and component JavaScript in this file. Flag any locations where a parent element's style is controlled by toggling a class from JavaScript based on child state — and show the equivalent :has() rule. --- For full implementation details, code examples, and framework-specific guidance, see `references/rule.md`. Rule page: https://frontendchecklist.io/rules/css/has-selector
Pliki w paczce (2)
- SKILL.md 2 KB
- references/rule.md 6 KB
Wersje
W bazie nie ma innych skilli o nazwie has-selector.
Migawka bazy z 13.11.2026 · wersja paczki 5b0e2a8cb380 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100validate-selector
Audytuje dynamiczny selektor Sim od deklaracji przez manifest po granicę bezpieczeństwa i zakres autoryzacji. - 100add-selector
Dodaje lub aktualizuje dynamiczny selektor Sim przez wspólny manifest, dołączenie po stronie serwera i ścieżkę selectors.execute, dla list opcji od dostawców, wewnętrznych lub lokalnych. - 90azure-role-selector
Planuje, wdraża lub przegląda prace nad doborem roli Azure w istniejącym kodzie z kontrolami zgodności, bezpieczeństwa i weryfikacji. - 100js-google
Stosuje styl i dobre praktyki JavaScript z oficjalnego Google JavaScript Style Guide przy pisaniu, przeglądzie i refaktoryzacji kodu, w tym ES6, moduły, JSDoc i nazewnictwo. - 100javascript-linter
Przegląda skrypty, komponenty klienckie, paczki i zachowanie w czasie działania pod kątem lintowania kodu JavaScript, badając kod źródłowy i ścieżkę wykonania w przeglądarce. - 84write-css
Pisze i recenzuje CSS w dowolnym stosie (arkusze, klasy utility, CSS-in-JS, style komponentów) nowoczesnymi technikami, po ustaleniu tokenów, docelowych przeglądarek i konwencji projektu.