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
3e286440
Commit
3e286440
authored
Jan 23, 2010
by
jeresig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that .die() with no args works. Fixes #5789.
parent
8ea634fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
event.js
src/event.js
+3
-3
event.js
test/unit/event.js
+16
-1
No files found.
src/event.js
View file @
3e286440
...
@@ -850,9 +850,9 @@ jQuery.each(["live", "die"], function( i, name ) {
...
@@ -850,9 +850,9 @@ jQuery.each(["live", "die"], function( i, name ) {
data = undefined;
data = undefined;
}
}
types =
types
.split( /
\
s+/ );
types =
(types || "")
.split( /
\
s+/ );
while ( (type = types[ i++ ]) ) {
while ( (type = types[ i++ ])
!= null
) {
type = type === "
focus
" ? "
focusin
" : // focus --> focusin
type = type === "
focus
" ? "
focusin
" : // focus --> focusin
type === "
blur
" ? "
focusout
" : // blur --> focusout
type === "
blur
" ? "
focusout
" : // blur --> focusout
type === "
hover
" ? types.push("
mouseleave
") && "
mouseenter
" : // hover support
type === "
hover
" ? types.push("
mouseleave
") && "
mouseenter
" : // hover support
...
@@ -934,7 +934,7 @@ function liveHandler( event ) {
...
@@ -934,7 +934,7 @@ function liveHandler( event ) {
}
}
function liveConvert( type, selector ) {
function liveConvert( type, selector ) {
return
["
live
", type, selector.replace(/
\
./g, "`").replace(/ /g, "&")].join(".
");
return
"
live
.
" + (type ? type + "
.
" : "") + selector.replace(/
\
./g, "`").replace(/ /g, "&
");
}
}
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
...
...
test/unit/event.js
View file @
3e286440
...
@@ -864,11 +864,26 @@ test(".live()/.die()", function() {
...
@@ -864,11 +864,26 @@ test(".live()/.die()", function() {
jQuery
(
"#nothiddendiv div"
).
die
(
"click"
);
jQuery
(
"#nothiddendiv div"
).
die
(
"click"
);
});
});
test
(
"die all bound events"
,
function
(){
expect
(
1
);
var
count
=
0
;
var
div
=
jQuery
(
"div#nothiddendivchild"
);
div
.
live
(
"click submit"
,
function
(){
count
++
;
});
div
.
die
();
div
.
trigger
(
"click"
);
div
.
trigger
(
"submit"
);
equals
(
count
,
0
,
"Make sure no events were triggered."
);
});
test
(
"live with multiple events"
,
function
(){
test
(
"live with multiple events"
,
function
(){
expect
(
1
);
expect
(
1
);
var
count
=
0
;
var
count
=
0
;
var
div
=
jQuery
(
"div#nothiddendivchild"
)
var
div
=
jQuery
(
"div#nothiddendivchild"
)
;
div
.
live
(
"click submit"
,
function
(){
count
++
;
});
div
.
live
(
"click submit"
,
function
(){
count
++
;
});
...
...
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