🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jQuery.Callbacks = function( options ) {
fire = function() {

// Enforce single-firing
locked = options.once;
locked = locked || options.once;

// Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes
Expand Down
21 changes: 21 additions & 0 deletions test/unit/callbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,24 @@ QUnit.test( "jQuery.Callbacks() - disabled callback doesn't fire (gh-1790)", fun
cb.fire();
assert.ok( !fired, "Disabled callback function didn't fire" );
} );

QUnit.test( "jQuery.Callbacks() - list with memory stays locked (gh-3469)", function( assert ) {

assert.expect( 3 );

var cb = jQuery.Callbacks( "memory" ),
fired = 0,
count1 = function() { fired += 1; },
count2 = function() { fired += 10; };

cb.add( count1 );
cb.fire();
assert.equal( fired, 1, "Pre-lock() fire" );

cb.lock();
cb.add( count2 );
assert.equal( fired, 11, "Post-lock() add" );

cb.fire();
assert.equal( fired, 11, "Post-lock() fire ignored" );
} );