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
63f40866
Commit
63f40866
authored
Jan 14, 2013
by
Richard Gibson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #13203: delegated events with selector matching Object.prototype property
(cherry picked from commit
31b95797
)
parent
0a3a424e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
event.js
src/event.js
+3
-1
event.js
test/unit/event.js
+14
-0
No files found.
src/event.js
View file @
63f40866
...
...
@@ -415,7 +415,9 @@ jQuery.event = {
matches
=
[];
for
(
i
=
0
;
i
<
delegateCount
;
i
++
)
{
handleObj
=
handlers
[
i
];
sel
=
handleObj
.
selector
;
// Don't conflict with Object.prototype properties (#13203)
sel
=
handleObj
.
selector
+
" "
;
if
(
matches
[
sel
]
===
undefined
)
{
matches
[
sel
]
=
handleObj
.
needsContext
?
...
...
test/unit/event.js
View file @
63f40866
...
...
@@ -1797,6 +1797,20 @@ test( "delegated event with delegateTarget-relative selector", function() {
markup
.
remove
();
});
test
(
"delegated event with selector matching Object.prototype property (#13203)"
,
function
()
{
expect
(
1
);
var
matched
=
0
;
jQuery
(
"#foo"
).
on
(
"click"
,
"toString"
,
function
(
e
)
{
matched
++
;
});
jQuery
(
"#anchor2"
).
trigger
(
"click"
);
equal
(
matched
,
0
,
"Nothing matched 'toString'"
);
});
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