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
fc2ba2e1
Commit
fc2ba2e1
authored
Jan 16, 2013
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #13208: only check elements for delegation matches
parent
65df32dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
event.js
src/event.js
+2
-1
event.js
test/unit/event.js
+11
-0
No files found.
src/event.js
View file @
fc2ba2e1
...
...
@@ -410,8 +410,9 @@ jQuery.event = {
for
(
;
cur
!=
this
;
cur
=
cur
.
parentNode
||
this
)
{
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if
(
cur
.
disabled
!==
true
||
event
.
type
!==
"click"
)
{
if
(
cur
.
nodeType
===
1
&&
(
cur
.
disabled
!==
true
||
event
.
type
!==
"click"
)
)
{
matches
=
[];
for
(
i
=
0
;
i
<
delegateCount
;
i
++
)
{
handleObj
=
handlers
[
i
];
...
...
test/unit/event.js
View file @
fc2ba2e1
...
...
@@ -1811,6 +1811,17 @@ test( "delegated event with selector matching Object.prototype property (#13203)
equal
(
matched
,
0
,
"Nothing matched 'toString'"
);
});
test
(
"delegated event with intermediate DOM manipulation (#13208)"
,
function
()
{
expect
(
1
);
jQuery
(
"#foo"
).
on
(
"click"
,
"#sap"
,
function
()
{});
jQuery
(
"#sap"
).
on
(
"click"
,
"#anchor2"
,
function
()
{
jQuery
(
this
.
parentNode
).
remove
();
ok
(
true
,
"Element removed"
);
});
jQuery
(
"#anchor2"
).
trigger
(
"click"
);
});
test
(
"stopPropagation() stops directly-bound events on delegated target"
,
function
()
{
expect
(
1
);
...
...
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