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
c0da49ff
Commit
c0da49ff
authored
Jan 13, 2012
by
Rick Waldron
Committed by
Dave Methvin
Jan 13, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #11130: Don't neglect the data arg when event-map is passed.
parent
d8289964
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
event.js
src/event.js
+2
-2
event.js
test/unit/event.js
+19
-3
No files found.
src/event.js
View file @
c0da49ff
...
...
@@ -867,9 +867,9 @@ jQuery.fn.extend({
// Types can be a map of types/handlers
if
(
typeof
types
===
"object"
)
{
// ( types-Object, selector, data )
if
(
typeof
selector
!==
"string"
)
{
if
(
typeof
selector
!==
"string"
)
{
// && selector != null
// ( types-Object, data )
data
=
selector
;
data
=
data
||
selector
;
selector
=
undefined
;
}
for
(
type
in
types
)
{
...
...
test/unit/event.js
View file @
c0da49ff
...
...
@@ -1197,7 +1197,7 @@ test("Delegated events in SVG (#10791)", function() {
'<rect id="svg-by-id" x="10" y="20" width="100" height="60" r="10" rx="10" ry="10"></rect>'
+
'</svg>'
).
appendTo
(
"body"
);
jQuery
(
"body"
)
.
on
(
"click"
,
"#svg-by-id"
,
function
()
{
ok
(
true
,
"delegated id selector"
);
...
...
@@ -2601,7 +2601,7 @@ test("special bind/delegate name mapping", function() {
// Ensure .one() events are removed after their maiden voyage
jQuery
(
'<p>Gut Feeling</p>'
)
.
one
(
"gutfeeling"
,
jQuery
.
noop
)
.
trigger
(
"gutfeeling"
)
// This one should
.
trigger
(
"gutfeeling"
)
// This one should
.
trigger
(
"gutfeeling"
)
// This one should not
.
remove
();
...
...
@@ -2616,7 +2616,7 @@ test(".on and .off, selective mixed removal (#10705)", function() {
ok
(
true
,
"triggered "
+
e
.
type
);
};
jQuery
(
'<p>Strange Pursuit</p>'
)
jQuery
(
"<p>Strange Pursuit</p>"
)
.
on
(
"click"
,
timingx
)
.
on
(
"click.duty"
,
timingx
)
.
on
(
"click.now"
,
timingx
)
...
...
@@ -2631,6 +2631,22 @@ test(".on and .off, selective mixed removal (#10705)", function() {
.
trigger
(
"click"
);
// 0
});
test
(
".on( event-map, null-selector, data ) #11130"
,
function
()
{
expect
(
1
);
var
$p
=
jQuery
(
"<p>Strange Pursuit</p>"
),
data
=
"bar"
,
map
=
{
"foo"
:
function
(
event
)
{
equal
(
event
.
data
,
"bar"
,
"event.data correctly relayed with null selector"
);
$p
.
remove
();
}
};
$p
.
on
(
map
,
null
,
data
).
trigger
(
"foo"
);
});
test
(
"delegated events quickIs"
,
function
()
{
expect
(
14
);
var
markup
=
jQuery
(
...
...
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