-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
bugcompilerChanges relating to the compilerChanges relating to the compilergood first issueA small, encapsulated issue, ideal for a new contributor to Svelte to tackle.A small, encapsulated issue, ideal for a new contributor to Svelte to tackle.
Description
Describe the bug
If HTMLElement is used in an event handler, for example:
<button on:click={e => { if (e.target instanceof HTMLElement) { } }}>Click me</button>
It produces the following unexpected warning:
'HTMLElement' is not defined. Consider adding a <script> block with 'export let HTMLElement' to declare a prop (5:49)
If you use Element
in the handler, no warning is produced:
<button on:click={e => { if (e.target instanceof Element) { } }}>Click me</button>
or if you pull the handler into a function within <script>
<script>
function onClick() {
if (e.target instanceof HTMLElement) {
}
}
</script>
<button on:click={onClick}>Click me</button>
Reproduction
Logs
No response
System Info
See REPL
Severity
annoyance
Mlocik97, TheOnlyTails and cybertelx
Metadata
Metadata
Assignees
Labels
bugcompilerChanges relating to the compilerChanges relating to the compilergood first issueA small, encapsulated issue, ideal for a new contributor to Svelte to tackle.A small, encapsulated issue, ideal for a new contributor to Svelte to tackle.