Skip to content

Warning about using refs in event binding #686

@antony

Description

@antony

It is useful to call methods on nested components by making use of refs in event bindings. Whilst this is possible, and works well, Svelte issues a warning when compiling. I would expect Svelte to either not issue a warning, or to not work - right now it does both.

The error is:

'refs.nested.toggleEggs' is an invalid callee (should be one of this.*, event.*, set, fire or destroy)

The ideal resolution for me is to add 'refs.*' as an allowed callee.

Svelte REPL example - open the console to see the warning:

https://svelte.technology/repl?version=1.23.4&gist=b8cd68ce59240062798c647474e1782a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions