The event utility provides functions to add and remove event listeners, event cleansing. It also tries to automatically remove listeners it registers during the unload event.
This module provides the following classes:
This module is a rollup of the following modules:
node.on("hover", overFn, outFn);
node.delegate("hover", overFn, outFn, ".filterSelector");
Y.on("hover", overFn, outFn, ".targetSelector");
Y.delegate("hover", overFn, outFn, "#container", ".filterSelector");
Additionally, for compatibility with a more typical subscription signature, the following are also supported:
Y.on("hover", overFn, ".targetSelector", outFn);
Y.delegate("hover", overFn, "#container", outFn, ".filterSelector");
Adds subscription and delegation support for mouseenter and mouseleave events. Unlike mouseover and mouseout, these events aren't fired from child elements of a subscribed node.
This avoids receiving three mouseover notifications from a setup like
div#container > p > a[href]
where
Y.one('#container').on('mouseover', callback)
When the mouse moves over the link, one mouseover event is fired from #container, then when the mouse moves over the p, another mouseover event is fired and bubbles to #container, causing a second notification, and finally when the mouse moves over the link, a third mouseover event is fired and bubbles to #container for a third notification.
By contrast, using mouseenter instead of mouseover, the callback would be executed only once when the mouse moves over #container.
Y.Event.defineOutside(eventType);
.
By default, the created synthetic event name will be the name of the event
with "outside" appended (e.g. "click" becomes "clickoutside"). If you want
a different name for the created Event, pass it as a second argument like so:
Y.Event.defineOutside(eventType, "yonderclick")
.
This module was contributed by Brett Stimmerman, promoted from his
gallery-outside-events module at
http://yuilibrary.com/gallery/show/outside-events