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
5d36fe32
Commit
5d36fe32
authored
Feb 11, 2010
by
jeresig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that live mouseenter/mouseleave work properly. Fixes #6077.
parent
021b809a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
event.js
src/event.js
+16
-8
No files found.
src/event.js
View file @
5d36fe32
...
@@ -917,9 +917,16 @@ jQuery.fn.extend({
...
@@ -917,9 +917,16 @@ jQuery.fn.extend({
}
}
});
});
var liveMap = {
focus: "
focusin
",
blur: "
focusout
",
mouseenter: "
mouseover
",
mouseleave: "
mouseout
"
};
jQuery.each(["
live
", "
die
"], function( i, name ) {
jQuery.each(["
live
", "
die
"], function( i, name ) {
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
var type, i = 0, match, namespaces,
var type, i = 0, match, namespaces,
preType,
selector = origSelector || this.selector,
selector = origSelector || this.selector,
context = origSelector ? this : jQuery( this.context );
context = origSelector ? this : jQuery( this.context );
...
@@ -939,18 +946,19 @@ jQuery.each(["live", "die"], function( i, name ) {
...
@@ -939,18 +946,19 @@ jQuery.each(["live", "die"], function( i, name ) {
type = type.replace( rnamespaces, "" );
type = type.replace( rnamespaces, "" );
}
}
type = type === "
focus
" ? "
focusin
" : // focus --> focusin
if ( type === "
hover
" ) {
type === "
blur
" ? "
focusout
" : // blur --> focusout
types.push( "
mouseenter
" + namespaces, "
mouseleave
" + namespaces );
type === "
hover
" ? types.push("
mouseleave
" + namespaces) && "
mouseenter
" : // hover support
continue;
type;
}
type += namespaces;
preType = type;
type = (liveMap[ type ] || type) + namespaces;
if ( name === "
live
" ) {
if ( name === "
live
" ) {
// bind live handler
// bind live handler
context.each(function(){
context.each(function(){
jQuery.event.add( this, liveConvert( type, selector ),
jQuery.event.add( this, liveConvert( type, selector ),
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn } );
{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn
, preType: preType
} );
});
});
} else {
} else {
...
@@ -999,7 +1007,7 @@ function liveHandler( event ) {
...
@@ -999,7 +1007,7 @@ function liveHandler( event ) {
related = null;
related = null;
// Those two events require additional checking
// Those two events require additional checking
if ( handleObj.
origType === "
mouseenter
" || handleObj.orig
Type === "
mouseleave
" ) {
if ( handleObj.
preType === "
mouseenter
" || handleObj.pre
Type === "
mouseleave
" ) {
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
}
}
...
...
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