]> source.dussan.org Git - jquery.git/commitdiff
The cssHook from addGetHookIf wasn't actually getting added
authorTimmy Willison <timmywillisn@gmail.com>
Wed, 11 Sep 2013 13:41:48 +0000 (08:41 -0500)
committerTimmy Willison <timmywillisn@gmail.com>
Wed, 11 Sep 2013 13:41:48 +0000 (08:41 -0500)
src/css.js
src/css/addGetHookIf.js
src/offset.js

index 4e80b321662142d5271f690d2acd23356ba6775f..79ab342d55d5815f45ffe424676fc66e343fe0a5 100644 (file)
@@ -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
index f1ec002b346a271d0faa7298f7f7e060d5d46515..214af953a808ef411f1787c410331fb7628fad42 100644 (file)
@@ -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 );
                }
        };
 }
index ee46717fd4fe976968f9629c8194b296411c429a..9809d1079a0ed18ea95d3221601143fa4b591890 100644 (file)
@@ -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 );