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
780c59b8
Commit
780c59b8
authored
Nov 16, 2011
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #10791. SVG clamors for special treatment of its class names.
parent
80797f58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
event.js
src/event.js
+1
-1
event.js
test/unit/event.js
+25
-0
No files found.
src/event.js
View file @
780c59b8
...
...
@@ -21,7 +21,7 @@ var rformElems = /^(?:textarea|input|select)$/i,
return
(
(
!
m
[
1
]
||
elem
.
nodeName
.
toLowerCase
()
===
m
[
1
])
&&
(
!
m
[
2
]
||
elem
.
id
===
m
[
2
])
&&
(
!
m
[
3
]
||
m
[
3
].
test
(
elem
.
classNam
e
))
(
!
m
[
3
]
||
m
[
3
].
test
(
((
elem
.
attributes
||
{})[
"class"
]
||
{}).
valu
e
))
);
},
hoverHack
=
function
(
events
)
{
...
...
test/unit/event.js
View file @
780c59b8
...
...
@@ -1184,6 +1184,31 @@ test(".trigger() doesn't bubble load event (#10717)", function() {
jQuery
(
window
).
off
(
"load"
);
});
test
(
"Delegated events in SVG (#10791)"
,
function
()
{
expect
(
2
);
var
svg
=
jQuery
(
'<svg height="1" version="1.1" width="1" xmlns="http://www.w3.org/2000/svg">'
+
'<rect class="svg-by-class" x="10" y="20" width="100" height="60" r="10" rx="10" ry="10"></rect>'
+
'<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"
);
})
.
on
(
"click"
,
".svg-by-class"
,
function
()
{
ok
(
true
,
"delegated class selector"
);
})
.
find
(
"#svg-by-id, .svg-by-class"
)
.
trigger
(
"click"
)
.
end
()
.
off
(
"click"
);
svg
.
remove
();
});
test
(
"jQuery.Event( type, props )"
,
function
()
{
expect
(
5
);
...
...
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