It doesn’t currently seem as though there is a way to do live events in YUI similar to jQuery: http://api.jquery.com/live/
It sure would be nice if something like:
function handleClick(e) {
// click!
}
YUI().use('node-base', function(Y) {
Y.on("click", handleClick, ".foo");
});
caused handleClick to be fired when a node with the “foo” class was clicked on after being dynamically added to the DOM and sometime after the Y.on was evaluated. I feel like live events are one of jQuery’s killer features that YUI lacks.
You can use YUI3’s support for event delegation to accomplish the same thing.
I think attaching that to the window is ok, you might need to attach it to the body instead.
Use
Y.one("body")instead ofY.config.winin that case.