Saltar al contenido
TE735 · Tipos · warning

El selector con ámbito no coincide con ningún elemento del componente

Advertencia, nunca un fallo de build. El ámbito hermético sella cada compound con la clase del componente, así que un selector que nombra una clase/id/etiqueta que el markup del propio componente nunca produce es una regla muerta — y `:root` bajo ámbito está estructuralmente muerto. Incluye un "¿quisiste decir?" (distancia de edición ≤ 2) y el conjunto renderizado del componente. Valores dinámicos de class/id o llamadas `el`/`raw` abren el conjunto y suprimen la advertencia — nunca adivina.

Why this fires

This is a warning, not a hard error — it never fails the build. Hermetic scoping creates the "dead rule" category: every compound of a scoped selector is stamped with the component's class, so a selector that names a class, id, or tag the component's own markup never produces can match nothing — silently. The compiler parses the selector and the markup together, so it can tell you at the typo, with a suggestion when a close name exists (edit distance ≤ 2):

fn TodoCard() -> View {
    <div class="card done">
        <span class="title">t</span>
        <style>.tittle { font-weight: 600 }</style>
    </div>
}
// warning[TE735]: selector `.tittle` matches no element of this component
//   help: did you mean `.title`? this component renders: .card, .done, .title

:root under scope is structurally impossible — it becomes :root.zc-<hash>, and the document root never carries a component stamp — so it warns even when everything else is dynamic:

<style>:root { color-scheme: dark }</style>
// warning[TE735]: selector `:root` matches no element of this component
//   help: a scoped sheet can never target the document root; use `<style global>` or `:global(:root)`

When it stays silent

This warning never guesses. Any dynamic producer opens the matching set and suppresses it: a non-literal class={expr} (for classes), a non-literal id= (for ids), any el(...)/raw(...) call (for everything). Compounds inside :global(…), compounds containing &, and keyframe selectors (from/50%) are exempt, exactly like the scope transform itself exempts them.

Fix it

Rename the selector to the real class, or — if the rule is intentionally app-wide — move it to a <style global> block or wrap it in :global(…).

See also

  • TE734 — malformed :global().
  • TE738 — unknown CSS property.

Véase también

Buscar en Zolo

9 resultados

en