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
313bee9d
Commit
313bee9d
authored
Sep 22, 2011
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves key event fixes to own even prop hook defs
parent
9ef0394f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
event.js
src/event.js
+23
-14
No files found.
src/event.js
View file @
313bee9d
...
@@ -8,6 +8,7 @@ var rnamespaces = /\.(.*)$/,
...
@@ -8,6 +8,7 @@ var rnamespaces = /\.(.*)$/,
rtypenamespace
=
/^
([^\.]
*
)?(?:\.(
.+
))?
$/
,
rtypenamespace
=
/^
([^\.]
*
)?(?:\.(
.+
))?
$/
,
rhoverHack
=
/
\b
hover
(\.\S
+
)?
/
,
rhoverHack
=
/
\b
hover
(\.\S
+
)?
/
,
rmouseEvent
=
/^
(?:
mouse|contextmenu
)
|click/
,
rmouseEvent
=
/^
(?:
mouse|contextmenu
)
|click/
,
rkeyEvent
=
/^
(?:
key
)
/
,
rquickIs
=
/^
([\w\-]
+
)?(?:
#
([\w\-]
+
))?(?:\.([\w\-]
+
))?(?:\[([\w
+
\-]
+
)
=
[
"'
]?([\w\-]
*
)[
"'
]?\])?(?:
:
(
first-child|last-child|empty
))?
$/
,
rquickIs
=
/^
([\w\-]
+
)?(?:
#
([\w\-]
+
))?(?:\.([\w\-]
+
))?(?:\[([\w
+
\-]
+
)
=
[
"'
]?([\w\-]
*
)[
"'
]?\])?(?:
:
(
first-child|last-child|empty
))?
$/
,
quickPseudoMap
=
{
quickPseudoMap
=
{
"empty"
:
"firstChild"
,
"empty"
:
"firstChild"
,
...
@@ -492,6 +493,7 @@ jQuery.event = {
...
@@ -492,6 +493,7 @@ jQuery.event = {
}
}
// Fix target property, if necessary
// Fix target property, if necessary
// Removal of this condition will crash IE6,7,8
if
(
!
event
.
target
)
{
if
(
!
event
.
target
)
{
// Fixes #1925 where srcElement might not be defined either
// Fixes #1925 where srcElement might not be defined either
event
.
target
=
event
.
srcElement
||
document
;
event
.
target
=
event
.
srcElement
||
document
;
...
@@ -507,16 +509,6 @@ jQuery.event = {
...
@@ -507,16 +509,6 @@ jQuery.event = {
event
.
relatedTarget
=
event
.
fromElement
===
event
.
target
?
event
.
toElement
:
event
.
fromElement
;
event
.
relatedTarget
=
event
.
fromElement
===
event
.
target
?
event
.
toElement
:
event
.
fromElement
;
}
}
// Add which for key events
if
(
event
.
which
==
null
&&
(
event
.
charCode
!=
null
||
event
.
keyCode
!=
null
)
)
{
event
.
which
=
event
.
charCode
!=
null
?
event
.
charCode
:
event
.
keyCode
;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
if
(
!
event
.
metaKey
&&
event
.
ctrlKey
)
{
event
.
metaKey
=
event
.
ctrlKey
;
}
if
(
this
.
propHooks
[
event
.
type
]
)
{
if
(
this
.
propHooks
[
event
.
type
]
)
{
event
=
this
.
propHooks
[
event
.
type
](
event
,
originalEvent
);
event
=
this
.
propHooks
[
event
.
type
](
event
,
originalEvent
);
}
}
...
@@ -1069,9 +1061,27 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
...
@@ -1069,9 +1061,27 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
jQuery
.
attrFn
[
name
]
=
true
;
jQuery
.
attrFn
[
name
]
=
true
;
}
}
// Add internal event property hooks to mouse events
if
(
rmouseEvent
.
test
(
name
)
)
{
// Key Event property hooks
if
(
rkeyEvent
.
test
(
name
)
)
{
jQuery
.
event
.
propHooks
[
name
]
=
function
(
event
,
original
)
{
// Add which for key events
if
(
event
.
which
==
null
&&
(
event
.
charCode
!=
null
||
event
.
keyCode
!=
null
)
)
{
event
.
which
=
event
.
charCode
!=
null
?
event
.
charCode
:
event
.
keyCode
;
}
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
if
(
!
event
.
metaKey
&&
event
.
ctrlKey
)
{
event
.
metaKey
=
event
.
ctrlKey
;
}
return
event
;
};
}
// Mouse Event property hooks
if
(
rmouseEvent
.
test
(
name
)
)
{
jQuery
.
event
.
propHooks
[
name
]
=
function
(
event
,
original
)
{
jQuery
.
event
.
propHooks
[
name
]
=
function
(
event
,
original
)
{
var
eventDocument
,
doc
,
body
;
var
eventDocument
,
doc
,
body
;
...
@@ -1093,8 +1103,7 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
...
@@ -1093,8 +1103,7 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
}
}
return
event
;
return
event
;
};
};
}
}});
});
})(
jQuery
);
})(
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