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
974b5aea
Commit
974b5aea
authored
Oct 23, 2010
by
dmethvin
Committed by
John Resig
Oct 25, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Honor stopImmediatePropagation for live/delegate event handlers. Fixes #7217.
parent
ee845c49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
event.js
src/event.js
+3
-0
event.js
test/unit/event.js
+30
-0
No files found.
src/event.js
View file @
974b5aea
...
@@ -1132,6 +1132,9 @@ function liveHandler( event ) {
...
@@ -1132,6 +1132,9 @@ function liveHandler( event ) {
if
(
ret
===
false
)
{
if
(
ret
===
false
)
{
stop
=
false
;
stop
=
false
;
}
}
if
(
event
.
isImmediatePropagationStopped
()
)
{
break
;
}
}
}
}
}
...
...
test/unit/event.js
View file @
974b5aea
...
@@ -265,6 +265,36 @@ test("live/die(Object), delegate/undelegate(String, Object)", function() {
...
@@ -265,6 +265,36 @@ test("live/die(Object), delegate/undelegate(String, Object)", function() {
equals
(
mouseoverCounter
,
4
,
"die"
);
equals
(
mouseoverCounter
,
4
,
"die"
);
});
});
test
(
"live/delegate immediate propagation"
,
function
()
{
expect
(
2
);
var
$p
=
jQuery
(
"#firstp"
),
$a
=
$p
.
find
(
"a:first"
),
lastClick
;
lastClick
=
""
;
$a
.
live
(
"click"
,
function
(
e
)
{
lastClick
=
"click1"
;
e
.
stopImmediatePropagation
();
});
$a
.
live
(
"click"
,
function
(
e
)
{
lastClick
=
"click2"
;
});
$a
.
trigger
(
"click"
);
equals
(
lastClick
,
"click1"
,
"live stopImmediatePropagation"
);
$a
.
die
(
"click"
);
lastClick
=
""
;
$p
.
delegate
(
"a"
,
"click"
,
function
(
e
)
{
lastClick
=
"click1"
;
e
.
stopImmediatePropagation
();
});
$p
.
delegate
(
"a"
,
"click"
,
function
(
e
)
{
lastClick
=
"click2"
;
});
$a
.
trigger
(
"click"
);
equals
(
lastClick
,
"click1"
,
"delegate stopImmediatePropagation"
);
$p
.
undelegate
(
"click"
);
});
test
(
"bind(), iframes"
,
function
()
{
test
(
"bind(), iframes"
,
function
()
{
// events don't work with iframes, see #939 - this test fails in IE because of contentDocument
// events don't work with iframes, see #939 - this test fails in IE because of contentDocument
var
doc
=
jQuery
(
"#loadediframe"
).
contents
();
var
doc
=
jQuery
(
"#loadediframe"
).
contents
();
...
...
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