Skip to content
Permalink
Browse files

The cssHook from addGetHookIf wasn't actually getting added

  • Loading branch information...
timmywil committed Sep 11, 2013
1 parent 48a3549 commit 2e850fb802fc01f61c8e3b9030e8391c5b283a4e
Showing with 7 additions and 8 deletions.
  1. +1 −1 src/css.js
  2. +5 −6 src/css/addGetHookIf.js
  3. +1 −1 src/offset.js
@@ -370,7 +370,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
});

// Support: Android 2.3
addGetHookIf( jQuery.cssHooks.marginRight, support.reliableMarginRight,
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
function ( elem, computed ) {
if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
@@ -1,8 +1,8 @@
define( function() {
define(function() {

function addGetHookIf( hookVar, conditionFn, hookFn ) {
function addGetHookIf( conditionFn, hookFn ) {
// Define the hook, we'll check on the first run if it's really needed.
hookVar = {
return {
get: function() {
var condition = conditionFn();

@@ -16,14 +16,13 @@ function addGetHookIf( hookVar, conditionFn, hookFn ) {
// Hook not needed (or it's not possible to use it due to missing dependency),
// remove it.
// Since there are no other hooks for marginRight, remove the whole object.
delete hookVar.get;
delete this.get;
return;
}

// Hook needed; redefine it so that the support test is not executed again.
hookVar.get = hookFn;

return hookVar.get.apply( hookVar, arguments );
return (this.get = hookFn).apply( hookVar, arguments );
}
};
}
@@ -187,7 +187,7 @@ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( me
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) {
addGetHookIf( jQuery.cssHooks[ prop ], support.pixelPosition,
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
function ( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );

0 comments on commit 2e850fb

Please sign in to comment.
You can’t perform that action at this time.