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 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]); } } }); }); }
Sets document-related variables once based on the current document @param {Element|Object} [doc] An element or document object to use to set the document @returns {Object} Returns the current document
createPositionalPseudo
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push( { value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) } ); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push( { value: matched, type: type, matches: match } ); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
tokenize
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && combinator.dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var data, cache, outerCache, dirkey = dirruns + " " + doneName; // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { if ( (data = cache[1]) === true || data === cachedruns ) { return data === true; } } else { cache = outerCache[ dir ] = [ dirkey ]; cache[1] = matcher( elem, context, xml ) || cachedruns; if ( cache[1] === true ) { return true; } } } } } }; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
addCombinator
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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( tokens.slice( 0, i - 1 ) ).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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function matcherFromGroupMatchers( elementMatchers, setMatchers ) { // A counter to specify which element is currently being matched var matcherCachedRuns = 0, bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Nested matchers should use non-integer dirruns dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); if ( outermost ) { outermostContext = context !== document && context; cachedruns = matcherCachedRuns; } // Add elements passing elementMatchers directly to results for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { for ( j = 0; (matcher = elementMatchers[j]); j++ ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++matcherCachedRuns; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements // `i` starts as a string, so matchedCount would equal "00" if there are no elements matchedCount += i; if ( bySet && i !== matchedCount ) { for ( j = 0; (matcher = setMatchers[j]); 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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Nested matchers should use non-integer dirruns dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); if ( outermost ) { outermostContext = context !== document && context; cachedruns = matcherCachedRuns; } // Add elements passing elementMatchers directly to results for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { for ( j = 0; (matcher = elementMatchers[j]); j++ ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++matcherCachedRuns; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements // `i` starts as a string, so matchedCount would equal "00" if there are no elements matchedCount += i; if ( bySet && i !== matchedCount ) { for ( j = 0; (matcher = setMatchers[j]); 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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function select( selector, context, results, seed ) { var i, tokens, token, type, find, match = tokenize( selector ); if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !documentIsXML && Expr.relative[ tokens[1].type ] ) { context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching for ( i = matchExpr["needsContext"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && context.parentNode || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, slice.call( seed, 0 ) ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, documentIsXML, results, rsibling.test( selector ) ); return results; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
select
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
sibling
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
winnow
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
createSafeFragment
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function findOrAppend( elem, tag ) { return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
findOrAppend
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function disableScript( elem ) { var attr = elem.getAttributeNode("type"); elem.type = ( attr && attr.specified ) + "/" + elem.type; return elem; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
disableScript
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[1]; } else { elem.removeAttribute("type"); } return elem; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
restoreScript
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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" ) ); } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
setGlobalEval
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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 ); } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
cloneCopyEvent
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function fixCloneNodeIssues( src, dest ) { var nodeName, data, e; // 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 ( !jQuery.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 ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && manipulation_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; } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
fixCloneNodeIssues
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function getAll( context, tag ) { var elems, elem, i = 0, found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== "undefined" ? 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; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
getAll
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function fixDefaultChecked( elem ) { if ( manipulation_rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
fixDefaultChecked
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
vendorPropName
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function isHidden( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
isHidden
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function showHide( elements, show ) { var elem, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && elem.style.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", css_defaultDisplay(elem.nodeName) ); } } else if ( !values[ index ] && !isHidden( elem ) ) { jQuery._data( elem, "olddisplay", jQuery.css( elem, "display" ) ); } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
showHide
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? // Guard against undefined "subtract", e.g., when used as in cssHooks Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
setPositiveNumber
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); } if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } else { // at this point, extra isn't content, so add padding val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } } return val; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
augmentWidthOrHeight
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var valueIsBorderBox = true, val = name === "width" ? elem.offsetWidth : elem.offsetHeight, styles = getStyles( elem ), isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name, styles ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox, styles ) ) + "px"; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
getWidthOrHeight
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function css_defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = ( iframe || jQuery("<iframe frameborder='0' width='0' height='0'/>") .css( "cssText", "display:block !important" ) ).appendTo( doc.documentElement ); // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; doc.write("<!doctype html><html><body>"); doc.close(); display = actualDisplay( nodeName, doc ); iframe.detach(); } // Store the correct default display elemdisplay[ nodeName ] = display; } return display; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
css_defaultDisplay
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function actualDisplay( name, doc ) { var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), display = jQuery.css( elem[0], "display" ); elem.remove(); return display; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
actualDisplay
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
add
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // Item is non-scalar (array or object), encode its numeric index. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
buildParams
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( (dataType = dataTypes[i++]) ) { // Prepend if requested if ( dataType[0] === "+" ) { dataType = dataType.slice( 1 ) || "*"; (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); // Otherwise append } else { (structure[ dataType ] = structure[ dataType ] || []).push( func ); } } } }; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
addToPrefiltersOrTransports
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { var inspected = {}, seekingTransport = ( structure === transports ); function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } }); return selected; } return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
inspectPrefiltersOrTransports
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function inspect( dataType ) { var selected; inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; } else if ( seekingTransport ) { return !( selected = dataTypeOrTransport ); } }); return selected; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
inspect
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } return target; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
ajaxExtend
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // 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 not modified if ( status === 304 ) { isSuccess = true; statusText = "notmodified"; // If we have data } else { isSuccess = ajaxConvert( s, response ); statusText = isSuccess.state; success = isSuccess.data; error = isSuccess.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( status || !statusText ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger("ajaxStop"); } } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
done
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields; // Fill responseXXX fields for ( type in responseFields ) { if ( type in responses ) { jqXHR[ responseFields[type] ] = responses[ type ]; } } // Remove auto dataType and get content-type in the process while( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
ajaxHandleResponses
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function ajaxConvert( s, response ) { var conv, conv2, current, tmp, converters = {}, i = 0, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(), prev = dataTypes[ 0 ]; // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } // Convert to each sequential dataType, tolerating list modification for ( ; (current = dataTypes[++i]); ) { // There's only work to do if current dataType is non-auto if ( current !== "*" ) { // Convert response if prev dataType is non-auto and differs from current 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.splice( i--, 0, current ); } 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 }; } } } } // Update prev for next iteration prev = current; } } return { state: "success", data: response }; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
ajaxConvert
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
createStandardXHR
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function createActiveXHR() { try { return new window.ActiveXObject("Microsoft.XMLHTTP"); } catch( e ) {} }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
createActiveXHR
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function createFxNow() { setTimeout(function() { fxNow = undefined; }); return ( fxNow = jQuery.now() ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
createFxNow
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function createTweens( animation, props ) { jQuery.each( props, function( prop, value ) { var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( collection[ index ].call( animation, prop, value ) ) { // we're done with this property return; } } }); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
createTweens
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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; } } createTweens( animation, props ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { elem: elem, anim: animation, queue: animation.opts.queue }) ); // attach callbacks from options return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
Animation
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
tick = function() { if ( stopped ) { return false; } var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ]); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
tick
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // not quite $.extend, this wont overwrite keys already present. // also - reusing 'index' from above because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
propFilter
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function defaultPrefilter( elem, props, opts ) { /*jshint validthis:true */ var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, anim = this, style = elem.style, orig = {}, handled = [], hidden = elem.nodeType && isHidden( elem ); // 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 if ( jQuery.css( elem, "display" ) === "inline" && jQuery.css( elem, "float" ) === "none" ) { // inline-level elements accept inline-block; // block-level elements need to be inline with layout if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; } } } if ( opts.overflow ) { style.overflow = "hidden"; if ( !jQuery.support.shrinkWrapBlocks ) { anim.done(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; }); } } // show/hide pass for ( index in props ) { value = props[ index ]; if ( rfxtypes.exec( value ) ) { delete props[ index ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { continue; } handled.push( index ); } } length = handled.length; if ( length ) { dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); if ( "hidden" in dataShow ) { hidden = dataShow.hidden; } // 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 ( index = 0 ; index < length ; index++ ) { prop = handled[ index ]; tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
defaultPrefilter
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
Tween
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.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 ); doAnimation.finish = function() { anim.stop( true ); }; // Empty animations, or finishing resolves immediately if ( empty || jQuery._data( this, "finish" ) ) { anim.stop( true ); } }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
doAnimation
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
stopQueue
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth? 1 : 0; for( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
genFx
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; }
Utility function for retrieving the text value of an array of DOM nodes @param {Array|Element} elem
getWindow
javascript
yued-fe/lulu
theme/peak/js/plugin/jquery.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/jquery.js
MIT
function isType(type) { return function(obj) { return {}.toString.call(obj) == "[object " + type + "]" } }
util-lang.js - The minimal language enhancement
isType
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function cid() { return _cid++ }
util-lang.js - The minimal language enhancement
cid
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function dirname(path) { return path.match(DIRNAME_RE)[0] }
util-path.js - The utilities for operating path such as id, uri
dirname
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function realpath(path) { // /a/b/./c/./d ==> /a/b/c/d path = path.replace(DOT_RE, "/") /* @author wh1100717 a//b/c ==> a/b/c a///b/////c ==> a/b/c DOUBLE_DOT_RE matches a/b/c//../d path correctly only if replace // with / first */ path = path.replace(MULTI_SLASH_RE, "$1/") // a/b/c/../../d ==> a/b/../d ==> a/d while (path.match(DOUBLE_DOT_RE)) { path = path.replace(DOUBLE_DOT_RE, "/") } return path }
util-path.js - The utilities for operating path such as id, uri
realpath
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function normalize(path) { var last = path.length - 1 var lastC = path.charAt(last) // If the uri ends with `#`, just return it without '#' if (lastC === "#") { return path.substring(0, last) } return (path.substring(last - 2) === ".js" || path.indexOf("?") > 0 || lastC === "/") ? path : path + ".js" }
util-path.js - The utilities for operating path such as id, uri
normalize
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function parseAlias(id) { var alias = data.alias return alias && isString(alias[id]) ? alias[id] : id }
util-path.js - The utilities for operating path such as id, uri
parseAlias
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function parsePaths(id) { var paths = data.paths var m if (paths && (m = id.match(PATHS_RE)) && isString(paths[m[1]])) { id = paths[m[1]] + m[2] } return id }
util-path.js - The utilities for operating path such as id, uri
parsePaths
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function parseVars(id) { var vars = data.vars if (vars && id.indexOf("{") > -1) { id = id.replace(VARS_RE, function(m, key) { return isString(vars[key]) ? vars[key] : m }) } return id }
util-path.js - The utilities for operating path such as id, uri
parseVars
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function parseMap(uri) { var map = data.map var ret = uri if (map) { for (var i = 0, len = map.length; i < len; i++) { var rule = map[i] ret = isFunction(rule) ? (rule(uri) || uri) : uri.replace(rule[0], rule[1]) // Only apply the first matched rule if (ret !== uri) break } } return ret }
util-path.js - The utilities for operating path such as id, uri
parseMap
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function addBase(id, refUri) { var ret var first = id.charAt(0) // Absolute if (ABSOLUTE_RE.test(id)) { ret = id } // Relative else if (first === ".") { ret = realpath((refUri ? dirname(refUri) : data.cwd) + id) } // Root else if (first === "/") { var m = data.cwd.match(ROOT_DIR_RE) ret = m ? m[0] + id.substring(1) : id } // Top-level else { ret = data.base + id } // Add default protocol when uri begins with "//" if (ret.indexOf("//") === 0) { ret = location.protocol + ret } return ret }
util-path.js - The utilities for operating path such as id, uri
addBase
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function id2Uri(id, refUri) { if (!id) return "" id = parseAlias(id) id = parsePaths(id) id = parseVars(id) id = normalize(id) var uri = addBase(id, refUri) uri = parseMap(uri) return uri }
util-path.js - The utilities for operating path such as id, uri
id2Uri
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function getScriptAbsoluteSrc(node) { return node.hasAttribute ? // non-IE6/7 node.src : // see http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx node.getAttribute("src", 4) }
util-path.js - The utilities for operating path such as id, uri
getScriptAbsoluteSrc
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function request(url, callback, charset) { // console.log(url); var node = doc.createElement("script") if (charset) { var cs = isFunction(charset) ? charset(url) : charset if (cs) { node.charset = cs } } addOnload(node, callback, url) node.async = true node.src = url // For some cache cases in IE 6-8, the script executes IMMEDIATELY after // the end of the insert execution, so use `currentlyAddingScript` to // hold current node, for deriving url in `define` call currentlyAddingScript = node // ref: #185 & http://dev.jquery.com/ticket/2709 baseElement ? head.insertBefore(node, baseElement) : head.appendChild(node) currentlyAddingScript = null }
util-request.js - The utilities for requesting script and style files ref: tests/research/load-js-css/test.html
request
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function addOnload(node, callback, url) { var supportOnload = "onload" in node if (supportOnload) { node.onload = onload node.onerror = function() { emit("error", { uri: url, node: node }) onload() } } else { node.onreadystatechange = function() { if (/loaded|complete/.test(node.readyState)) { onload() } } } function onload() { // Ensure only run once and handle memory leak in IE node.onload = node.onerror = node.onreadystatechange = null // Remove the script to reduce memory leak if (!data.debug) { head.removeChild(node) } // Dereference the node node = null callback() } }
util-request.js - The utilities for requesting script and style files ref: tests/research/load-js-css/test.html
addOnload
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function onload() { // Ensure only run once and handle memory leak in IE node.onload = node.onerror = node.onreadystatechange = null // Remove the script to reduce memory leak if (!data.debug) { head.removeChild(node) } // Dereference the node node = null callback() }
util-request.js - The utilities for requesting script and style files ref: tests/research/load-js-css/test.html
onload
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function getCurrentScript() { if (currentlyAddingScript) { return currentlyAddingScript } // For IE6-9 browsers, the script onload event may not fire right // after the script is evaluated. Kris Zyp found that it // could query the script nodes and the one that is in "interactive" // mode indicates the current script // ref: http://goo.gl/JHfFW if (interactiveScript && interactiveScript.readyState === "interactive") { return interactiveScript } var scripts = head.getElementsByTagName("script") for (var i = scripts.length - 1; i >= 0; i--) { var script = scripts[i] if (script.readyState === "interactive") { interactiveScript = script return interactiveScript } } }
util-request.js - The utilities for requesting script and style files ref: tests/research/load-js-css/test.html
getCurrentScript
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function parseDependencies(code) { var ret = [] code.replace(SLASH_RE, "") .replace(REQUIRE_RE, function(m, m1, m2) { if (m2) { ret.push(m2) } }) return ret }
util-deps.js - The parser for dependencies ref: tests/research/parse-dependencies/test.html
parseDependencies
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function Module(uri, deps) { this.uri = uri this.dependencies = deps || [] this.exports = null this.status = 0 // console.log(uri); // Who depends on me this._waitings = {} // The number of unloaded dependencies this._remain = 0 }
module.js - The core of module loader
Module
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function sendRequest() { seajs.request(emitData.requestUri, emitData.onRequest, emitData.charset) }
module.js - The core of module loader
sendRequest
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function onRequest() { delete fetchingList[requestUri] fetchedList[requestUri] = true // Save meta data of anonymous module if (anonymousMeta) { Module.save(uri, anonymousMeta) anonymousMeta = null } // Call callbacks var m, mods = callbackList[requestUri] delete callbackList[requestUri] while ((m = mods.shift())) m.load() }
module.js - The core of module loader
onRequest
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
function require(id) { return Module.get(require.resolve(id)).exec() }
module.js - The core of module loader
require
javascript
yued-fe/lulu
theme/peak/js/plugin/sea.js
https://github.com/yued-fe/lulu/blob/master/theme/peak/js/plugin/sea.js
MIT
U = function (a, b) { if (!a) { return ''; } b = b || 'x'; var c = ''; var d = 0; var e; for (d; d < a.length; d += 1) a.charCodeAt(d) >= 55296 && a.charCodeAt(d) <= 56319 ? (e = (65536 + 1024 * (Number(a.charCodeAt(d)) - 55296) + Number(a.charCodeAt(d + 1)) - 56320).toString(16), d += 1) : e = a.charCodeAt(d).toString(16), c += b + e; return c.substr(b.length); }
@Keyboard.js @author zhangxinxu @version Created: 17-06-13
U
javascript
yued-fe/lulu
theme/pure/js/common/all.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/all.js
MIT
checkIfIteratorIsSupported = function () { try { return !!Symbol.iterator; } catch (error) { return false; } }
Polyfill URLSearchParams Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js
checkIfIteratorIsSupported
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
createIterator = function (items) { var iterator = { next: function () { var value = items.shift(); return { done: value === void 0, value: value }; } }; if (iteratorSupported) { iterator[Symbol.iterator] = function () { return iterator; }; } return iterator; }
Polyfill URLSearchParams Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js
createIterator
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
serializeParam = function (value) { return encodeURIComponent(value).replace(/%20/g, '+'); }
Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
serializeParam
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
deserializeParam = function (value) { return decodeURIComponent(String(value).replace(/\+/g, ' ')); }
Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
deserializeParam
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
polyfillURLSearchParams = function () { var URLSearchParams = function (searchString) { Object.defineProperty(this, '_entries', { writable: true, value: {} }); var typeofSearchString = typeof searchString; if (typeofSearchString === 'undefined') { // do nothing } else if (typeofSearchString === 'string') { if (searchString !== '') { this._fromString(searchString); } } else if (searchString instanceof URLSearchParams) { var _this = this; searchString.forEach(function (value, name) { _this.append(name, value); }); } else if ((searchString !== null) && (typeofSearchString === 'object')) { if (Object.prototype.toString.call(searchString) === '[object Array]') { for (var i = 0; i < searchString.length; i++) { var entry = searchString[i]; if ((Object.prototype.toString.call(entry) === '[object Array]') || (entry.length !== 2)) { this.append(entry[0], entry[1]); } else { throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\'s input'); } } } else if (searchString instanceof FormData && searchString._data) { for (var keyData in searchString._data) { if (searchString._data.hasOwnProperty(keyData)) { this.append(keyData, searchString._data[keyData]); } } } else { for (var key in searchString) { if (searchString.hasOwnProperty(key)) { this.append(key, searchString[key]); } } } } else { throw new TypeError('Unsupported input\'s type for URLSearchParams'); } }; var proto = URLSearchParams.prototype; proto.append = function (name, value) { if (name in this._entries) { this._entries[name].push(String(value)); } else { this._entries[name] = [String(value)]; } }; proto['delete'] = function (name) { delete this._entries[name]; }; proto.get = function (name) { return (name in this._entries) ? this._entries[name][0] : null; }; proto.getAll = function (name) { return (name in this._entries) ? this._entries[name].slice(0) : []; }; proto.has = function (name) { return (name in this._entries); }; proto.set = function (name, value) { this._entries[name] = [String(value)]; }; proto.forEach = function (callback, thisArg) { var entries; for (var name in this._entries) { if (this._entries.hasOwnProperty(name)) { entries = this._entries[name]; for (var i = 0; i < entries.length; i++) { callback.call(thisArg, entries[i], name, this); } } } }; proto.keys = function () { var items = []; this.forEach(function (value, name) { items.push(name); }); return createIterator(items); }; proto.values = function () { var items = []; this.forEach(function (value) { items.push(value); }); return createIterator(items); }; proto.entries = function () { var items = []; this.forEach(function (value, name) { items.push([name, value]); }); return createIterator(items); }; if (iteratorSupported) { proto[Symbol.iterator] = proto.entries; } proto.toString = function () { var searchArray = []; this.forEach(function (value, name) { searchArray.push(serializeParam(name) + '=' + serializeParam(value)); }); return searchArray.join('&'); }; global.URLSearchParams = URLSearchParams; }
Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
polyfillURLSearchParams
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
URLSearchParams = function (searchString) { Object.defineProperty(this, '_entries', { writable: true, value: {} }); var typeofSearchString = typeof searchString; if (typeofSearchString === 'undefined') { // do nothing } else if (typeofSearchString === 'string') { if (searchString !== '') { this._fromString(searchString); } } else if (searchString instanceof URLSearchParams) { var _this = this; searchString.forEach(function (value, name) { _this.append(name, value); }); } else if ((searchString !== null) && (typeofSearchString === 'object')) { if (Object.prototype.toString.call(searchString) === '[object Array]') { for (var i = 0; i < searchString.length; i++) { var entry = searchString[i]; if ((Object.prototype.toString.call(entry) === '[object Array]') || (entry.length !== 2)) { this.append(entry[0], entry[1]); } else { throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\'s input'); } } } else if (searchString instanceof FormData && searchString._data) { for (var keyData in searchString._data) { if (searchString._data.hasOwnProperty(keyData)) { this.append(keyData, searchString._data[keyData]); } } } else { for (var key in searchString) { if (searchString.hasOwnProperty(key)) { this.append(key, searchString[key]); } } } } else { throw new TypeError('Unsupported input\'s type for URLSearchParams'); } }
Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
URLSearchParams
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
checkIfURLSearchParamsSupported = function () { try { var URLSearchParams = global.URLSearchParams; return (new URLSearchParams('?a=1').toString() === 'a=1') && (typeof URLSearchParams.prototype.set === 'function'); } catch (e) { return false; } }
Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.
checkIfURLSearchParamsSupported
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
checkIfURLIsSupported = function () { try { var u = new global.URL('b', 'http://a'); u.pathname = 'c%20d'; return (u.href === 'http://a/c%20d') && u.searchParams; } catch (e) { return false; } }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
checkIfURLIsSupported
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
polyfillURL = function () { var _URL = global.URL; var URL = function (url, base) { if (typeof url !== 'string') url = String(url); // Only create another document if the base is different from current location. var doc = document; var baseElement; if (base && (global.location === void 0 || base !== global.location.href)) { doc = document.implementation.createHTMLDocument(''); baseElement = doc.createElement('base'); baseElement.href = base; doc.head.appendChild(baseElement); try { if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href); } catch (err) { throw new Error('URL unable to set base ' + base + ' due to ' + err); } } var anchorElement = doc.createElement('a'); anchorElement.href = url; if (baseElement) { doc.body.appendChild(anchorElement); // force href to refresh anchorElement.href = anchorElement.href; } if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href)) { throw new TypeError('Invalid URL'); } Object.defineProperty(this, '_anchorElement', { value: anchorElement }); // create a linked searchParams which reflect its changes on URL var searchParams = new global.URLSearchParams(this.search); var enableSearchUpdate = true; var enableSearchParamsUpdate = true; var _this = this; ['append', 'delete', 'set'].forEach(function (methodName) { var method = searchParams[methodName]; searchParams[methodName] = function () { method.apply(searchParams, arguments); if (enableSearchUpdate) { enableSearchParamsUpdate = false; _this.search = searchParams.toString(); enableSearchParamsUpdate = true; } }; }); Object.defineProperty(this, 'searchParams', { value: searchParams, enumerable: true }); var search = void 0; Object.defineProperty(this, '_updateSearchParams', { enumerable: false, configurable: false, writable: false, value: function () { if (this.search !== search) { search = this.search; if (enableSearchParamsUpdate) { enableSearchUpdate = false; this.searchParams._fromString(this.search); enableSearchUpdate = true; } } } }); }; var proto = URL.prototype; var linkURLWithAnchorAttribute = function (attributeName) { Object.defineProperty(proto, attributeName, { get: function () { return this._anchorElement[attributeName]; }, set: function (value) { this._anchorElement[attributeName] = value; }, enumerable: true }); }; ['hash', 'host', 'hostname', 'port', 'protocol'] .forEach(function (attributeName) { linkURLWithAnchorAttribute(attributeName); }); Object.defineProperty(proto, 'search', { get: function () { return this._anchorElement['search']; }, set: function (value) { this._anchorElement['search'] = value; this._updateSearchParams(); }, enumerable: true }); Object.defineProperties(proto, { 'toString': { get: function () { var _this = this; return function () { return _this.href; }; } }, 'href': { get: function () { return this._anchorElement.href.replace(/\?$/, ''); }, set: function (value) { this._anchorElement.href = value; this._updateSearchParams(); }, enumerable: true }, 'pathname': { get: function () { return this._anchorElement.pathname.replace(/(^\/?)/, '/'); }, set: function (value) { this._anchorElement.pathname = value; }, enumerable: true }, 'origin': { get: function () { // get expected port from protocol var expectedPort = { 'http:': 80, 'https:': 443, 'ftp:': 21 }[this._anchorElement.protocol]; // add port to origin if, expected port is different than actual port // and it is not empty f.e http://foo:8080 // 8080 != 80 && 8080 != '' var addPortToOrigin = this._anchorElement.port != expectedPort && this._anchorElement.port !== ''; return this._anchorElement.protocol + '//' + this._anchorElement.hostname + (addPortToOrigin ? (':' + this._anchorElement.port) : ''); }, enumerable: true }, 'password': { // TODO get: function () { return ''; }, set: function (value) { }, enumerable: true }, 'username': { // TODO get: function () { return ''; }, set: function (value) { }, enumerable: true } }); URL.createObjectURL = function (blob) { return _URL.createObjectURL.apply(_URL, arguments); }; URL.revokeObjectURL = function (url) { return _URL.revokeObjectURL.apply(_URL, arguments); }; global.URL = URL; }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
polyfillURL
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
URL = function (url, base) { if (typeof url !== 'string') url = String(url); // Only create another document if the base is different from current location. var doc = document; var baseElement; if (base && (global.location === void 0 || base !== global.location.href)) { doc = document.implementation.createHTMLDocument(''); baseElement = doc.createElement('base'); baseElement.href = base; doc.head.appendChild(baseElement); try { if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href); } catch (err) { throw new Error('URL unable to set base ' + base + ' due to ' + err); } } var anchorElement = doc.createElement('a'); anchorElement.href = url; if (baseElement) { doc.body.appendChild(anchorElement); // force href to refresh anchorElement.href = anchorElement.href; } if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href)) { throw new TypeError('Invalid URL'); } Object.defineProperty(this, '_anchorElement', { value: anchorElement }); // create a linked searchParams which reflect its changes on URL var searchParams = new global.URLSearchParams(this.search); var enableSearchUpdate = true; var enableSearchParamsUpdate = true; var _this = this; ['append', 'delete', 'set'].forEach(function (methodName) { var method = searchParams[methodName]; searchParams[methodName] = function () { method.apply(searchParams, arguments); if (enableSearchUpdate) { enableSearchParamsUpdate = false; _this.search = searchParams.toString(); enableSearchParamsUpdate = true; } }; }); Object.defineProperty(this, 'searchParams', { value: searchParams, enumerable: true }); var search = void 0; Object.defineProperty(this, '_updateSearchParams', { enumerable: false, configurable: false, writable: false, value: function () { if (this.search !== search) { search = this.search; if (enableSearchParamsUpdate) { enableSearchUpdate = false; this.searchParams._fromString(this.search); enableSearchUpdate = true; } } } }); }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
URL
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
linkURLWithAnchorAttribute = function (attributeName) { Object.defineProperty(proto, attributeName, { get: function () { return this._anchorElement[attributeName]; }, set: function (value) { this._anchorElement[attributeName] = value; }, enumerable: true }); }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
linkURLWithAnchorAttribute
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
getOrigin = function () { return global.location.protocol + '//' + global.location.hostname + (global.location.port ? (':' + global.location.port) : ''); }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
getOrigin
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function has (key) { return this._data.hasOwnProperty(key); }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
has
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function append (key, value) { var self = this; if (!has.call(self, key)) { self._data[key] = []; } self._data[key].push(value); }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
append
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function deleteFn (key) { delete this._data[key]; }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
deleteFn
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function getAll (key) { return this._data[key] || null; }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
getAll
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function get (key) { var values = getAll.call(this, key); return values ? values[0] : null; }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
get
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function set (key, value) { this._data[key] = [value]; }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
set
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function createBoundary () { // for XHR var random = math.random; var salt = (random() * math.pow(10, ((random() * 12) | 0) + 1)); var hash = (random() * salt).toString(36); return '----------------FormData-' + hash; }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
createBoundary
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function parseContents (children) { var child, counter, counter2, length, length2, name, option, self = this; for (counter = 0, length = children.length; counter < length; counter += 1) { child = children[counter]; name = child.name || child.id; if (!name || child.disabled) { continue; } switch (child.type) { case 'checkbox': if (child.checked) { self.append(name, child.value || 'on'); } break; // x/y coordinates or origin if missing case 'image': self.append(name + '.x', child.x || 0); self.append(name + '.y', child.y || 0); break; case 'radio': if (child.checked) { // using .set as only one can be valid (uses last one if more discovered) self.set(name, child.value); } break; case 'select-one': if (child.selectedIndex !== -1) { self.append(name, child.options[child.selectedIndex].value); } break; case 'select-multiple': for (counter2 = 0, length2 = child.options.length; counter2 < length2; counter2 += 1) { option = child.options[counter2]; if (option.selected) { self.append(name, option.value); } } break; case 'file': case 'reset': case 'submit': break; default: // hidden, text, textarea, password self.append(name, child.value); } } }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
parseContents
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function toString () { var self = this, body = [], data = self._data, key, prefix = '--'; for (key in data) { if (data.hasOwnProperty(key)) { body.push(prefix + self._boundary); // boundaries are prefixed with '--' // only form fields for now, files can wait / probably can't be done body.push('Content-Disposition: form-data; name="' + key + '"\r\n'); // two linebreaks between definition and content body.push(data[key]); } } if (body.length) { return body.join('\r\n') + '\r\n' + prefix + self._boundary + prefix; // form content ends with '--' } return ''; }
Polyfill URL Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js
toString
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function FormData (form) { var self = this; if (!(self instanceof FormData)) { return new FormData(form); } if (form && (!form.tagName || form.tagName !== 'FORM')) { // not a form return; } self._boundary = createBoundary(); self._data = {}; if (!form) { // nothing to parse, we're done here return; } parseContents.call(self, form.children); }
[FormData description] @contructor @param {?HTMLForm} form HTML <form> element to populate the object (optional)
FormData
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function send (data) { var self = this; if (data instanceof FormData) { self.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + data._boundary); return xhrSend.call(self, data.toString()); } return xhrSend.call(self, data || null); }
[FormData description] @contructor @param {?HTMLForm} form HTML <form> element to populate the object (optional)
send
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
CustomEvent = function (event, params) { params = params || { bubbles: false, cancelable: false, detail: undefined }; var evt = document.createEvent('CustomEvent'); evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); return evt; }
CustomEvent constructor polyfill for IE @return {[type]} [description]
CustomEvent
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT
function has (key) { return this._data.hasOwnProperty(key); }
@description placeholder polyfill for IE9 only support one line no consideration of settings placeholder attr @author zhangxinxu(.com) @created 2019-08-09
has
javascript
yued-fe/lulu
theme/pure/js/common/polyfill.js
https://github.com/yued-fe/lulu/blob/master/theme/pure/js/common/polyfill.js
MIT