You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Select the input, hit 'enter', check the console</p><inputon:enter='this.blur()'><script>exportdefault{events: {enter(node,callback){functionhandleKeydown(event){if(event.which===13)callback();}node.addEventListener('keydown',handleKeydown);return{destroy(){node.removeEventListener('keydown',handleKeydown);}};}}};</script>
I'd expect this.blur() to refer to the <input>, but this code is generated:
No, because at the moment this is undefined, so you can't use it anyway. It's really just a bugfix
the only this that's affected is the handler itself — this.blur() becomes input.blur(). The enter function is still called with the component as context
Actions receive the node as an argument and have the component as this (same as event handlers) — I think that should stay the way it is
In this situation (REPL)...
I'd expect
this.blur()
to refer to the<input>
, but this code is generated:this
should probably be rewritten asinput
.Workaround is this:
The text was updated successfully, but these errors were encountered: