I’m using Dojo’s behavior functionality to add events. I’m checking a text field to see what’s being entered. As far I understand, the documentation suggests me to use onkeypress over onkeydown.
Part of object
'#myTextField' : {
onkeypress: function(event)
{
console.log(event.charCode);
}
}
It works fine, but in both (latest) Chrome and Firefox I get warning messages in the console.
Chrome says event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
Firefox says that getAttributeNodeNS()is deprecated.
I haven’t tried any other browsers.
Is there a better(newer) way to do it, or what is this about?
It is not
keypress/keydownevents that are deprecated.Apparently dojo tries to copy some of event properties (
layerX,layerY) that has been deprecated.There is nothing wrong with dojo, but these messages are quite annoying, so I hope they will fix them soon.
You can read more details here http://bugs.dojotoolkit.org/ticket/14114
Until this is fixed you can you set event callback function in HTML element, if you’re not picky of your javascript locations. This will not trigger warning messages.