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
c6cf30a5
Commit
c6cf30a5
authored
Oct 16, 2012
by
Allen J Schmidt Jr
Committed by
Dave Methvin
Oct 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12739. Keep namespace when triggering with an Event. Close gh-972.
parent
b3860807
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
AUTHORS.txt
AUTHORS.txt
+2
-1
event.js
src/event.js
+1
-1
event.js
test/unit/event.js
+37
-0
No files found.
AUTHORS.txt
View file @
c6cf30a5
...
@@ -134,4 +134,5 @@ Nikita Govorov <nikita.govorov@gmail.com>
...
@@ -134,4 +134,5 @@ Nikita Govorov <nikita.govorov@gmail.com>
Michael Pennisi <mike@mikepennisi.com>
Michael Pennisi <mike@mikepennisi.com>
Markus Staab <markus.staab@redaxo.de>
Markus Staab <markus.staab@redaxo.de>
Daniel Gálvez <dgalvez@editablething.com>
Daniel Gálvez <dgalvez@editablething.com>
James Huston <james@jameshuston.net>
James Huston <james@jameshuston.net>
\ No newline at end of file
Allen J Schmidt Jr <cobrasoft@gmail.com>
\ No newline at end of file
src/event.js
View file @
c6cf30a5
...
@@ -212,7 +212,7 @@ jQuery.event = {
...
@@ -212,7 +212,7 @@ jQuery.event = {
// Event object or event type
// Event object or event type
var
cache
,
exclusive
,
i
,
cur
,
old
,
ontype
,
special
,
handle
,
eventPath
,
bubbleType
,
var
cache
,
exclusive
,
i
,
cur
,
old
,
ontype
,
special
,
handle
,
eventPath
,
bubbleType
,
type
=
event
.
type
||
event
,
type
=
event
.
type
||
event
,
namespaces
=
[];
namespaces
=
event
.
namespace
?
event
.
namespace
.
split
(
"."
)
:
[];
// focus/blur morphs to focusin/out; ensure we're not firing them right now
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if
(
rfocusMorph
.
test
(
type
+
jQuery
.
event
.
triggered
)
)
{
if
(
rfocusMorph
.
test
(
type
+
jQuery
.
event
.
triggered
)
)
{
...
...
test/unit/event.js
View file @
c6cf30a5
...
@@ -2923,3 +2923,40 @@ asyncTest("trigger click on checkbox, fires change event", function() {
...
@@ -2923,3 +2923,40 @@ asyncTest("trigger click on checkbox, fires change event", function() {
start
();
start
();
}).
trigger
(
"click"
);
}).
trigger
(
"click"
);
});
});
test
(
"Namespace preserved when passed an Event (#12739)"
,
function
()
{
expect
(
4
);
var
markup
=
jQuery
(
"<div id='parent'><div id='child'></div></div>"
),
triggered
=
0
,
fooEvent
;
markup
.
find
(
"div"
)
.
addBack
()
.
on
(
"foo.bar"
,
function
(
e
)
{
if
(
!
e
.
handled
)
{
triggered
++
;
e
.
handled
=
true
;
equal
(
e
.
namespace
,
"bar"
,
"namespace is bar"
);
jQuery
(
e
.
target
).
find
(
"div"
).
each
(
function
()
{
jQuery
(
this
).
triggerHandler
(
e
);
});
}
})
.
on
(
"foo.bar2"
,
function
(
e
)
{
ok
(
false
,
"foo.bar2 called on trigger "
+
triggered
+
" id "
+
this
.
id
);
});
markup
.
trigger
(
"foo.bar"
);
markup
.
trigger
(
jQuery
.
Event
(
"foo.bar"
)
);
fooEvent
=
jQuery
.
Event
(
"foo"
);
fooEvent
.
namespace
=
"bar"
;
markup
.
trigger
(
fooEvent
);
markup
.
remove
();
equal
(
triggered
,
3
,
"foo.bar triggered"
);
});
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