Side navigation
#13517 closed bug (fixed)
Opened February 25, 2013 04:51PM UTC
Closed February 27, 2013 03:14PM UTC
Last modified February 27, 2013 03:18PM UTC
Adding a callback calling empty method to $.Callbacks object makes error thrown on fire
Reported by: | anonymous | Owned by: | anonymous |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Try this page and open your web inspector console: http://jsfiddle.net/zkctt/
var cb = $.Callbacks(); cb.add(cb.empty); // empty method call in callback cause error on next callback called cb.add(function(){ console.log('not reached and throw error'); }); cb.fire();
Attachments (0)
Change History (5)
Changed February 25, 2013 05:01PM UTC by comment:1
owner: | → anonymous |
---|---|
status: | new → pending |
Changed February 25, 2013 05:29PM UTC by comment:2
Dang, we probably don't test for the existing of the array inside of fire. I cannot test right now but I'll check when I'm back home.
Changed February 26, 2013 04:14PM UTC by comment:3
I'm reporter.
This bug comes from carelessness of $.Callbacks object status.
At src/callbacks.js:147 on master branch, we should take care of "firing", "firingLength" and "firingIndex" variables like remove method.
According to my sense, the result of empty method call should be same as the result of appling remove method for each registered callbacks,
so I think "firingLength" and "firingIndex" shoud be initialized with zero, like following:
empty: function() { list = []; if ( firing ) { firingLength = firingIndex = 0; } return this; },
Why?