aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2013-09-11 08:41:48 -0500
committerTimmy Willison <timmywillisn@gmail.com>2013-09-11 08:41:48 -0500
commit2e850fb802fc01f61c8e3b9030e8391c5b283a4e (patch)
tree0f8a47b50b384683060e96ebacb9914456859859 /src
parent48a3549bc572bebb5dc581e4818e15f1443b3de2 (diff)
downloadjquery-2e850fb802fc01f61c8e3b9030e8391c5b283a4e.tar.gz
jquery-2e850fb802fc01f61c8e3b9030e8391c5b283a4e.zip
The cssHook from addGetHookIf wasn't actually getting added
Diffstat (limited to 'src')
-rw-r--r--src/css.js2
-rw-r--r--src/css/addGetHookIf.js11
-rw-r--r--src/offset.js2
3 files changed, 7 insertions, 8 deletions
diff --git a/src/css.js b/src/css.js
index 4e80b3216..79ab342d5 100644
--- a/src/css.js
+++ b/src/css.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
diff --git a/src/css/addGetHookIf.js b/src/css/addGetHookIf.js
index f1ec002b3..214af953a 100644
--- a/src/css/addGetHookIf.js
+++ b/src/css/addGetHookIf.js
@@ -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 );
}
};
}
diff --git a/src/offset.js b/src/offset.js
index ee46717fd..9809d1079 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -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 );