igrimpe Posted October 18, 2024 Posted October 18, 2024 I have an event handler: function evthandler(event) { if (event.name === 'input' && (typeof (event.delta) !== 'undefined')) { console.log('event: ' + JSON.stringify(event)); console.log('event.delta: ' + JSON.stringify(event.delta)); let b = event.delta.state; console.log(b); } } When the event fires, the console.log statements are done, but the script breaks with an unnamed error (see image). NOW ... when I change the code a bit: function evthandler(event) { if (event.name === 'input' && (typeof (event.delta) !== 'undefined')) { console.log('event: ' + JSON.stringify(event)); console.log('event.delta: ' + JSON.stringify(event.delta)); let d = event.delta; let b = d.state; console.log(b); } } This code does NOT break! If I try something like: let a = JSON.parse('{ "foo" : "bar", "baz" : { "k" : 42 }}'); console.log(a.baz.k); Then this code also works without problem. So could anybody please explain what is so "special" about the event object and where this behavior is documented? Quote Translate Revert translation? English (American) French German Italian Polish Portuguese (European) Spanish
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.