No ticket. Optimize top/left hooks: move the position check up, don't re-check it inside a hook.

parent 3ec6af89
...@@ -589,22 +589,20 @@ jQuery.each( [ "top", "left" ], function( i, prop ) { ...@@ -589,22 +589,20 @@ jQuery.each( [ "top", "left" ], function( i, prop ) {
return; return;
} }
if ( pixelPosition ) { if ( pixelPosition || !jQuery.fn.position ) {
// Hook not needed, remove it. // 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. // Since there are no other hooks for prop, remove the whole object.
delete jQuery.cssHooks[ prop ]; delete jQuery.cssHooks[ prop ];
return; return;
} }
jQuery.cssHooks[ prop ].get = function ( elem, computed ) { jQuery.cssHooks[ prop ].get = function ( elem, computed ) {
if ( !support.pixelPosition() && jQuery.fn.position ) { if ( computed ) {
if ( computed ) { computed = curCSS( elem, prop );
computed = curCSS( elem, prop ); // if curCSS returns percentage, fallback to offset
// if curCSS returns percentage, fallback to offset return rnumnonpx.test( computed ) ?
return rnumnonpx.test( computed ) ? jQuery( elem ).position()[ prop ] + "px" :
jQuery( elem ).position()[ prop ] + "px" : computed;
computed;
}
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment