| 5522 | |
| 5523 | |
| 5524 | function addGetHookIf( conditionFn, hookFn ) { |
| 5525 | // Define the hook, we'll check on the first run if it's really needed. |
| 5526 | return { |
| 5527 | get: function() { |
| 5528 | if ( conditionFn() ) { |
| 5529 | // Hook not needed (or it's not possible to use it due to missing dependency), |
| 5530 | // remove it. |
| 5531 | // Since there are no other hooks for marginRight, remove the whole object. |
| 5532 | delete this.get; |
| 5533 | return; |
| 5534 | } |
| 5535 | |
| 5536 | // Hook needed; redefine it so that the support test is not executed again. |
| 5537 | |
| 5538 | return (this.get = hookFn).apply( this, arguments ); |
| 5539 | } |
| 5540 | }; |
| 5541 | } |
| 5542 | |
| 5543 | |
| 5544 | (function() { |