]> 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:44:26 +0000 (08:44 -0500)
Conflicts:
src/css.js

src/css.js
src/css/addGetHookIf.js
src/offset.js

index 93c55f5746ea452330a7f65f1ed41ab5d46503b7..2a18aa4fc97f8c590e38be6abbab3e4f36a4cbdb 100644 (file)
@@ -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
index 2c2c47a68b5b668b012252f0a067304de3a28c5c..214af953a808ef411f1787c410331fb7628fad42 100644 (file)
@@ -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 );
                }
        };
 }
index d73166a999f862630f17096b64dd49bb29af08b3..751cbf72a8c100b51c60bc658bf26830072da2eb 100644 (file)
@@ -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 );