xonecas.io
286
Sf

simple-flask-coffee-sass-boilerplate / files

simple-flask-coffee-sass-boilerplate / bower_components / jquery / src / css / addGetHookIf.js

590 bytes
1define(function() {
2
3function addGetHookIf( conditionFn, hookFn ) {
4	// Define the hook, we'll check on the first run if it's really needed.
5	return {
6		get: function() {
7			if ( conditionFn() ) {
8				// Hook not needed (or it's not possible to use it due to missing dependency),
9				// remove it.
10				// Since there are no other hooks for marginRight, remove the whole object.
11				delete this.get;
12				return;
13			}
14
15			// Hook needed; redefine it so that the support test is not executed again.
16
17			return (this.get = hookFn).apply( this, arguments );
18		}
19	};
20}
21
22return addGetHookIf;
23
24});