Skip to content
TE734 · Type · error

Malformed `:global()` — empty or nested

`:global(…)` exempts one compound from the hermetic scope stamp. An empty wrapper (`:global()`) exempts nothing, and a nested one (`:global(:global(a))`) escapes an escape — both can only be mistakes. In a `<style global>` body `:global()` is not Zolo syntax at all and passes through untouched.

Why this fires

:global(…) is the scoped sheet's escape hatch: the wrapped compound is emitted without the component stamp. Two shapes make no sense and are rejected:

  • Empty:global() { … } wraps nothing; there is no compound to exempt.
  • Nested:global(:global(a)) escapes an escape; the inner wrapper can only be a mistake.
fn Card() -> View {
    <div class="card">
        <style>:global() { margin: 0 }</style>
    </div>
}
// error[TE734]: malformed `:global()` — empty or nested

Fix it

Put exactly one selector (or compound chain) inside the wrapper:

<style>:global(body) { margin: 0 }
:global(.theme-dark) .card { background: black }</style>

If the whole block is global anyway, drop the wrappers and mark the tag instead: <style global>…</style>.

Inside a <style global> body :global(…) is not Zolo syntax at all — it passes through to the browser untouched, so this error only ever fires in scoped sheets.

See also

  • TE735 — selector matches no element of the component.
  • TE736<style> outside a component.

See also

Search Zolo

9 results

en