diff options
Diffstat (limited to 'src/css/addGetHookIf.js')
-rw-r--r-- | src/css/addGetHookIf.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/css/addGetHookIf.js b/src/css/addGetHookIf.js index e12f3598d..9cd21f683 100644 --- a/src/css/addGetHookIf.js +++ b/src/css/addGetHookIf.js @@ -1,10 +1,12 @@ -define(function() { +define( function() { function addGetHookIf( conditionFn, hookFn ) { + // Define the hook, we'll check on the first run if it's really needed. return { get: function() { if ( conditionFn() ) { + // Hook not needed (or it's not possible to use it due // to missing dependency), remove it. delete this.get; @@ -12,11 +14,11 @@ function addGetHookIf( conditionFn, hookFn ) { } // Hook needed; redefine it so that the support test is not executed again. - return (this.get = hookFn).apply( this, arguments ); + return ( this.get = hookFn ).apply( this, arguments ); } }; } return addGetHookIf; -}); +} ); |