mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
No ticket. Optimize top/left hooks: move the position check up, don't re-check it inside a hook.
This commit is contained in:
parent
3ec6af891b
commit
6987220d2b
@ -589,15 +589,14 @@ jQuery.each( [ "top", "left" ], function( i, prop ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pixelPosition ) {
|
||||
// Hook not needed, remove it.
|
||||
if ( pixelPosition || !jQuery.fn.position ) {
|
||||
// Hook not needed or impossible to apply due to a missing module, remove it.
|
||||
// Since there are no other hooks for prop, remove the whole object.
|
||||
delete jQuery.cssHooks[ prop ];
|
||||
return;
|
||||
}
|
||||
|
||||
jQuery.cssHooks[ prop ].get = function ( elem, computed ) {
|
||||
if ( !support.pixelPosition() && jQuery.fn.position ) {
|
||||
if ( computed ) {
|
||||
computed = curCSS( elem, prop );
|
||||
// if curCSS returns percentage, fallback to offset
|
||||
@ -605,7 +604,6 @@ jQuery.each( [ "top", "left" ], function( i, prop ) {
|
||||
jQuery( elem ).position()[ prop ] + "px" :
|
||||
computed;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return jQuery.cssHooks[ prop ].get( elem, computed );
|
||||
|
Loading…
Reference in New Issue
Block a user