event-debug.js revision 1aaea0dfa7ac4cfd069af68144b0d2314953cf17
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp GLOBAL_ENV.remove(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // if (!YUI.UA.ie) {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp GLOBAL_ENV.add(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
a89ad754cce3cfc8aee71760e10217b54020360dTripp * DOM event listener abstraction layer
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @module event
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @submodule event-base
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * The domready event fires at the moment the browser's DOM is
a89ad754cce3cfc8aee71760e10217b54020360dTripp * usable. In most cases, this is before images are fully
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * downloaded, allowing you to provide a more responsive user
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * interface.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * In YUI 3, domready subscribers will be notified immediately if
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * that moment has already passed when the subscription is created.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * One exception is if the yui.js file is dynamically injected into
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * the page. If this is done, you must tell the YUI instance that
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * you did this in order for DOMReady (and window load events) to
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * fire normally. That configuration option is 'injected' -- set
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * it to true if the yui.js script is not included inline.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * This method is part of the 'event-ready' module, which is a
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * submodule of 'event'.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @event domready
a89ad754cce3cfc8aee71760e10217b54020360dTripp Y.Do.before(function() { Y.fire('domready'); }, YUI.Env, '_ready');
a89ad754cce3cfc8aee71760e10217b54020360dTripp * Custom event engine, DOM event listener abstraction layer, synthetic DOM
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @module event
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @submodule event-base
a89ad754cce3cfc8aee71760e10217b54020360dTripp * Wraps a DOM event, properties requiring browser abstraction are
a89ad754cce3cfc8aee71760e10217b54020360dTripp * fixed here. Provids a security layer when required.
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @class DOMEventFacade
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @param ev {Event} the DOM event
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @param currentTarget {HTMLElement} the element the listener was attached to
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @param wrapper {Event.Custom} the custom event wrapper for this DOM event
a89ad754cce3cfc8aee71760e10217b54020360dTripp * webkit key remapping required for Safari < 3.1
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @property webkitKeymap
a89ad754cce3cfc8aee71760e10217b54020360dTripp 25: 9, // SHIFT-TAB (Safari provides a different key code in
a89ad754cce3cfc8aee71760e10217b54020360dTripp // this case, even though the shiftKey modifier is set)
a89ad754cce3cfc8aee71760e10217b54020360dTripp * Returns a wrapped node. Intended to be used on event targets,
a89ad754cce3cfc8aee71760e10217b54020360dTripp * so it will return the node's parent if the target is a text
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * If accessing a property of the node throws an error, this is
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * probably the anonymous div wrapper Gecko adds inside text
c093c1aed867e18aa4778708592e1ceb45d18cffTripp * nodes. This likely will only occur when attempting to access
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * the relatedTarget. In this case, we now return null because
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * the anonymous div is completely useless and we do not know
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * what the related target was because we can't even get to
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * the element's parent node.
527cf651dc5df871799abd06cf589bca3f3a665fTripp * @method resolve
527cf651dc5df871799abd06cf589bca3f3a665fTripp resolve = function(n) {
c093c1aed867e18aa4778708592e1ceb45d18cffTripp } catch(e) {
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp return null;
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp return Y.one(n);
527cf651dc5df871799abd06cf589bca3f3a665fTripp DOMEventFacade = function(ev, currentTarget, wrapper) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // if not lazy init
c093c1aed867e18aa4778708592e1ceb45d18cffTripp init: function() {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var e = this._event,
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // this.button = e.button;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp if (e.type == "mousewheel" || e.type == "DOMMouseScroll") {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp this.wheelDelta = (e.detail) ? (e.detail * -1) : Math.round(e.wheelDelta / 80) || ((e.wheelDelta < 0) ? -1 : 1);
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp if (this._touch) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp stopPropagation: function() {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var e = this._event;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var e = this._event;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * The native event
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property _event
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * The X location of the event on the page (including scroll)
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * @property pageX
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * @type int
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * The Y location of the event on the page (including scroll)
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * @property pageY
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * @type int
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * The keyCode for key events. Uses charCode if keyCode is not available
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * @property keyCode
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * @type int
a89ad754cce3cfc8aee71760e10217b54020360dTripp * The charCode for key events. Same as keyCode
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @property charCode
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @type int
cec703a844d9691646231634fe709f4ea41d278aTripp * The button that was pushed.
cec703a844d9691646231634fe709f4ea41d278aTripp * @property button
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @type int
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * The button that was pushed. Same as button.
cec703a844d9691646231634fe709f4ea41d278aTripp * @property which
cec703a844d9691646231634fe709f4ea41d278aTripp * @type int
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Node reference for the targeted element
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @propery target
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @type Node
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Node reference for the element that the listener was attached to.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @propery currentTarget
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @type Node
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Node reference to the relatedTarget
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @propery relatedTarget
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @type Node
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Number representing the direction and velocity of the movement of the mousewheel.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Negative is down, the higher the number, the faster. Applies to the mousewheel event.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @property wheelDelta
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @type int
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Stops the propagation to the next bubble target
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @method stopPropagation
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Stops the propagation to the next bubble target and
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * prevents any additional listeners from being exectued
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * on the current target.
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @method stopImmediatePropagation
a89ad754cce3cfc8aee71760e10217b54020360dTripp * Prevents the event's default behavior
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @method preventDefault
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @param returnValue {string} sets the returnValue of the event to this value
a89ad754cce3cfc8aee71760e10217b54020360dTripp * (rather than the default false value). This can be used to add a customized
a89ad754cce3cfc8aee71760e10217b54020360dTripp * confirmation query to the beforeunload event).
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Stops the event propagation and prevents the default
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * event behavior.
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @method halt
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @param immediate {boolean} if true additional listeners
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * on the current target will not be executed
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp(function() {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * DOM event listener abstraction layer
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @module event
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @submodule event-base
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * The event utility provides functions to add and remove event listeners,
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * event cleansing. It also tries to automatically remove listeners it
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * registers during the unload event.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @class Event
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp onLoad = function() {
117557654069e56f5003be755819b76fe0f77107Tripp onUnload = function() {
117557654069e56f5003be755819b76fe0f77107Tripp shouldIterate = function(o) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp return (o && typeof o !== "string" && Y.Lang.isNumber(o.length) &&
117557654069e56f5003be755819b76fe0f77107Tripp } catch(ex) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp return false;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // aliases to support DOM event subscription clean up when the last
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp // subscriber is detached. deleteAndClean overrides the DOM event's wrapper
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // CustomEvent _delete method.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _deleteAndClean = function(s) {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippEvent = function() {
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * True after the onload event has fired
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @property _loadComplete
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @type boolean
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * The number of times to poll after window.onload. This number is
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * increased if additional late-bound handlers are requested after
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * the page load.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property _retryCount
a89ad754cce3cfc8aee71760e10217b54020360dTripp * onAvailable listeners
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @property _avail
a89ad754cce3cfc8aee71760e10217b54020360dTripp * Custom event wrappers for DOM events. Key is
a89ad754cce3cfc8aee71760e10217b54020360dTripp * 'event:' + Element uid stamp + event type
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @property _wrappers
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @type Y.Event.Custom
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Custom event wrapper map DOM events. Key is
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Element uid stamp. Each item is a hash of custom event
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * wrappers as provided in the _wrappers collection. This
a89ad754cce3cfc8aee71760e10217b54020360dTripp * provides the infrastructure for getListeners.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @property _el_events
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * The number of times we should look for elements that are not
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * in the DOM at the time the event is requested after the document
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * has been loaded. The default is 1000@amp;40 ms, so it will poll
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * for 40 seconds or until all outstanding handlers are bound
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * (whichever comes first).
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property POLL_RETRYS
117557654069e56f5003be755819b76fe0f77107Tripp * @type int
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * The poll interval in milliseconds
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property POLL_INTERVAL
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @type int
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * addListener/removeListener can throw errors in unexpected scenarios.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * These errors are suppressed, the method returns false, and this property
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property lastError
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @type Error
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * poll handle
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property _interval
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * document readystate poll handle
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property _dri
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * True when the document is initially usable
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @property DOMReady
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @type boolean
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @method startInterval
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp startInterval: function() {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTrippEvent._interval = setInterval(Event._poll, Event.POLL_INTERVAL);
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * Executes the supplied callback when the item with the supplied
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * id is found. This is meant to be used to execute behavior as
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * soon as possible as the page loads. If you use this after the
cec703a844d9691646231634fe709f4ea41d278aTripp * initial page load it will poll for a fixed time for the element.
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * The number of times it will poll and the frequency are
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * configurable. By default it will poll for 10 seconds.
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * <p>The callback is executed with a single parameter:
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * the custom object parameter, if provided.</p>
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * @method onAvailable
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * @param {string||string[]} id the id of the element, or an array
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * of ids to look for.
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * @param {function} fn what to execute when the element is found.
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * @param {object} p_obj an optional object to be passed back as
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * a parameter to fn.
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * @param {boolean|object} p_override If set to true, fn will execute
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * in the context of p_obj, if set to an object it
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * will execute in the context of that object
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @param checkContent {boolean} check child node readiness (onContentReady)
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @deprecated Use Y.on("available")
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // @TODO fix arguments
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp onAvailable: function(id, fn, p_obj, p_override, checkContent, compat) {
bbd1285cbb2183b7f89010412ad97ae1680b4b5eTripp // Y.log('onAvailable registered for: ' + id);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // We want the first test to be immediate, but async
9eaaa502227248d304ac9170902697d02158c1d9Tripp _delete: function() {
9eaaa502227248d304ac9170902697d02158c1d9Tripp // set by the event system for lazy DOM listeners
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // otherwise try to remove the onAvailable listener(s)
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Works the same way as onAvailable, but additionally checks the
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * state of sibling elements to determine if the content of the
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * available element is safe to modify.
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * <p>The callback is executed with a single parameter:
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * the custom object parameter, if provided.</p>
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @method onContentReady
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @param {string} id the id of the element to look for.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @param {function} fn what to execute when the element is ready.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @param {object} obj an optional object to be passed back as
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * a parameter to fn.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @param {boolean|object} override If set to true, fn will execute
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * in the context of p_obj. If an object, fn will
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * exectute in the context of that object
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @deprecated Use Y.on("contentready")
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // @TODO fix arguments
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp onContentReady: function(id, fn, obj, override, compat) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp return Event.onAvailable(id, fn, obj, override, true, compat);
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Adds an event listener
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @method attach
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param {String} type The type of event to append
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param {Function} fn The method the event invokes
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param {String|HTMLElement|Array|NodeList} el An id, an element
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * reference, or a collection of ids and/or elements to assign the
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * listener to.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param {Object} context optional context object
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @param {Boolean|object} args 0..n arguments to pass to the callback
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @return {EventHandle} an object to that can be used to detach the listener
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp _createWrapper: function (el, type, capture, compat, facade) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp if (false === facade) {
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp // create CE wrapper
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp contextFn: function() {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp cewrapper.nodeRef = cewrapper.nodeRef || Y.one(cewrapper.el);
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // for later removeListener calls
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp cewrapper.fire(Event.getEvent(e, el, (compat || (false === facade))));
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // window load happens once
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // trimmedArgs.pop();
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp// throw new TypeError(type + " attach call failed, callback undefined");
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTrippY.log(type + " attach call failed, invalid callback", "error", "event");
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return false;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // The el argument can be an array of elements or element ids.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // return (handles.length === 1) ? handles[0] : handles;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // If the el argument is a string, we assume it is
0fdefaa9ca017edfb76b736c825b34186f33045aTripp // actually the id of the element. If the page is loaded
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // we convert el to the actual element, otherwise we
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // defer attaching the event until the element is
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // oEl = (compat) ? Y.DOM.byId(el) : Y.Selector.query(el);
a89ad754cce3cfc8aee71760e10217b54020360dTripp // Not found = defer adding the event until the element is available
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // Y.log(el + ' not found');
return ret;
if (!el) {
if (overrides) {
fireNow = true;
if (compat) {
if (fireNow) {
return ret;
compat = true;
if (compat) {
el = null;
if (!el) {
ok = true;
return ok;
if (ce) {
_load: function(e) {
if (!_loadComplete) {
_loadComplete = true;
if (Y.fire) {
_poll: function() {
if (!tryAgain) {
notAvail = [];
if (ov === true) {
if (el) {
_avail[i] = null;
if (el) {
_avail[i] = null;
if (tryAgain) {
for (; i < len; ++i) {
if (child) {
if (lis) {
if (!evts) {
if (key) {
_unload: function(e) {
v.fire(e);
v.detachAll();
delete _wrappers[k];
onLoad();
// Process onAvailable/onContentReady items when when the DOM is ready in IE
var toArray = Y.Array,
handles = [];
for (i in type) {
if (!handle) {
}, el);
return handle;
if (this.args) {
if (currentTarget) {
return ret;
return function (target, e) {
match = [],
isContainer = false;
while (target) {
if (isContainer) {
while (target) {
return match;
toArray = Y.Array,
noop = function () {};
event = e || {};
if (this.emitFacade) {
if (!e || !e.preventDefault) {
if (delegate) {
function SyntheticEvent() {
capture : false,
notifiers : [],
detachAll : function () {
this.subscribers = {};
prototype: {
_init: function () {
var handles = [],
}, selector);
return handle;
if (node) {
if (delegate) {
if (extra) {
eventDef : this,
return handle;
if (notifiers) {
if (node) {
if (handles) {
handles = [],
if (notifiers) {
if (!filter) {
if (first) {
return handle;
if (config) {
Impl = function () {
on: function () {
delegate: function () {
detach: function () {
return synth;
on: function() {
detach: function() {
var config = {
passed = true;
failed = true;
if (passed) {
}, id);
}, el]);
{ capture: true });
if (!notifiers) {
notifiers = {};
if (defer) {
if (!defer) {
this._notify(e);
nots = [],
if (notifiers) {
if (useActivate) {
var detachHandle,
handler = function(e) {
if (timerHandle) {
if (!detachHandle) {
noop = function () {},
conf = {
mouseenter: function (e) {
mouseleave: function (e) {
}, filter);