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
3ae5fbc1
Commit
3ae5fbc1
authored
Nov 28, 2007
by
David Serduke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #1701 by passing through the arguments as suggested.
parent
5c6c9936
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
event.js
src/event.js
+1
-1
event.js
test/unit/event.js
+6
-2
No files found.
src/event.js
View file @
3ae5fbc1
...
@@ -333,7 +333,7 @@ jQuery.fn.extend({
...
@@ -333,7 +333,7 @@ jQuery.fn.extend({
event
.
preventDefault
();
event
.
preventDefault
();
// and execute the function
// and execute the function
return
args
[
this
.
lastToggle
].
apply
(
this
,
[
event
]
)
||
false
;
return
args
[
this
.
lastToggle
].
apply
(
this
,
arguments
)
||
false
;
});
});
},
},
...
...
test/unit/event.js
View file @
3ae5fbc1
...
@@ -172,7 +172,7 @@ test("trigger(event, [data], [fn])", function() {
...
@@ -172,7 +172,7 @@ test("trigger(event, [data], [fn])", function() {
});
});
test
(
"toggle(Function, Function)"
,
function
()
{
test
(
"toggle(Function, Function)"
,
function
()
{
expect
(
4
);
expect
(
5
);
var
count
=
0
,
var
count
=
0
,
fn1
=
function
(
e
)
{
count
++
;
},
fn1
=
function
(
e
)
{
count
++
;
},
fn2
=
function
(
e
)
{
count
--
;
},
fn2
=
function
(
e
)
{
count
--
;
},
...
@@ -180,7 +180,11 @@ test("toggle(Function, Function)", function() {
...
@@ -180,7 +180,11 @@ test("toggle(Function, Function)", function() {
link
=
$
(
'#mark'
);
link
=
$
(
'#mark'
);
link
.
click
(
preventDefault
).
click
().
toggle
(
fn1
,
fn2
).
click
().
click
().
click
().
click
().
click
();
link
.
click
(
preventDefault
).
click
().
toggle
(
fn1
,
fn2
).
click
().
click
().
click
().
click
().
click
();
ok
(
count
==
1
,
"Check for toggle(fn, fn)"
);
ok
(
count
==
1
,
"Check for toggle(fn, fn)"
);
$
(
"#firstp"
).
toggle
(
function
()
{
equals
(
arguments
.
length
,
4
,
"toggle correctly passes through additional triggered arguments, see #1701"
)
},
function
()
{}).
trigger
(
"click"
,
[
1
,
2
,
3
]);
var
first
=
0
;
var
first
=
0
;
$
(
"#simon1"
).
one
(
"click"
,
function
()
{
$
(
"#simon1"
).
one
(
"click"
,
function
()
{
ok
(
true
,
"Execute event only once"
);
ok
(
true
,
"Execute event only once"
);
...
...
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