Skip to content

Compiler warnings on trying to set styles and classes on <svelte:body /> #7929

Open
@janosh

Description

@janosh

Describe the problem

For the time being while features like changing <body> class (#3105) and styles

<svelte:body style="max-width: 50em; margin: auto;" />

are not supported, would be nice if the Svelte compiler showed a warning when people try to do this.

Describe the proposed solution

Red squiggly lines below and a tooltip saying

The svelte:body element only allows listening for events that fire on document.body. It does not support modifying document.body.

on hovering lines like:

<svelte:body style="max-width: 50em; margin: auto;" />

<svelte:body class:foo={is_bar} />

Alternatives considered

Current state of no compiler warning requires people to search GitHub.

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions