event-custom-complex-debug.js revision fbe8205228375d3a502c60cdf5b080b32d85b227
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Adds event facades, preventable default behavior, and bubbling.
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @module event-custom
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @submodule event-custom-complex
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney(function() {
752e31b910dbf30e2b803437da522585eca28528Matt Sweeneyvar FACADE, FACADE_KEYS, CEProto = Y.CustomEvent.prototype,
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Wraps and protects a custom event for use when emitFacade is set to true.
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Requires the event-custom-complex module
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @class EventFacade
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith * @param e {Event} the custom event
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @param currentTarget {HTMLElement} the element the listener was attached to
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney e = e || {};
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * The arguments passed to fire
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @property details
10d8bafc5c24f3a4285cf6060a1935ba5cfc4b85Luke Smith * @type Array
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * The event type, this can be overridden by the fire() payload
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @property type
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @type string
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * The real event type
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @property type
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @type string
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney //////////////////////////////////////////////////////
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Node reference for the targeted eventtarget
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @propery target
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @type Node
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Node reference for the element that the listener was attached to.
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @propery currentTarget
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @type Node
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Node reference to the relatedTarget
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @propery relatedTarget
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @type Node
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Stops the propagation to the next bubble target
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @method stopPropagation
b0614bd702ed299874c87fd5d4d48bccda498c73Matt Sweeney this.stopPropagation = function() {
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Stops the propagation to the next bubble target and
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * prevents any additional listeners from being exectued
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * on the current target.
31acd99497fcc9fc72f15c5553fe356d64fb9d03Matt Sweeney * @method stopImmediatePropagation
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney this.stopImmediatePropagation = function() {
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Prevents the event's default behavior
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @method preventDefault
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney this.preventDefault = function() {
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * Stops the event propagation and prevents the default
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * event behavior.
752e31b910dbf30e2b803437da522585eca28528Matt Sweeney * @method halt
if (es) {
next: this,
queue: []
fireOnce: true,
if (this.preventedFn) {
if (this.stoppedFn) {
return this.stopped ? false : true;
if (!ef) {
o2 = {};
return this._facade;
if (this.preventable) {
if (immediate) {
this.stopImmediatePropagation();
this.stopPropagation();
this.preventDefault();
for (i in targs) {
t = targs[i];
if (!ce) {
return ret;