jquery , find the event handler,找到jquery中的event handler

zyip發表於2014-04-09

找到

dispatch: function (e) {
            e = b.event.fix(e);
            var n, r, i, s, o, u = [],
                a = d.call(arguments),
                f = (b._data(this, "events") || {})[e.type] || [],
                l = b.event.special[e.type] || {};
            a[0] = e, e.delegateTarget = this;
            if (l.preDispatch && l.preDispatch.call(this, e) === !1) return;
            u = b.event.handlers.call(this, e, f), n = 0;
            while ((s = u[n++]) && !e.isPropagationStopped()) {
                e.currentTarget = s.elem, o = 0;
                while ((i = s.handlers[o++]) && !e.isImmediatePropagationStopped())
                    //if (!e.namespace_re || e.namespace_re.test(i.namespace)) e.handleObj = i, e.data = i.data, r = ((b.event.special[i.origType] || {}).handle || i.handler).apply(s.elem, a), r !== t && (e.result = r) === !1 && (e.preventDefault(), e.stopPropagation());
                    if (!e.namespace_re || e.namespace_re.test(i.namespace))
                    {
                        console.log('enent.dispathc;beginning of invoking event handler');
                        e.handleObj = i;
                        e.data = i.data;
                        var _tmp=((b.event.special[i.origType] || {}).handle || i.handler);
              //begin , add following code Fragment
if(jQuery('strong',s.elem).text()=='dd') { console.log('event fired'); //add your breakpoint here, while the breakpoint is fired, input _temp in console and press enter, now you can see your handler function, click the link on the right bottom cornor to jump into the function }
              //end r
= _tmp.apply(s.elem, a); r !== t && (e.result = r) === !1 && (e.preventDefault(), e.stopPropagation()); } } return l.postDispatch && l.postDispatch.call(this, e), e.result; }

 

 

 

相關文章