lib/kissy/5.0.0-alpha.3/lib/build/event/custom.js
function (eventData) {
            eventData = eventData || {};
            var self = this, bubbles = self.bubbles, currentTarget = self.currentTarget, parents, parentsLen, type = self.type, defaultFn = self.defaultFn, i, customEventObject = eventData, gRet, ret;
            eventData.type = type;
            if (!customEventObject.isEventObject) {
                customEventObject = new CustomEventObject(customEventObject);
            }
            customEventObject.target = customEventObject.target || currentTarget;
            customEventObject.currentTarget = currentTarget;
            ret = self.notify(customEventObject);
            if (gRet !== false && ret !== undefined) {
                gRet = ret;
            }    // gRet === false prevent
            // gRet === false prevent
            if (bubbles && !customEventObject.isPropagationStopped()) {
                parents = currentTarget.getTargets();
                parentsLen = parents && parents.length || 0;
                for (i = 0; i < parentsLen && !customEventObject.isPropagationStopped(); i++) {
                    ret = parents[i].fire(type, customEventObject);    // false 优先返回
                    // false 优先返回
                    if (gRet !== false && ret !== undefined) {
                        gRet = ret;
                    }
                }
            }    // bubble first
                 // parent defaultFn first
                 // child defaultFn last
            // bubble first
            // parent defaultFn first
            // child defaultFn last
            if (defaultFn && !customEventObject.isDefaultPrevented()) {
                var target = customEventObject.target, lowestCustomEventObservable = target.getCustomEventObservable(customEventObject.type);
                if (!self.defaultTargetOnly && // defaults to false
                    (!lowestCustomEventObservable || !lowestCustomEventObservable.defaultTargetOnly) || currentTarget === target) {
                    // default value as final value if possible
                    gRet = defaultFn.call(currentTarget, customEventObject);
                }
            }
            return gRet;
        }
function (eventData) {
            eventData = eventData || {};
            var self = this, bubbles = self.bubbles, currentTarget = self.currentTarget, parents, parentsLen, type = self.type, defaultFn = self.defaultFn, i, customEventObject = eventData, gRet, ret;
            eventData.type = type;
            if (!customEventObject.isEventObject) {
                customEventObject = new CustomEventObject(customEventObject);
            }
            customEventObject.target = customEventObject.target || currentTarget;
            customEventObject.currentTarget = currentTarget;
            ret = self.notify(customEventObject);
            if (gRet !== false && ret !== undefined) {
                gRet = ret;
            }    // gRet === false prevent
            // gRet === false prevent
            if (bubbles && !customEventObject.isPropagationStopped()) {
                parents = currentTarget.getTargets();
                parentsLen = parents && parents.length || 0;
                for (i = 0; i < parentsLen && !customEventObject.isPropagationStopped(); i++) {
                    ret = parents[i].fire(type, customEventObject);    // false 优先返回
                    // false 优先返回
                    if (gRet !== false && ret !== undefined) {
                        gRet = ret;
                    }
                }
            }    // bubble first
                 // parent defaultFn first
                 // child defaultFn last
            // bubble first
            // parent defaultFn first
            // child defaultFn last
            if (defaultFn && !customEventObject.isDefaultPrevented()) {
                var target = customEventObject.target, lowestCustomEventObservable = target.getCustomEventObservable(customEventObject.type);
                if (!self.defaultTargetOnly && // defaults to false
                    (!lowestCustomEventObservable || !lowestCustomEventObservable.defaultTargetOnly) || currentTarget === target) {
                    // default value as final value if possible
                    gRet = defaultFn.call(currentTarget, customEventObject);
                }
            }
            return gRet;
        }
function ( eventData ) { eventData = eventData || { } ; var self = this , bubbles = self . bubbles , currentTarget = self . currentTarget , parents , parentsLen , type = self . type , defaultFn = self . defaultFn , i , customEventObject = eventData , gRet , ret ; eventData . type = type ; if ( ! customEventObject . isEventObject ) { customEventObject = new CustomEventObject ( customEventObject ) ; } customEventObject . target = customEventObject . target || currentTarget ; customEventObject . currentTarget = currentTarget ; ret = self . notify ( customEventObject ) ; if ( gRet !== false && ret !== undefined ) { gRet = ret ; } // gRet === false prevent // gRet === false prevent if ( bubbles && ! customEventObject . isPropagationStopped ( ) ) { parents = currentTarget . getTargets ( ) ; parentsLen = parents && parents . length || 0 ; for ( i = 0 ; i < parentsLen && ! customEventObject . isPropagationStopped ( ) ; i ++ ) { ret = parents [ i ] . fire ( type , customEventObject ) ; // false 优先返回 // false 优先返回 if ( gRet !== false && ret !== undefined ) { gRet = ret ; } } } // bubble first // parent defaultFn first // child defaultFn last // bubble first // parent defaultFn first // child defaultFn last if ( defaultFn && ! customEventObject . isDefaultPrevented ( ) ) { var target = customEventObject . target , lowestCustomEventObservable = target . getCustomEventObservable ( customEventObject . type ) ; if ( ! self . defaultTargetOnly && // defaults to false ( ! lowestCustomEventObservable || ! lowestCustomEventObservable . defaultTargetOnly ) || currentTarget === target ) { // default value as final value if possible gRet = defaultFn . call ( currentTarget , customEventObject ) ; } } return gRet ; }
notify current custom event 's observers and then bubble up if this event can bubble.
@param {KISSY.Event.CustomEvent.Object} eventData
@return {*} return false if one of custom event 's observers (include bubbled) else
return last value of custom event 's observers (include bubbled) 's return value.
notify current custom event s observers and then bubble up if this event can bubble .