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 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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function testContext( context ) {
return context && typeof context.getElementsByTagName !== strundefined && context;
} | Checks a node for validity as a Sizzle context
@param {Element|Object=} context
@returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value | testContext | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 oldCache, outerCache,
newCache = [ 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 ( (oldCache = outerCache[ dir ]) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[ 2 ] = oldCache[ 2 ]);
} else {
// Reuse newcache so results back-propagate to previous elements
outerCache[ dir ] = newCache;
// A match means we're done; a fail means we have to keep checking
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
return true;
}
}
}
}
}
};
} | Utility function for retrieving the text value of an array of DOM nodes
@param {Array|Element} elem | addCombinator | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context !== document && context;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (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;
}
}
// 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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context !== document && context;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (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;
}
}
// 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 | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 ( risSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
qualifier = jQuery.filter( qualifier, elements );
}
return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
});
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | winnow | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | sibling | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
});
return object;
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | createOptions | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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();
}
}
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | fire | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !(--remaining) ) {
deferred.resolveWith( contexts, values );
}
};
} | A low-level selection function that works with Sizzle's compiled
selector functions
@param {String|Function} selector A selector or a pre-compiled
selector function built with Sizzle.compile
@param {Element} context
@param {Array} [results]
@param {Array} [seed] A set of elements to match against | updateFunc | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function detach() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, false );
window.removeEventListener( "load", completed, false );
} else {
document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed );
}
} | Clean-up method for dom ready events | detach | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function completed() {
// readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
detach();
jQuery.ready();
}
} | The ready event handler and self cleanup method | completed | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var 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 ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
} | Determines whether an object can have data | dataAttr | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
} | Determines whether an object can have data | isEmptyDataObject | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var ret, thisCache,
internalKey = jQuery.expando,
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( typeof name === "string" ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
} | Determines whether an object can have data | internalData | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
} else {
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786
// This will only penalize the array argument path.
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
}
i = name.length;
while ( i-- ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmptyObject(thisCache) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */
} else if ( support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
} | Determines whether an object can have data | internalRemoveData | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
next = function() {
jQuery.dequeue( elem, type );
} | Determines whether an object can have data | next | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
} | Determines whether an object can have data | resolve | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
isHidden = function( 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 );
} | Determines whether an object can have data | isHidden | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function returnTrue() {
return true;
} | Determines whether an object can have data | returnTrue | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function returnFalse() {
return false;
} | Determines whether an object can have data | returnFalse | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
} | Determines whether an object can have data | safeActiveElement | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
} | Determines whether an object can have data | handler | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
} | Determines whether an object can have data | createSafeFragment | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
} | Determines whether an object can have data | getAll | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
} | Determines whether an object can have data | fixDefaultChecked | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] ||
elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
elem;
} | Determines whether an object can have data | manipulationTarget | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function disableScript( elem ) {
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type;
return elem;
} | Determines whether an object can have data | disableScript | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[1];
} else {
elem.removeAttribute("type");
}
return elem;
} | Determines whether an object can have data | restoreScript | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
}
} | Determines whether an object can have data | setGlobalEval | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
} | Determines whether an object can have data | cloneCopyEvent | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function fixCloneNodeIssues( src, dest ) {
var nodeName, e, data;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 copies events bound via attachEvent when using cloneNode.
if ( !support.noCloneEvent && dest[ jQuery.expando ] ) {
data = jQuery._data( dest );
for ( e in data.events ) {
jQuery.removeEvent( dest, e, data.handle );
}
// Event data gets referenced instead of copied if the expando gets copied too
dest.removeAttribute( jQuery.expando );
}
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
if ( nodeName === "script" && dest.text !== src.text ) {
disableScript( dest ).text = src.text;
restoreScript( dest );
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) {
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
} | Determines whether an object can have data | fixCloneNodeIssues | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function actualDisplay( name, doc ) {
var style,
elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
// getDefaultComputedStyle might be reliably used only on attached element
display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
// Use of this method is a temporary fix (more like optmization) until something better comes along,
// since it was removed from specification and supported only in FF
style.display : jQuery.css( elem[ 0 ], "display" );
// We don't have any data stored on the element,
// so use "detach" method as fast way to get rid of the element
elem.detach();
return display;
} | Retrieve the actual display of a element
@param {String} name nodeName of the element
@param {Object} doc Document object | actualDisplay | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function 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'/>" )).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;
// Support: IE
doc.write();
doc.close();
display = actualDisplay( nodeName, doc );
iframe.detach();
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return display;
} | Try to determine the default display value of an element
@param {String} nodeName | defaultDisplay | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function addGetHookIf( conditionFn, hookFn ) {
// Define the hook, we'll check on the first run if it's really needed.
return {
get: function() {
var condition = conditionFn();
if ( condition == null ) {
// The test was not ready at this point; screw the hook this time
// but check again when needed next time.
return;
}
if ( condition ) {
// 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 this.get;
return;
}
// Hook needed; redefine it so that the support test is not executed again.
return (this.get = hookFn).apply( this, arguments );
}
};
} | Try to determine the default display value of an element
@param {String} nodeName | addGetHookIf | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function computeStyleTests() {
// Minified: var b,c,d,j
var div, body, container, contents;
body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) {
// Test fired too early or in an unsupported environment, exit.
return;
}
// Setup
div = document.createElement( "div" );
container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px";
body.appendChild( container ).appendChild( div );
div.style.cssText =
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
"border:1px;padding:1px;width:4px;position:absolute";
// Support: IE<9
// Assume reasonable values in the absence of getComputedStyle
pixelPositionVal = boxSizingReliableVal = false;
reliableMarginRightVal = true;
// Check for getComputedStyle so that this code is not run in IE<9.
if ( window.getComputedStyle ) {
pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
boxSizingReliableVal =
( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Support: Android 2.3
// Div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container (#3333)
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
contents = div.appendChild( document.createElement( "div" ) );
// Reset CSS: box-sizing; display; margin; border; padding
contents.style.cssText = div.style.cssText =
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
contents.style.marginRight = contents.style.width = "0";
div.style.width = "1px";
reliableMarginRightVal =
!parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight );
}
// Support: IE8
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
contents = div.getElementsByTagName( "td" );
contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
if ( reliableHiddenOffsetsVal ) {
contents[ 0 ].style.display = "";
contents[ 1 ].style.display = "none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0;
}
body.removeChild( container );
} | Try to determine the default display value of an element
@param {String} nodeName | computeStyleTests | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
} | Try to determine the default display value of an element
@param {String} nodeName | vendorPropName | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 ] = jQuery._data( 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 ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
}
} else {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
jQuery._data( 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;
} | Try to determine the default display value of an element
@param {String} nodeName | showHide | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
} | Try to determine the default display value of an element
@param {String} nodeName | setPositiveNumber | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
} | Try to determine the default display value of an element
@param {String} nodeName | augmentWidthOrHeight | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 = 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 && ( 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";
} | Try to determine the default display value of an element
@param {String} nodeName | getWidthOrHeight | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
} | Try to determine the default display value of an element
@param {String} nodeName | Tween | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
});
return ( fxNow = jQuery.now() );
} | Try to determine the default display value of an element
@param {String} nodeName | createFxNow | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
} | Try to determine the default display value of an element
@param {String} nodeName | genFx | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
}
}
} | Try to determine the default display value of an element
@param {String} nodeName | createTween | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHidden( elem ),
dataShow = jQuery._data( 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 IE does 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
display = jQuery.css( elem, "display" );
// Test default display if display is currently "none"
checkDisplay = display === "none" ?
jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !support.shrinkWrapBlocks() ) {
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 );
// Any non-fx value stops us from restoring the original display value
} else {
display = undefined;
}
}
if ( !jQuery.isEmptyObject( orig ) ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = jQuery._data( 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;
jQuery._removeData( 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;
}
}
}
// If this is a noop like .hide().hide(), restore an overwritten display value
} else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
style.display = display;
}
} | Try to determine the default display value of an element
@param {String} nodeName | defaultPrefilter | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
}
}
} | Try to determine the default display value of an element
@param {String} nodeName | propFilter | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 );
} | Try to determine the default display value of an element
@param {String} nodeName | Animation | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
}
} | Try to determine the default display value of an element
@param {String} nodeName | tick | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 || jQuery._data( this, "finish" ) ) {
anim.stop( true );
}
} | Try to determine the default display value of an element
@param {String} nodeName | doAnimation | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
} | Try to determine the default display value of an element
@param {String} nodeName | stopQueue | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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( rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( (dataType = dataTypes[i++]) ) {
// Prepend if requested
if ( dataType.charAt( 0 ) === "+" ) {
dataType = dataType.slice( 1 ) || "*";
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
// Otherwise append
} else {
(structure[ dataType ] = structure[ dataType ] || []).push( func );
}
}
}
};
} | Try to determine the default display value of an element
@param {String} nodeName | addToPrefiltersOrTransports | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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( "*" );
} | Try to determine the default display value of an element
@param {String} nodeName | inspectPrefiltersOrTransports | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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;
} | Try to determine the default display value of an element
@param {String} nodeName | inspect | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function ajaxExtend( target, src ) {
var deep, key,
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;
} | Try to determine the default display value of an element
@param {String} nodeName | ajaxExtend | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function ajaxHandleResponses( s, jqXHR, responses ) {
var firstDataType, ct, finalDataType, type,
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 ];
}
} | Try to determine the default display value of an element
@param {String} nodeName | ajaxHandleResponses | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 };
} | Try to determine the default display value of an element
@param {String} nodeName | ajaxConvert | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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");
}
}
} | Try to determine the default display value of an element
@param {String} nodeName | done | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 );
}
} | Try to determine the default display value of an element
@param {String} nodeName | buildParams | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.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 );
} | Try to determine the default display value of an element
@param {String} nodeName | add | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
} | Try to determine the default display value of an element
@param {String} nodeName | createStandardXHR | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
} | Try to determine the default display value of an element
@param {String} nodeName | createActiveXHR | javascript | stitchfix/pyxley | docs/_build/html/_static/jquery-1.11.1.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/jquery-1.11.1.js | MIT |
function displayNextItem() {
// results left, load the summary and display it
if (results.length) {
var item = results.pop();
var listItem = $('<li style="display:none"></li>');
if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
// dirhtml builder
var dirname = item[0] + '/';
if (dirname.match(/\/index\/$/)) {
dirname = dirname.substring(0, dirname.length-6);
} else if (dirname == 'index/') {
dirname = '';
}
listItem.append($('<a/>').attr('href',
DOCUMENTATION_OPTIONS.URL_ROOT + dirname +
highlightstring + item[2]).html(item[1]));
} else {
// normal html builders
listItem.append($('<a/>').attr('href',
item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX +
highlightstring + item[2]).html(item[1]));
}
if (item[3]) {
listItem.append($('<span> (' + item[3] + ')</span>'));
Search.output.append(listItem);
listItem.slideDown(5, function() {
displayNextItem();
});
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[0] + '.txt',
dataType: "text",
complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText;
if (data !== '' && data !== undefined) {
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
}
Search.output.append(listItem);
listItem.slideDown(5, function() {
displayNextItem();
});
}});
} else {
// no source available, just display title
Search.output.append(listItem);
listItem.slideDown(5, function() {
displayNextItem();
});
}
}
// search finished, update title and status message
else {
Search.stopPulse();
Search.title.text(_('Search Results'));
if (!resultCount)
Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
else
Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
Search.status.fadeIn(500);
}
} | execute search (requires search index to be loaded) | displayNextItem | javascript | stitchfix/pyxley | docs/_build/html/_static/searchtools.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/searchtools.js | MIT |
function setComparator() {
// If the first three letters are "asc", sort in ascending order
// and remove the prefix.
if (by.substring(0,3) == 'asc') {
var i = by.substring(3);
comp = function(a, b) { return a[i] - b[i]; };
} else {
// Otherwise sort in descending order.
comp = function(a, b) { return b[by] - a[by]; };
}
// Reset link styles and format the selected sort option.
$('a.sel').attr('href', '#').removeClass('sel');
$('a.by' + by).removeAttr('href').addClass('sel');
} | Set comp, which is a comparator function used for sorting and
inserting comments into the list. | setComparator | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function initComparator() {
by = 'rating'; // Default to sort by rating.
// If the sortBy cookie is set, use that instead.
if (document.cookie.length > 0) {
var start = document.cookie.indexOf('sortBy=');
if (start != -1) {
start = start + 7;
var end = document.cookie.indexOf(";", start);
if (end == -1) {
end = document.cookie.length;
by = unescape(document.cookie.substring(start, end));
}
}
}
setComparator();
} | Create a comp function. If the user has preferences stored in
the sortBy cookie, use those, otherwise use the default. | initComparator | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function getComments(id) {
$.ajax({
type: 'GET',
url: opts.getCommentsURL,
data: {node: id},
success: function(data, textStatus, request) {
var ul = $('#cl' + id);
var speed = 100;
$('#cf' + id)
.find('textarea[name="proposal"]')
.data('source', data.source);
if (data.comments.length === 0) {
ul.html('<li>No comments yet.</li>');
ul.data('empty', true);
} else {
// If there are comments, sort them and put them in the list.
var comments = sortComments(data.comments);
speed = data.comments.length * 100;
appendComments(comments, ul);
ul.data('empty', false);
}
$('#cn' + id).slideUp(speed + 200);
ul.slideDown(speed);
},
error: function(request, textStatus, error) {
showError('Oops, there was a problem retrieving the comments.');
},
dataType: 'json'
});
} | Perform an ajax request to get comments for a node
and insert the comments into the comments tree. | getComments | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function addComment(form) {
var node_id = form.find('input[name="node"]').val();
var parent_id = form.find('input[name="parent"]').val();
var text = form.find('textarea[name="comment"]').val();
var proposal = form.find('textarea[name="proposal"]').val();
if (text == '') {
showError('Please enter a comment.');
return;
}
// Disable the form that is being submitted.
form.find('textarea,input').attr('disabled', 'disabled');
// Send the comment to the server.
$.ajax({
type: "POST",
url: opts.addCommentURL,
dataType: 'json',
data: {
node: node_id,
parent: parent_id,
text: text,
proposal: proposal
},
success: function(data, textStatus, error) {
// Reset the form.
if (node_id) {
hideProposeChange(node_id);
}
form.find('textarea')
.val('')
.add(form.find('input'))
.removeAttr('disabled');
var ul = $('#cl' + (node_id || parent_id));
if (ul.data('empty')) {
$(ul).empty();
ul.data('empty', false);
}
insertComment(data.comment);
var ao = $('#ao' + node_id);
ao.find('img').attr({'src': opts.commentBrightImage});
if (node_id) {
// if this was a "root" comment, remove the commenting box
// (the user can get it back by reopening the comment popup)
$('#ca' + node_id).slideUp();
}
},
error: function(request, textStatus, error) {
form.find('textarea,input').removeAttr('disabled');
showError('Oops, there was a problem adding the comment.');
}
});
} | Add a comment via ajax and insert the comment into the comment tree. | addComment | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function appendComments(comments, ul) {
$.each(comments, function() {
var div = createCommentDiv(this);
ul.append($(document.createElement('li')).html(div));
appendComments(this.children, div.find('ul.comment-children'));
// To avoid stagnating data, don't store the comments children in data.
this.children = null;
div.data('comment', this);
});
} | Recursively append comments to the main comment list and children
lists, creating the comment tree. | appendComments | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function insertComment(comment) {
var div = createCommentDiv(comment);
// To avoid stagnating data, don't store the comments children in data.
comment.children = null;
div.data('comment', comment);
var ul = $('#cl' + (comment.node || comment.parent));
var siblings = getChildren(ul);
var li = $(document.createElement('li'));
li.hide();
// Determine where in the parents children list to insert this comment.
for(i=0; i < siblings.length; i++) {
if (comp(comment, siblings[i]) <= 0) {
$('#cd' + siblings[i].id)
.parent()
.before(li.html(div));
li.slideDown('fast');
return;
}
}
// If we get here, this comment rates lower than all the others,
// or it is the only comment in the list.
ul.append(li.html(div));
li.slideDown('fast');
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | insertComment | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function acceptComment(id) {
$.ajax({
type: 'POST',
url: opts.acceptCommentURL,
data: {id: id},
success: function(data, textStatus, request) {
$('#cm' + id).fadeOut('fast');
$('#cd' + id).removeClass('moderate');
},
error: function(request, textStatus, error) {
showError('Oops, there was a problem accepting the comment.');
}
});
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | acceptComment | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function deleteComment(id) {
$.ajax({
type: 'POST',
url: opts.deleteCommentURL,
data: {id: id},
success: function(data, textStatus, request) {
var div = $('#cd' + id);
if (data == 'delete') {
// Moderator mode: remove the comment and all children immediately
div.slideUp('fast', function() {
div.remove();
});
return;
}
// User mode: only mark the comment as deleted
div
.find('span.user-id:first')
.text('[deleted]').end()
.find('div.comment-text:first')
.text('[deleted]').end()
.find('#cm' + id + ', #dc' + id + ', #ac' + id + ', #rc' + id +
', #sp' + id + ', #hp' + id + ', #cr' + id + ', #rl' + id)
.remove();
var comment = div.data('comment');
comment.username = '[deleted]';
comment.text = '[deleted]';
div.data('comment', comment);
},
error: function(request, textStatus, error) {
showError('Oops, there was a problem deleting the comment.');
}
});
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | deleteComment | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function showProposal(id) {
$('#sp' + id).hide();
$('#hp' + id).show();
$('#pr' + id).slideDown('fast');
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | showProposal | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function hideProposal(id) {
$('#hp' + id).hide();
$('#sp' + id).show();
$('#pr' + id).slideUp('fast');
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | hideProposal | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function showProposeChange(id) {
$('#pc' + id).hide();
$('#hc' + id).show();
var textarea = $('#pt' + id);
textarea.val(textarea.data('source'));
$.fn.autogrow.resize(textarea[0]);
textarea.slideDown('fast');
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | showProposeChange | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function hideProposeChange(id) {
$('#hc' + id).hide();
$('#pc' + id).show();
var textarea = $('#pt' + id);
textarea.val('').removeAttr('disabled');
textarea.slideUp('fast');
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | hideProposeChange | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function toggleCommentMarkupBox(id) {
$('#mb' + id).toggle();
} | After adding a new comment, it must be inserted in the correct
location in the comment tree. | toggleCommentMarkupBox | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function handleReSort(link) {
var classes = link.attr('class').split(/\s+/);
for (var i=0; i<classes.length; i++) {
if (classes[i] != 'sort-option') {
by = classes[i].substring(2);
}
}
setComparator();
// Save/update the sortBy cookie.
var expiration = new Date();
expiration.setDate(expiration.getDate() + 365);
document.cookie= 'sortBy=' + escape(by) +
';expires=' + expiration.toUTCString();
$('ul.comment-ul').each(function(index, ul) {
var comments = getChildren($(ul), true);
comments = sortComments(comments);
appendComments(comments, $(ul).empty());
});
} | Handle when the user clicks on a sort by link. | handleReSort | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function handleVote(link) {
if (!opts.voting) {
showError("You'll need to login to vote.");
return;
}
var id = link.attr('id');
if (!id) {
// Didn't click on one of the voting arrows.
return;
}
// If it is an unvote, the new vote value is 0,
// Otherwise it's 1 for an upvote, or -1 for a downvote.
var value = 0;
if (id.charAt(1) != 'u') {
value = id.charAt(0) == 'u' ? 1 : -1;
}
// The data to be sent to the server.
var d = {
comment_id: id.substring(2),
value: value
};
// Swap the vote and unvote links.
link.hide();
$('#' + id.charAt(0) + (id.charAt(1) == 'u' ? 'v' : 'u') + d.comment_id)
.show();
// The div the comment is displayed in.
var div = $('div#cd' + d.comment_id);
var data = div.data('comment');
// If this is not an unvote, and the other vote arrow has
// already been pressed, unpress it.
if ((d.value !== 0) && (data.vote === d.value * -1)) {
$('#' + (d.value == 1 ? 'd' : 'u') + 'u' + d.comment_id).hide();
$('#' + (d.value == 1 ? 'd' : 'u') + 'v' + d.comment_id).show();
}
// Update the comments rating in the local data.
data.rating += (data.vote === 0) ? d.value : (d.value - data.vote);
data.vote = d.value;
div.data('comment', data);
// Change the rating text.
div.find('.rating:first')
.text(data.rating + ' point' + (data.rating == 1 ? '' : 's'));
// Send the vote information to the server.
$.ajax({
type: "POST",
url: opts.processVoteURL,
data: d,
error: function(request, textStatus, error) {
showError('Oops, there was a problem casting that vote.');
}
});
} | Function to process a vote when a user clicks an arrow. | handleVote | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function openReply(id) {
// Swap out the reply link for the hide link
$('#rl' + id).hide();
$('#cr' + id).show();
// Add the reply li to the children ul.
var div = $(renderTemplate(replyTemplate, {id: id})).hide();
$('#cl' + id)
.prepend(div)
// Setup the submit handler for the reply form.
.find('#rf' + id)
.submit(function(event) {
event.preventDefault();
addComment($('#rf' + id));
closeReply(id);
})
.find('input[type=button]')
.click(function() {
closeReply(id);
});
div.slideDown('fast', function() {
$('#rf' + id).find('textarea').focus();
});
} | Open a reply form used to reply to an existing comment. | openReply | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function closeReply(id) {
// Remove the reply div from the DOM.
$('#rd' + id).slideUp('fast', function() {
$(this).remove();
});
// Swap out the hide link for the reply link
$('#cr' + id).hide();
$('#rl' + id).show();
} | Close the reply form opened with openReply. | closeReply | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function sortComments(comments) {
comments.sort(comp);
$.each(comments, function() {
this.children = sortComments(this.children);
});
return comments;
} | Recursively sort a tree of comments using the comp comparator. | sortComments | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function getChildren(ul, recursive) {
var children = [];
ul.children().children("[id^='cd']")
.each(function() {
var comment = $(this).data('comment');
if (recursive)
comment.children = getChildren($(this).find('#cl' + comment.id), true);
children.push(comment);
});
return children;
} | Get the children comments from a ul. If recursive is true,
recursively include childrens' children. | getChildren | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function createCommentDiv(comment) {
if (!comment.displayed && !opts.moderator) {
return $('<div class="moderate">Thank you! Your comment will show up '
+ 'once it is has been approved by a moderator.</div>');
}
// Prettify the comment rating.
comment.pretty_rating = comment.rating + ' point' +
(comment.rating == 1 ? '' : 's');
// Make a class (for displaying not yet moderated comments differently)
comment.css_class = comment.displayed ? '' : ' moderate';
// Create a div for this comment.
var context = $.extend({}, opts, comment);
var div = $(renderTemplate(commentTemplate, context));
// If the user has voted on this comment, highlight the correct arrow.
if (comment.vote) {
var direction = (comment.vote == 1) ? 'u' : 'd';
div.find('#' + direction + 'v' + comment.id).hide();
div.find('#' + direction + 'u' + comment.id).show();
}
if (opts.moderator || comment.text != '[deleted]') {
div.find('a.reply').show();
if (comment.proposal_diff)
div.find('#sp' + comment.id).show();
if (opts.moderator && !comment.displayed)
div.find('#cm' + comment.id).show();
if (opts.moderator || (opts.username == comment.username))
div.find('#dc' + comment.id).show();
}
return div;
} | Create a div to display a comment in. | createCommentDiv | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function renderTemplate(template, context) {
var esc = $(document.createElement('div'));
function handle(ph, escape) {
var cur = context;
$.each(ph.split('.'), function() {
cur = cur[this];
});
return escape ? esc.text(cur || "").html() : cur;
}
return template.replace(/<([%#])([\w\.]*)\1>/g, function() {
return handle(arguments[2], arguments[1] == '%' ? true : false);
});
} | A simple template renderer. Placeholders such as <%id%> are replaced
by context['id'] with items being escaped. Placeholders such as <#id#>
are not escaped. | renderTemplate | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
function handle(ph, escape) {
var cur = context;
$.each(ph.split('.'), function() {
cur = cur[this];
});
return escape ? esc.text(cur || "").html() : cur;
} | A simple template renderer. Placeholders such as <%id%> are replaced
by context['id'] with items being escaped. Placeholders such as <#id#>
are not escaped. | handle | javascript | stitchfix/pyxley | docs/_build/html/_static/websupport.js | https://github.com/stitchfix/pyxley/blob/master/docs/_build/html/_static/websupport.js | MIT |
FixedColumns = function ( dt, init ) {
var that = this;
/* Sanity check - you just know it will happen */
if ( ! ( this instanceof FixedColumns ) )
{
alert( "FixedColumns warning: FixedColumns must be initialised with the 'new' keyword." );
return;
}
if ( typeof init == 'undefined' )
{
init = {};
}
// Use the DataTables Hungarian notation mapping method, if it exists to
// provide forwards compatibility for camel case variables
var camelToHungarian = $.fn.dataTable.camelToHungarian;
if ( camelToHungarian ) {
camelToHungarian( FixedColumns.defaults, FixedColumns.defaults, true );
camelToHungarian( FixedColumns.defaults, init );
}
// v1.10 allows the settings object to be got form a number of sources
var dtSettings = $.fn.dataTable.Api ?
new $.fn.dataTable.Api( dt ).settings()[0] :
dt.fnSettings();
/**
* Settings object which contains customisable information for FixedColumns instance
* @namespace
* @extends FixedColumns.defaults
* @private
*/
this.s = {
/**
* DataTables settings objects
* @type object
* @default Obtained from DataTables instance
*/
"dt": dtSettings,
/**
* Number of columns in the DataTable - stored for quick access
* @type int
* @default Obtained from DataTables instance
*/
"iTableColumns": dtSettings.aoColumns.length,
/**
* Original outer widths of the columns as rendered by DataTables - used to calculate
* the FixedColumns grid bounding box
* @type array.<int>
* @default []
*/
"aiOuterWidths": [],
/**
* Original inner widths of the columns as rendered by DataTables - used to apply widths
* to the columns
* @type array.<int>
* @default []
*/
"aiInnerWidths": []
};
/**
* DOM elements used by the class instance
* @namespace
* @private
*
*/
this.dom = {
/**
* DataTables scrolling element
* @type node
* @default null
*/
"scroller": null,
/**
* DataTables header table
* @type node
* @default null
*/
"header": null,
/**
* DataTables body table
* @type node
* @default null
*/
"body": null,
/**
* DataTables footer table
* @type node
* @default null
*/
"footer": null,
/**
* Display grid elements
* @namespace
*/
"grid": {
/**
* Grid wrapper. This is the container element for the 3x3 grid
* @type node
* @default null
*/
"wrapper": null,
/**
* DataTables scrolling element. This element is the DataTables
* component in the display grid (making up the main table - i.e.
* not the fixed columns).
* @type node
* @default null
*/
"dt": null,
/**
* Left fixed column grid components
* @namespace
*/
"left": {
"wrapper": null,
"head": null,
"body": null,
"foot": null
},
/**
* Right fixed column grid components
* @namespace
*/
"right": {
"wrapper": null,
"head": null,
"body": null,
"foot": null
}
},
/**
* Cloned table nodes
* @namespace
*/
"clone": {
/**
* Left column cloned table nodes
* @namespace
*/
"left": {
/**
* Cloned header table
* @type node
* @default null
*/
"header": null,
/**
* Cloned body table
* @type node
* @default null
*/
"body": null,
/**
* Cloned footer table
* @type node
* @default null
*/
"footer": null
},
/**
* Right column cloned table nodes
* @namespace
*/
"right": {
/**
* Cloned header table
* @type node
* @default null
*/
"header": null,
/**
* Cloned body table
* @type node
* @default null
*/
"body": null,
/**
* Cloned footer table
* @type node
* @default null
*/
"footer": null
}
}
};
/* Attach the instance to the DataTables instance so it can be accessed easily */
dtSettings._oFixedColumns = this;
/* Let's do it */
if ( ! dtSettings._bInitComplete )
{
dtSettings.oApi._fnCallbackReg( dtSettings, 'aoInitComplete', function () {
that._fnConstruct( init );
}, 'FixedColumns' );
}
else
{
this._fnConstruct( init );
}
} | When making use of DataTables' x-axis scrolling feature, you may wish to
fix the left most column in place. This plug-in for DataTables provides
exactly this option (note for non-scrolling tables, please use the
FixedHeader plug-in, which can fix headers, footers and columns). Key
features include:
* Freezes the left or right most columns to the side of the table
* Option to freeze two or more columns
* Full integration with DataTables' scrolling options
* Speed - FixedColumns is fast in its operation
@class
@constructor
@global
@param {object} dt DataTables instance. With DataTables 1.10 this can also
be a jQuery collection, a jQuery selector, DataTables API instance or
settings object.
@param {object} [init={}] Configuration object for FixedColumns. Options are
defined by {@link FixedColumns.defaults}
@requires jQuery 1.7+
@requires DataTables 1.8.0+
@example
var table = $('#example').dataTable( {
"scrollX": "100%"
} );
new $.fn.dataTable.fixedColumns( table ); | FixedColumns | javascript | stitchfix/pyxley | examples/datatables/project/static/dataTables.fixedColumns.js | https://github.com/stitchfix/pyxley/blob/master/examples/datatables/project/static/dataTables.fixedColumns.js | MIT |
scrollbarAdjust = function ( node, width ) {
if ( ! oOverflow.bar ) {
// If there is no scrollbar (Macs) we need to hide the auto scrollbar
node.style.width = (width+20)+"px";
node.style.paddingRight = "20px";
node.style.boxSizing = "border-box";
}
else {
// Otherwise just overflow by the scrollbar
node.style.width = (width+oOverflow.bar)+"px";
}
} | Style and position the grid used for the FixedColumns layout
@returns {void}
@private | scrollbarAdjust | javascript | stitchfix/pyxley | examples/datatables/project/static/dataTables.fixedColumns.js | https://github.com/stitchfix/pyxley/blob/master/examples/datatables/project/static/dataTables.fixedColumns.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 | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.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 | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = arr.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 | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.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 | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.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 | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.