Hi,
I was recently trying to hook up key up and down event handlers for the document object. I really wanted to use webix.event(), but unfortunately, that doesn’t look to be possible. I was trying this:
webix.event(document, “onkeydown”, keyDownHandler);
webix.event(document, “onkeyup”, keyDownHandler);
It looks like that first argument MUST be an ID, which means this won’t work, based on looking at the event() code.
I think a really nice change in event() would be to do:
if (typeof node === “string”) {
node = webix.toNode(node);
}
That way, if the caller passes in a reference to a DOM node then you skip the lookup and attach the event, otherwise do the lookup and then the same assert logic as is done now. That would be really helpful I think (and really, I think anywhere in Webix where a DOM node is expected it should always accept a reference before doing any lookup logic).
Thanks,
Frank