diff options
author | Timmy Willison <timmywillisn@gmail.com> | 2013-09-11 08:41:48 -0500 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2013-09-11 08:44:26 -0500 |
commit | 577df985244ef3dcbc34c1e647ac9de513e94c3c (patch) | |
tree | 8db1b3b26ded419669320f7877c835bbd006f837 /src | |
parent | baa8dff0235a3911635122bd7af3ddb9ed2df5cf (diff) | |
download | jquery-577df985244ef3dcbc34c1e647ac9de513e94c3c.tar.gz jquery-577df985244ef3dcbc34c1e647ac9de513e94c3c.zip |
The cssHook from addGetHookIf wasn't actually getting added
Conflicts:
src/css.js
Diffstat (limited to 'src')
-rw-r--r-- | src/css.js | 2 | ||||
-rw-r--r-- | src/css/addGetHookIf.js | 9 | ||||
-rw-r--r-- | src/offset.js | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/css.js b/src/css.js index 93c55f574..2a18aa4fc 100644 --- a/src/css.js +++ b/src/css.js @@ -417,7 +417,7 @@ if ( !support.opacity ) { }; } -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 diff --git a/src/css/addGetHookIf.js b/src/css/addGetHookIf.js index 2c2c47a68..214af953a 100644 --- a/src/css/addGetHookIf.js +++ b/src/css/addGetHookIf.js @@ -1,8 +1,8 @@ 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 ); } }; } diff --git a/src/offset.js b/src/offset.js index d73166a99..751cbf72a 100644 --- a/src/offset.js +++ b/src/offset.js @@ -191,7 +191,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 ); |