code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function objectToString(o) {
return Object.prototype.toString.call(o);
} | Echos the value of a value. Trys to print the value out
in the best way possible given the different types.
@param {Object} obj The object to print out.
@param {Boolean} showHidden Flag that shows hidden (not enumerable)
properties of objects.
@param {Number} depth Depth in which to descend in object. Default is 2.
@param {Boolean} colors Flag to turn on ANSI escape codes to color the
output. Default is false (no coloring). | objectToString | javascript | dobtco/formbuilder | test/vendor/js/chai.js | https://github.com/dobtco/formbuilder/blob/master/test/vendor/js/chai.js | MIT |
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
} | Mark a function for special use by Sizzle
@param {Function} fn The function to mark | markFunction | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
} | Support testing using an element
@param {Function} fn Passed the created div and expects a boolean result | assert | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = attrs.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
} | Adds the same handler for all of the specified attrs
@param {String} attrs Pipe-separated list of attributes
@param {Function} handler The method that will be applied | addHandle | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
} | Checks document order of two siblings
@param {Element} a
@param {Element} b
@returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b | siblingCheck | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
} | Returns a function to use in pseudos for input types
@param {String} type | createInputPseudo | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
} | Returns a function to use in pseudos for buttons
@param {String} type | createButtonPseudo | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
} | Returns a function to use in pseudos for positionals
@param {Function} fn | createPositionalPseudo | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | tokenize | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | toSelector | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var data, cache, outerCache,
dirkey = dirruns + " " + doneName;
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
if ( (data = cache[1]) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
cache[1] = matcher( elem, context, xml ) || cachedruns;
if ( cache[1] === true ) {
return true;
}
}
}
}
}
};
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | addCombinator | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | elementMatcher | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | condense | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | setMatcher | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | matcherFromTokens | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | matcherFromGroupMatchers | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = matcherCachedRuns;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++matcherCachedRuns;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | superMatcher | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | multipleContexts | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && context.parentNode || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector )
);
return results;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | select | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | createOptions | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | fire | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | updateFunc | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function Data() {
// Support: Android < 4,
// Old WebKit does not have Object.preventExtensions/freeze method,
// return new empty object instead with no [[set]] accessor
Object.defineProperty( this.cache = {}, 0, {
get: function() {
return {};
}
});
this.expando = jQuery.expando + Math.random();
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | Data | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function dataAttr( elem, key, data ) {
var name;
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? JSON.parse( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
data_user.set( elem, key, data );
} else {
data = undefined;
}
}
return data;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | dataAttr | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
next = function() {
jQuery.dequeue( elem, type );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | next | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | resolve | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function returnTrue() {
return true;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | returnTrue | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function returnFalse() {
return false;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | returnFalse | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | safeActiveElement | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | handler | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function sibling( cur, dir ) {
while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
return cur;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | sibling | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not;
});
}
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
});
}
if ( typeof qualifier === "string" ) {
if ( isSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( core_indexOf.call( qualifier, elem ) >= 0 ) !== not;
});
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | winnow | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | manipulationTarget | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function disableScript( elem ) {
elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
return elem;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | disableScript | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[ 1 ];
} else {
elem.removeAttribute("type");
}
return elem;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | restoreScript | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function setGlobalEval( elems, refElements ) {
var l = elems.length,
i = 0;
for ( ; i < l; i++ ) {
data_priv.set(
elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
);
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | setGlobalEval | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function cloneCopyEvent( src, dest ) {
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
if ( dest.nodeType !== 1 ) {
return;
}
// 1. Copy private data: events, handlers, etc.
if ( data_priv.hasData( src ) ) {
pdataOld = data_priv.access( src );
pdataCur = data_priv.set( dest, pdataOld );
events = pdataOld.events;
if ( events ) {
delete pdataCur.handle;
pdataCur.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
}
// 2. Copy user data
if ( data_user.hasData( src ) ) {
udataOld = data_user.access( src );
udataCur = jQuery.extend( {}, udataOld );
data_user.set( dest, udataCur );
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | cloneCopyEvent | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function getAll( context, tag ) {
var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
[];
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], ret ) :
ret;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | getAll | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function fixInput( src, dest ) {
var nodeName = dest.nodeName.toLowerCase();
// Fails to persist the checked state of a cloned checkbox or radio button.
if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
dest.checked = src.checked;
// Fails to return the selected option to the default selected state when cloning options
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | fixInput | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | vendorPropName | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function isHidden( elem, el ) {
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | isHidden | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function getStyles( elem ) {
return window.getComputedStyle( elem, null );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | getStyles | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function showHide( elements, show ) {
var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = data_priv.get( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = data_priv.access( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
if ( !values[ index ] ) {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") );
}
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | showHide | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | setPositiveNumber | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | augmentWidthOrHeight | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | getWidthOrHeight | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function css_defaultDisplay( nodeName ) {
var doc = document,
display = elemdisplay[ nodeName ];
if ( !display ) {
display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
// Use the already-created iframe if possible
iframe = ( iframe ||
jQuery("<iframe frameborder='0' width='0' height='0'/>")
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
doc.write("<!doctype html><html><body>");
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | css_defaultDisplay | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
display = jQuery.css( elem[0], "display" );
elem.remove();
return display;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | actualDisplay | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | add | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | buildParams | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType[0] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | addToPrefiltersOrTransports | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | inspectPrefiltersOrTransports | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
});
return selected;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | inspect | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | ajaxExtend | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader("etag");
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger("ajaxStop");
}
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | done | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function ajaxHandleResponses( s, jqXHR, responses ) {
var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | ajaxHandleResponses | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s[ "throws" ] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
}
}
return { state: "success", data: response };
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | ajaxConvert | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | createFxNow | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function createTween( value, prop, animation ) {
var tween,
collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( (tween = collection[ index ].call( animation, prop, value )) ) {
// we're done with this property
return tween;
}
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | createTween | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | Animation | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | tick | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | propFilter | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
dataShow = data_priv.get( elem, "fxshow" );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE9-10 do not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
style.display = "inline-block";
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
anim.always(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
// show/hide pass
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.exec( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
hidden = true;
} else {
continue;
}
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
}
}
if ( !jQuery.isEmptyObject( orig ) ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = data_priv.access( elem, "fxshow", {} );
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
data_priv.remove( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( prop in orig ) {
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | defaultPrefilter | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | Tween | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || data_priv.get( this, "finish" ) ) {
anim.stop( true );
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | doAnimation | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | stopQueue | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | genFx | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function getWindow( elem ) {
return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | getWindow | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function focusable( element, isTabIndexNotNaN ) {
var map, mapName, img,
nodeName = element.nodeName.toLowerCase();
if ( "area" === nodeName ) {
map = element.parentNode;
mapName = map.name;
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
return false;
}
img = $( "img[usemap=#" + mapName + "]" )[0];
return !!img && visible( img );
}
return ( /input|select|textarea|button|object/.test( nodeName ) ?
!element.disabled :
"a" === nodeName ?
element.href || isTabIndexNotNaN :
isTabIndexNotNaN) &&
// the element and all of its ancestors must be visible
visible( element );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | focusable | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function visible( element ) {
return $.expr.filters.visible( element ) &&
!$( element ).parents().addBack().filter(function() {
return $.css( this, "visibility" ) === "hidden";
}).length;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | visible | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function reduce( elem, size, border, margin ) {
$.each( side, function() {
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
if ( border ) {
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
}
if ( margin ) {
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
}
});
return size;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | reduce | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
_super = function() {
return base.prototype[ prop ].apply( this, arguments );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | _super | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
_superApply = function( args ) {
return base.prototype[ prop ].apply( this, args );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | _superApply | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
if ( !suppressDisabledCheck &&
( instance.options.disabled === true ||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | handlerProxy | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function handlerProxy() {
return ( typeof handler === "string" ? instance[ handler ] : handler )
.apply( instance, arguments );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | handlerProxy | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function isOverAxis( x, reference, size ) {
return ( x > reference ) && ( x < ( reference + size ) );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | isOverAxis | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function isOverAxis( x, reference, size ) {
return ( x > reference ) && ( x < ( reference + size ) );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | isOverAxis | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function isFloating(item) {
return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | isFloating | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function addItems() {
items.push( this );
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | addItems | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function delayEvent( type, instance, container ) {
return function( event ) {
container._trigger( type, event, instance._uiHash( instance ) );
};
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | delayEvent | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function Binding(view, el, type, key, keypath, options) {
var identifier, regexp, value, _ref;
this.view = view;
this.el = el;
this.type = type;
this.key = key;
this.keypath = keypath;
this.options = options != null ? options : {};
this.update = __bind(this.update, this);
this.unbind = __bind(this.unbind, this);
this.bind = __bind(this.bind, this);
this.publish = __bind(this.publish, this);
this.sync = __bind(this.sync, this);
this.set = __bind(this.set, this);
this.eventHandler = __bind(this.eventHandler, this);
this.formattedValue = __bind(this.formattedValue, this);
if (!(this.binder = this.view.binders[type])) {
_ref = this.view.binders;
for (identifier in _ref) {
value = _ref[identifier];
if (identifier !== '*' && identifier.indexOf('*') !== -1) {
regexp = new RegExp("^" + (identifier.replace('*', '.+')) + "$");
if (regexp.test(type)) {
this.binder = value;
this.args = new RegExp("^" + (identifier.replace('*', '(.+)')) + "$").exec(type);
this.args.shift();
}
}
}
}
this.binder || (this.binder = this.view.binders['*']);
if (this.binder instanceof Function) {
this.binder = {
routine: this.binder
};
}
this.formatters = this.options.formatters || [];
this.model = this.key ? this.view.models[this.key] : this.view.models;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | Binding | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function ComponentBinding(view, el, type) {
var attribute, _i, _len, _ref, _ref1;
this.view = view;
this.el = el;
this.type = type;
this.unbind = __bind(this.unbind, this);
this.bind = __bind(this.bind, this);
this.update = __bind(this.update, this);
this.locals = __bind(this.locals, this);
this.component = Rivets.components[this.type];
this.attributes = {};
this.inflections = {};
_ref = this.el.attributes || [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
attribute = _ref[_i];
if (_ref1 = attribute.name, __indexOf.call(this.component.attributes, _ref1) >= 0) {
this.attributes[attribute.name] = attribute.value;
} else {
this.inflections[attribute.name] = attribute.value;
}
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | ComponentBinding | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function TextBinding(view, el, type, key, keypath, options) {
this.view = view;
this.el = el;
this.type = type;
this.key = key;
this.keypath = keypath;
this.options = options != null ? options : {};
this.sync = __bind(this.sync, this);
this.formatters = this.options.formatters || [];
this.model = this.key ? this.view.models[this.key] : this.view.models;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | TextBinding | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function View(els, models, options) {
var k, option, v, _base, _i, _len, _ref, _ref1, _ref2;
this.els = els;
this.models = models;
this.options = options != null ? options : {};
this.update = __bind(this.update, this);
this.publish = __bind(this.publish, this);
this.sync = __bind(this.sync, this);
this.unbind = __bind(this.unbind, this);
this.bind = __bind(this.bind, this);
this.select = __bind(this.select, this);
this.build = __bind(this.build, this);
this.componentRegExp = __bind(this.componentRegExp, this);
this.bindingRegExp = __bind(this.bindingRegExp, this);
if (typeof this.els.length === 'undefined') {
this.els = [this.els];
}
_ref = ['config', 'binders', 'formatters'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
option = _ref[_i];
this[option] = {};
if (this.options[option]) {
_ref1 = this.options[option];
for (k in _ref1) {
v = _ref1[k];
this[option][k] = v;
}
}
_ref2 = Rivets[option];
for (k in _ref2) {
v = _ref2[k];
if ((_base = this[option])[k] == null) {
_base[k] = v;
}
}
}
this.build();
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | View | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
eventsApi = function(obj, action, name, rest) {
if (!name) return true;
// Handle event maps.
if (typeof name === 'object') {
for (var key in name) {
obj[action].apply(obj, [key, name[key]].concat(rest));
}
return false;
}
// Handle space separated event names.
if (eventSplitter.test(name)) {
var names = name.split(eventSplitter);
for (var i = 0, l = names.length; i < l; i++) {
obj[action].apply(obj, [names[i]].concat(rest));
}
return false;
}
return true;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | eventsApi | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
triggerEvents = function(events, args) {
var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
switch (args.length) {
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
}
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | triggerEvents | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
destroy = function() {
model.trigger('destroy', model, model.collection, options);
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | destroy | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
extend = function(protoProps, staticProps) {
var parent = this;
var child;
// The constructor function for the new subclass is either defined by you
// (the "constructor" property in your `extend` definition), or defaulted
// by us to simply call the parent's constructor.
if (protoProps && _.has(protoProps, 'constructor')) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
// Add static properties to the constructor function, if supplied.
_.extend(child, parent, staticProps);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
// Add prototype properties (instance properties) to the subclass,
// if supplied.
if (protoProps) _.extend(child.prototype, protoProps);
// Set a convenience property in case the parent's prototype is needed
// later.
child.__super__ = parent.prototype;
return child;
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | extend | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
urlError = function() {
throw new Error('A "url" property or function must be specified');
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | urlError | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
wrapError = function(model, options) {
var error = options.error;
options.error = function(resp) {
if (error) error(model, resp, options);
model.trigger('error', model, resp, options);
};
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | wrapError | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function objToPaths(obj) {
var ret = {},
separator = DeepModel.keyPathSeparator;
for (var key in obj) {
var val = obj[key];
if (val && val.constructor === Object && !_.isEmpty(val)) {
//Recursion for embedded objects
var obj2 = objToPaths(val);
for (var key2 in obj2) {
var val2 = obj2[key2];
ret[key + separator + key2] = val2;
}
} else {
ret[key] = val;
}
}
return ret;
} | Takes a nested object and returns a shallow object keyed with the path names
e.g. { "level1.level2": "value" }
@param {Object} Nested object e.g. { level1: { level2: 'value' } }
@return {Object} Shallow object with path names e.g. { 'level1.level2': 'value' } | objToPaths | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function getNested(obj, path, return_exists) {
var separator = DeepModel.keyPathSeparator;
var fields = path.split(separator);
var result = obj;
return_exists || (return_exists === false);
for (var i = 0, n = fields.length; i < n; i++) {
if (return_exists && !_.has(result, fields[i])) {
return false;
}
result = result[fields[i]];
if (result == null && i < n - 1) {
result = {};
}
if (typeof result === 'undefined') {
if (return_exists)
{
return true;
}
return result;
}
}
if (return_exists)
{
return true;
}
return result;
} | @param {Object} Object to fetch attribute from
@param {String} Object path e.g. 'user.name'
@return {Mixed} | getNested | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function setNested(obj, path, val, options) {
options = options || {};
var separator = DeepModel.keyPathSeparator;
var fields = path.split(separator);
var result = obj;
for (var i = 0, n = fields.length; i < n && result !== undefined ; i++) {
var field = fields[i];
//If the last in the path, set the value
if (i === n - 1) {
options.unset ? delete result[field] : result[field] = val;
} else {
//Create the child object if it doesn't exist, or isn't an object
if (typeof result[field] === 'undefined' || ! _.isObject(result[field])) {
result[field] = {};
}
//Move onto the next part of the path
result = result[field];
}
}
} | @param {Object} obj Object to fetch attribute from
@param {String} path Object path e.g. 'user.name'
@param {Object} [options] Options
@param {Boolean} [options.unset] Whether to delete the value
@param {Mixed} Value to set | setNested | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
function deleteNested(obj, path) {
setNested(obj, path, null, { unset: true });
} | @param {Object} obj Object to fetch attribute from
@param {String} path Object path e.g. 'user.name'
@param {Object} [options] Options
@param {Boolean} [options.unset] Whether to delete the value
@param {Mixed} Value to set | deleteNested | javascript | dobtco/formbuilder | vendor/js/vendor.js | https://github.com/dobtco/formbuilder/blob/master/vendor/js/vendor.js | MIT |
filterFn = function(fn) {
return fn.type === event;
} | mui delegate events
@param {type} event
@param {type} selector
@param {type} callback
@returns {undefined} | filterFn | javascript | dcloudio/mui | dist/js/mui.js | https://github.com/dcloudio/mui/blob/master/dist/js/mui.js | MIT |
function update(fn) {
return function(value) {
var classes = self.className.split(/\s+/),
index = classes.indexOf(value);
fn(classes, index, value);
self.className = classes.join(" ");
};
} | mui fixed classList
@param {type} document
@returns {undefined} | update | javascript | dcloudio/mui | dist/js/mui.js | https://github.com/dcloudio/mui/blob/master/dist/js/mui.js | MIT |
getDistance = function(p1, p2, props) {
if(!props) {
props = ['x', 'y'];
}
var x = p2[props[0]] - p1[props[0]];
var y = p2[props[1]] - p1[props[1]];
return sqrt((x * x) + (y * y));
} | angle
@param {type} p1
@param {type} p2
@returns {Number} | getDistance | javascript | dcloudio/mui | dist/js/mui.js | https://github.com/dcloudio/mui/blob/master/dist/js/mui.js | MIT |
getAngle = function(p1, p2, props) {
if(!props) {
props = ['x', 'y'];
}
var x = p2[props[0]] - p1[props[0]];
var y = p2[props[1]] - p1[props[1]];
return atan2(y, x) * 180 / Math.PI;
} | rotation
@param {Object} start
@param {Object} end | getAngle | javascript | dcloudio/mui | dist/js/mui.js | https://github.com/dcloudio/mui/blob/master/dist/js/mui.js | MIT |
getDirection = function(x, y) {
if(x === y) {
return '';
}
if(abs(x) >= abs(y)) {
return x > 0 ? 'left' : 'right';
}
return y > 0 ? 'up' : 'down';
} | detect gestures
@param {type} event
@param {type} touch
@returns {undefined} | getDirection | javascript | dcloudio/mui | dist/js/mui.js | https://github.com/dcloudio/mui/blob/master/dist/js/mui.js | MIT |
getRotation = function(start, end) {
var props = ['pageX', 'pageY'];
return getAngle(end[1], end[0], props) - getAngle(start[1], start[0], props);
} | detect gestures
@param {type} event
@param {type} touch
@returns {undefined} | getRotation | javascript | dcloudio/mui | dist/js/mui.js | https://github.com/dcloudio/mui/blob/master/dist/js/mui.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.