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
ec7baf23
Commit
ec7baf23
authored
Jan 09, 2009
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Didn't get specific enough with the proxy guid, fixes #3787.
parent
d12e8a34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
event.js
src/event.js
+2
-2
event.js
test/unit/event.js
+15
-2
No files found.
src/event.js
View file @
ec7baf23
...
@@ -545,7 +545,7 @@ jQuery.fn.extend({
...
@@ -545,7 +545,7 @@ jQuery.fn.extend({
live
:
function
(
type
,
fn
){
live
:
function
(
type
,
fn
){
var
proxy
=
jQuery
.
event
.
proxy
(
fn
);
var
proxy
=
jQuery
.
event
.
proxy
(
fn
);
proxy
.
guid
+=
this
.
selector
;
proxy
.
guid
+=
this
.
selector
+
type
;
jQuery
(
document
).
bind
(
liveConvert
(
type
,
this
.
selector
),
this
.
selector
,
proxy
);
jQuery
(
document
).
bind
(
liveConvert
(
type
,
this
.
selector
),
this
.
selector
,
proxy
);
...
@@ -553,7 +553,7 @@ jQuery.fn.extend({
...
@@ -553,7 +553,7 @@ jQuery.fn.extend({
},
},
die
:
function
(
type
,
fn
){
die
:
function
(
type
,
fn
){
jQuery
(
document
).
unbind
(
liveConvert
(
type
,
this
.
selector
),
fn
?
{
guid
:
fn
.
guid
+
this
.
selector
}
:
null
);
jQuery
(
document
).
unbind
(
liveConvert
(
type
,
this
.
selector
),
fn
?
{
guid
:
fn
.
guid
+
this
.
selector
+
type
}
:
null
);
return
this
;
return
this
;
}
}
});
});
...
...
test/unit/event.js
View file @
ec7baf23
...
@@ -474,7 +474,7 @@ test("toggle(Function, Function, ...)", function() {
...
@@ -474,7 +474,7 @@ test("toggle(Function, Function, ...)", function() {
});
});
test
(
".live()/.die()"
,
function
()
{
test
(
".live()/.die()"
,
function
()
{
expect
(
3
4
);
expect
(
3
6
);
var
submit
=
0
,
div
=
0
,
livea
=
0
,
liveb
=
0
;
var
submit
=
0
,
div
=
0
,
livea
=
0
,
liveb
=
0
;
...
@@ -571,10 +571,23 @@ test(".live()/.die()", function() {
...
@@ -571,10 +571,23 @@ test(".live()/.die()", function() {
equals
(
called
,
3
,
"Verify that only one click occurred."
);
equals
(
called
,
3
,
"Verify that only one click occurred."
);
jQuery
(
"#anchor2"
).
trigger
(
"click"
);
jQuery
(
"#anchor2"
).
trigger
(
"click"
);
equals
(
called
,
3
,
"Verify that only one click occurred."
);
equals
(
called
,
3
,
"Verify that no click occurred."
);
// Make sure that it still works if the selector is the same,
// but the event type is different
jQuery
(
"#nothiddendiv"
).
live
(
"foo"
,
callback
);
// Cleanup
// Cleanup
jQuery
(
"#nothiddendiv"
).
die
(
"click"
,
callback
);
jQuery
(
"#nothiddendiv"
).
die
(
"click"
,
callback
);
jQuery
(
"#nothiddendiv"
).
trigger
(
"click"
);
equals
(
called
,
3
,
"Verify that no click occurred."
);
jQuery
(
"#nothiddendiv"
).
trigger
(
"foo"
);
equals
(
called
,
4
,
"Verify that one foo occurred."
);
// Cleanup
jQuery
(
"#nothiddendiv"
).
die
(
"foo"
,
callback
);
});
});
/*
/*
...
...
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