event-custom-debug.js revision 508ea3dac5e30f55a73a5cc47876c43d7dddf54e
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Custom event engine, DOM event listener abstraction layer, synthetic DOM
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @module event-custom
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Custom event engine, DOM event listener abstraction layer, synthetic DOM
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @module event-custom
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @submodule event-custom-base
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Allows for the insertion of methods that are executed before or after
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * a specified method
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Cache of objects touched by the utility
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @property objs
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <p>Execute the supplied method before the specified function. Wrapping
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * function may optionally return an instance of the following classes to
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * further alter runtime behavior:</p>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dd>Immediatly stop execution and return
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <code>returnValue</code>. No other wrapping functions will be
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * executed.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dd>Replace the arguments that the original function will be
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * called with.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt></code>Y.Do.Prevent(message)</code></dt>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dd>Don't execute the wrapped function. Other before phase
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * wrappers will be executed.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method before
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param fn {Function} the function to execute
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param obj the object hosting the method to displace
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param sFn {string} the name of the method to displace
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param c The execution context for fn
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param arg* {mixed} 0..n additional arguments to supply to the subscriber
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * when the event fires.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @return {string} handle for the subscription
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // Y.log('Do before: ' + sFn, 'info', 'event');
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass var f = fn, a;
753ef90e92d428310b4a07006e8850639c6faaadRyan Grove * <p>Execute the supplied method after the specified function. Wrapping
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * function may optionally return an instance of the following classes to
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * further alter runtime behavior:</p>
753ef90e92d428310b4a07006e8850639c6faaadRyan Grove * <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dd>Immediatly stop execution and return
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <code>returnValue</code>. No other wrapping functions will be
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * executed.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <dd>Return <code>returnValue</code> instead of the wrapped
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * method's original return value. This can be further altered by
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * other after phase wrappers.</dd>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <p>The static properties <code>Y.Do.originalRetVal</code> and
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <code>Y.Do.currentRetVal</code> will be populated for reference.</p>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method after
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param fn {Function} the function to execute
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param obj the object hosting the method to displace
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param sFn {string} the name of the method to displace
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param c The execution context for fn
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param arg* {mixed} 0..n additional arguments to supply to the subscriber
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @return {string} handle for the subscription
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass var f = fn, a;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Execute the supplied method before or after the specified function.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Used by <code>before</code> and <code>after</code>.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method _inject
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param when {string} before or after
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param fn {Function} the function to execute
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param obj the object hosting the method to displace
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param sFn {string} the name of the method to displace
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param c The execution context for fn
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @return {string} handle for the subscription
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // object id
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // create a map entry for the obj if it doesn't exist
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (! o[sFn]) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // create a map entry for the method if it doesn't exist
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // re-route the method to our wrapper
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass function() {
753ef90e92d428310b4a07006e8850639c6faaadRyan Grove // subscriber id
753ef90e92d428310b4a07006e8850639c6faaadRyan Grove // register the callback
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Detach a before or after subscription.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method detach
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param handle {string} the subscription handle
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass//////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Contains the return value from the wrapped method, accessible
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * by 'after' event listeners.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @property Do.originalRetVal
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @since 3.2.0
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Contains the current state of the return value, consumable by
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * 'after' event listeners, and updated if an after subscriber
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * changes the return value generated by the wrapped function.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @property Do.currentRetVal
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @since 3.2.0
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass//////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Wrapper for a displaced method with aop enabled
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class Do.Method
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @constructor
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param obj The object to operate on
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param sFn The name of the method to displace
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Register a aop subscriber
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method register
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param sid {string} the subscriber id
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param fn {Function} the function to execute
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param when {string} when to execute the function
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav GlassDO.Method.prototype.register = function (sid, fn, when) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Unregister a aop subscriber
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method delete
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param sid {string} the subscriber id
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param fn {Function} the function to execute
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param when {string} when to execute the function
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // Y.log('Y.Do._delete: ' + sid, 'info', 'Event');
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <p>Execute the wrapped method. All arguments are passed into the wrapping
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * functions. If any of the before wrappers return an instance of
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * function nor any after phase subscribers will be executed.</p>
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <p>The return value will be the return value of the wrapped function or one
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * <code>Y.Do.AlterReturn</code>.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method exec
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param arg* {any} Arguments are passed to the wrapping and wrapped functions
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @return {any} Return value of wrapped function unless overwritten (see above)
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // execute before
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass for (i in bf) {
753ef90e92d428310b4a07006e8850639c6faaadRyan Grove // execute method
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // execute after methods.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass for (i in af) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // Stop processing if a Halt object is returned
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // Check for a new return value
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass } else if (newRet && newRet.constructor == DO.AlterReturn) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // Update the static retval state
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass//////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Return an AlterArgs object when you want to change the arguments that
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * were passed into the function. Useful for Do.before subscribers. An
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * example would be a service that scrubs out illegal characters prior to
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * executing the core business logic.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class Do.AlterArgs
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @constructor
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param msg {String} (optional) Explanation of the altered return value
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param newArgs {Array} Call parameters to be used for the original method
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * instead of the arguments originally passed in.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Return an AlterReturn object when you want to change the result returned
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * from the core method to the caller. Useful for Do.after subscribers.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class Do.AlterReturn
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @constructor
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param msg {String} (optional) Explanation of the altered return value
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param newRetVal {any} Return value passed to code that invoked the wrapped
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Return a Halt object when you want to terminate the execution
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * of all subsequent subscribers as well as the wrapped method
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * if it has not exectued yet. Useful for Do.before subscribers.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class Do.Halt
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @constructor
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param msg {String} (optional) Explanation of why the termination was done
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param retVal {any} Return value passed to code that invoked the wrapped
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Return a Prevent object when you want to prevent the wrapped function
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * from executing, but want the remaining listeners to execute. Useful
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * for Do.before subscribers.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class Do.Prevent
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @constructor
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param msg {String} (optional) Explanation of why the termination was done
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Return an Error object when you want to terminate the execution
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * of all subsequent method calls.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class Do.Error
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @constructor
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param msg {String} (optional) Explanation of the altered return value
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param retVal {any} Return value passed to code that invoked the wrapped
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @deprecated use Y.Do.Halt or Y.Do.Prevent
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass//////////////////////////////////////////////////////////////////////////
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass// Y["Event"] && Y.Event.addListener(window, "unload", Y.Do._unload, Y.Do);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Custom event engine, DOM event listener abstraction layer, synthetic DOM
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @module event-custom
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @submodule event-custom-base
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass// var onsubscribeType = "_event:onsub",
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'broadcast',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'monitored',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'contextFn',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'currentTarget',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'defaultFn',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'defaultTargetOnly',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'emitFacade',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'preventable',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'preventedFn',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass 'stoppedFn',
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Return value from all subscribe operations
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @class EventHandle
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @constructor
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param {CustomEvent} evt the custom event.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @param {Subscriber} sub the subscriber.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * The custom event
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @type CustomEvent
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * The subscriber object
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @type Subscriber
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass batch: function(f, c) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass f.call(c || this, this);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * Detaches this subscriber
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @method detach
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass * @return {int} the number of detached listeners
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass detach: function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event');
return detached;
this.context = Y;
this.subscribers = {};
this.afters = {};
this.preventable = true;
this.bubbles = true;
this.applyConfig(o, true);
if (sib) {
if (when) {
this.monitored = true;
getSubs: function() {
if (sib) {
if (!fn) {
if (this.async) {
this.afterCount++;
this.subCount++;
return new Y.EventHandle(this, s);
if (this.host) {
for (i in subs) {
s = subs[i];
this._delete(s);
found++;
return found;
unsubscribe: function() {
var ret;
if (!this.silent) {
fire: function() {
this.fired = true;
if (this.emitFacade) {
if (this.hasSubs()) {
return this.stopped ? false : true;
for (i in subs) {
s = subs[i];
if (s && s.fn) {
var a = Y.Array(args);
if (this.host !== Y) {
unsubscribeAll: function() {
detachAll: function() {
return this.detach();
_delete: function(s) {
this.subCount--;
this.afterCount--;
if (this.host) {
ce: this,
sub: s
s.deleted = true;
if (this.postponed) {
delete this.fn;
delete this.context;
delete this.postponed;
if (a || args) {
if (this.once) {
return ret;
var c = this.context,
ret = true;
return ret;
if (context) {
var L = Y.Lang,
YArray = Y.Array,
return type;
if (!L.isString(t)) {
after = true;
events: {},
targets: {},
config: o,
bubbling: false,
defaults: {
host: this,
once: function() {
return handle;
* @param {string} [pre=this._yuievt.config.prefix] the prefix
f = fn;
c = context;
ret = [];
isArr = true;
if (L.isObject(v)) {
c = v.context || c;
if (Node) {
if (domevent) {
if (adapt) {
if (!handle) {
handle = ce._on(fn, context, (arguments.length > 3) ? YArray(arguments, 3, true) : null, (after) ? 'after' : true);
if (detachcategory) {
subscribe: function() {
if (!type && (this !== Y)) {
for (i in evts) {
if (isNode) {
ce,
if (handles) {
if (detachcategory) {
if (cat) {
if (type) {
for (i in cat) {
if (ce) {
unsubscribe: function() {
unsubscribeAll: function() {
* 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
* 'defaultFn': the default function to execute when this event fires if preventDefault was not called
ret = {};
return ret;
if (ce) {
if (opts) {
if (!ce) {
ret = true;
var ce2;
if (ce2) {
return ce2;
var pre, e;
if (!prefixed) {
return e[type] || null;
before: function() {
bubbles: false
* Example <code>Y.on(function(arg1, arg2, etc) { // obj.methodname was executed }, obj 'methodname');</code>
var FACADE,
EMPTY = {},
e = e || EMPTY;
this._event = e;
stopPropagation: function() {
stopImmediatePropagation: function() {
preventDefault: function() {
bubbling: null,
queue: []
fireOnce: true,
next();
s.postponed = true;
return ret;
if (!ef) {
o2 = {};
return this._facade;
if (this.stack) {
if (this.stack) {
if (this.preventable) {
if (this.stack) {
if (immediate) {
this.stopImmediatePropagation();
this.stopPropagation();
this.preventDefault();
for (i in targs) {
t = targs[i];
if (!ce) {
return ret;