Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
a14a3172
Commit
a14a3172
authored
Feb 27, 2013
by
jaubourg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly resets firingLength when emptying the list. Fixes #13517
parent
b6cfc043
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
callbacks.js
src/callbacks.js
+1
-0
callbacks.js
test/unit/callbacks.js
+16
-0
No files found.
src/callbacks.js
View file @
a14a3172
...
@@ -145,6 +145,7 @@ jQuery.Callbacks = function( options ) {
...
@@ -145,6 +145,7 @@ jQuery.Callbacks = function( options ) {
// Remove all callbacks from the list
// Remove all callbacks from the list
empty
:
function
()
{
empty
:
function
()
{
list
=
[];
list
=
[];
firingLength
=
0
;
return
this
;
return
this
;
},
},
// Have the list do nothing anymore
// Have the list do nothing anymore
...
...
test/unit/callbacks.js
View file @
a14a3172
...
@@ -92,6 +92,22 @@ jQuery.each( tests, function( strFlags, resultString ) {
...
@@ -92,6 +92,22 @@ jQuery.each( tests, function( strFlags, resultString ) {
cblist
.
fire
(
"A"
);
cblist
.
fire
(
"A"
);
strictEqual
(
output
,
"X"
,
"Firing after disabling"
);
strictEqual
(
output
,
"X"
,
"Firing after disabling"
);
// #13517 - Emptying while firing
cblist
=
jQuery
.
Callbacks
(
flags
);
cblist
.
add
(
cblist
.
empty
);
cblist
.
add
(
function
()
{
ok
(
false
,
"not emptied"
);
}
);
cblist
.
fire
();
// Disabling while firing
cblist
=
jQuery
.
Callbacks
(
flags
);
cblist
.
add
(
cblist
.
disable
);
cblist
.
add
(
function
()
{
ok
(
false
,
"not disabled"
);
}
);
cblist
.
fire
();
// Basic binding and firing (context, arguments)
// Basic binding and firing (context, arguments)
output
=
"X"
;
output
=
"X"
;
cblist
=
jQuery
.
Callbacks
(
flags
);
cblist
=
jQuery
.
Callbacks
(
flags
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment