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
04dbdb75
Commit
04dbdb75
authored
Nov 19, 2009
by
Robert Katic
Committed by
John Resig
Nov 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected RegExp to match event namespaces. Fixes #5303.
parent
ac00fe5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
event.js
src/event.js
+2
-2
event.js
test/unit/event.js
+4
-0
No files found.
src/event.js
View file @
04dbdb75
...
...
@@ -133,7 +133,7 @@ jQuery.event = {
var
namespaces
=
type
.
split
(
"."
);
type
=
namespaces
.
shift
();
var
all
=
!
namespaces
.
length
,
namespace
=
new
RegExp
(
"(^|
\\
.)"
+
namespaces
.
slice
(
0
).
sort
().
join
(
".*
\\
.
"
)
+
"(
\\
.|$)"
),
namespace
=
new
RegExp
(
"(^|
\\
.)"
+
namespaces
.
slice
(
).
sort
().
join
(
"
\\
.(?:.*
\\
.)?
"
)
+
"(
\\
.|$)"
),
special
=
this
.
special
[
type
]
||
{};
if
(
events
[
type
]
)
{
...
...
@@ -291,7 +291,7 @@ jQuery.event = {
// Cache this now, all = true means, any handler
all
=
!
namespaces
.
length
&&
!
event
.
exclusive
;
var
namespace
=
new
RegExp
(
"(^|
\\
.)"
+
namespaces
.
slice
(
0
).
sort
().
join
(
".*
\\
.
"
)
+
"(
\\
.|$)"
);
var
namespace
=
new
RegExp
(
"(^|
\\
.)"
+
namespaces
.
slice
(
).
sort
().
join
(
"
\\
.(?:.*
\\
.)?
"
)
+
"(
\\
.|$)"
);
handlers
=
(
jQuery
.
data
(
this
,
"events"
)
||
{}
)[
event
.
type
];
...
...
test/unit/event.js
View file @
04dbdb75
...
...
@@ -192,6 +192,10 @@ test("bind(), multi-namespaced events", function() {
jQuery
(
"#firstp"
).
bind
(
"click.test.abc"
,
function
(
e
){
check
(
"click.test.abc"
,
"Namespaced click triggered"
);
});
// Those would not trigger/unbind (#5303)
jQuery
(
"#firstp"
).
trigger
(
"click.a.test"
);
jQuery
(
"#firstp"
).
unbind
(
"click.a.test"
);
// Trigger both bound fn (1)
jQuery
(
"#firstp"
).
trigger
(
"click.test.abc"
);
...
...
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