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
530c9155
Commit
530c9155
authored
Apr 11, 2011
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move initialization of event until we determine if anyone wants it.
parent
bb520104
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
event.js
src/event.js
+18
-15
No files found.
src/event.js
View file @
530c9155
...
...
@@ -289,35 +289,38 @@ jQuery.event = {
trigger
:
function
(
event
,
data
,
elem
)
{
// Event object or event type
var
type
=
event
.
type
||
event
,
namespaces
=
[];
event
=
typeof
event
===
"object"
?
// jQuery.Event object
event
[
jQuery
.
expando
]
?
event
:
// Object literal
jQuery
.
extend
(
jQuery
.
Event
(
type
),
event
)
:
// Just the event type (string)
jQuery
.
Event
(
type
);
namespaces
=
[],
exclusive
;
if
(
type
.
indexOf
(
"!"
)
>=
0
)
{
// Exclusive events trigger only for the
bare event type
(no namespaces)
event
.
type
=
type
=
type
.
slice
(
0
,
-
1
);
e
vent
.
e
xclusive
=
true
;
// Exclusive events trigger only for the
exact event
(no namespaces)
type
=
type
.
slice
(
0
,
-
1
);
exclusive
=
true
;
}
if
(
type
.
indexOf
(
"."
)
>=
0
)
{
// Namespaced trigger; create a regexp to match event type in handle()
namespaces
=
type
.
split
(
"."
);
event
.
type
=
type
=
namespaces
.
shift
();
type
=
namespaces
.
shift
();
namespaces
.
sort
();
}
event
.
namespace
=
namespaces
.
join
(
"."
);
event
.
namespace_re
=
new
RegExp
(
"(^|
\\
.)"
+
namespaces
.
join
(
"
\\
.(?:.*
\\
.)?"
)
+
"(
\\
.|$)"
);
if
(
jQuery
.
event
.
customEvent
[
type
]
&&
!
jQuery
.
event
.
global
[
type
]
)
{
// No jQuery handlers for this event type, and it can't have inline handlers
return
;
}
// Caller can pass in an Event, Object, or just an event type string
event
=
typeof
event
===
"object"
?
// jQuery.Event object
event
[
jQuery
.
expando
]
?
event
:
// Object literal
jQuery
.
extend
(
jQuery
.
Event
(
type
),
event
)
:
// Just the event type (string)
jQuery
.
Event
(
type
);
event
.
namespace
=
namespaces
.
join
(
"."
);
event
.
namespace_re
=
new
RegExp
(
"(^|
\\
.)"
+
namespaces
.
join
(
"
\\
.(?:.*
\\
.)?"
)
+
"(
\\
.|$)"
);
event
.
exclusive
=
exclusive
;
// Handle a global trigger
if
(
!
elem
)
{
// Don't bubble custom events when global (to avoid too much overhead)
...
...
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