2015-08-16 06:59:58 +00:00
|
|
|
define( [
|
2014-09-11 20:18:34 +00:00
|
|
|
"./core",
|
|
|
|
"./var/document",
|
2015-11-10 18:26:15 +00:00
|
|
|
"./var/documentElement",
|
|
|
|
"./var/hasOwn",
|
|
|
|
"./var/indexOf"
|
|
|
|
], function( jQuery, document, documentElement, hasOwn, indexOf ) {
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2013-02-27 02:59:08 +00:00
|
|
|
/*
|
|
|
|
* Optional (non-Sizzle) selector module for custom builds.
|
|
|
|
*
|
|
|
|
* Note that this DOES NOT SUPPORT many documented jQuery
|
|
|
|
* features in exchange for its smaller size:
|
|
|
|
*
|
|
|
|
* Attribute not equal selector
|
|
|
|
* Positional selectors (:first; :eq(n); :odd; etc.)
|
|
|
|
* Type selectors (:input; :checkbox; :button; etc.)
|
|
|
|
* State-based selectors (:animated; :visible; :hidden; etc.)
|
|
|
|
* :has(selector)
|
|
|
|
* :not(complex selector)
|
|
|
|
* custom selectors via Sizzle extensions
|
|
|
|
* Leading combinators (e.g., $collection.find("> *"))
|
|
|
|
* Reliable functionality on XML fragments
|
|
|
|
* Requiring all parts of a selector to match elements under context
|
|
|
|
* (e.g., $div.find("div > *") now matches children of $div)
|
|
|
|
* Matching against non-elements
|
|
|
|
* Reliable sorting of disconnected nodes
|
|
|
|
* querySelectorAll bug fixes (e.g., unreliable :focus on WebKit)
|
|
|
|
*
|
|
|
|
* If any of these are unacceptable tradeoffs, either use Sizzle or
|
|
|
|
* customize this stub for the project's specific needs.
|
|
|
|
*/
|
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
var hasDuplicate, sortInput,
|
|
|
|
sortStable = jQuery.expando.split( "" ).sort( sortOrder ).join( "" ) === jQuery.expando,
|
2014-09-11 20:18:34 +00:00
|
|
|
matches = documentElement.matches ||
|
|
|
|
documentElement.webkitMatchesSelector ||
|
|
|
|
documentElement.mozMatchesSelector ||
|
|
|
|
documentElement.oMatchesSelector ||
|
2016-01-27 17:57:04 +00:00
|
|
|
documentElement.msMatchesSelector,
|
|
|
|
|
|
|
|
// CSS string/identifier serialization
|
|
|
|
// https://drafts.csswg.org/cssom/#common-serializing-idioms
|
|
|
|
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
|
|
|
|
fcssescape = function( ch, asCodePoint ) {
|
|
|
|
if ( asCodePoint ) {
|
|
|
|
|
|
|
|
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
|
|
|
|
if ( ch === "\0" ) {
|
|
|
|
return "\uFFFD";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Control characters and (dependent upon position) numbers get escaped as code points
|
|
|
|
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
|
|
|
|
}
|
|
|
|
|
|
|
|
// Other potentially-special ASCII characters get backslash-escaped
|
|
|
|
return "\\" + ch;
|
|
|
|
};
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
function sortOrder( a, b ) {
|
2013-02-19 04:52:29 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Flag for duplicate removal
|
|
|
|
if ( a === b ) {
|
|
|
|
hasDuplicate = true;
|
|
|
|
return 0;
|
|
|
|
}
|
2013-02-19 04:52:29 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Sort on method existence if only one input has compareDocumentPosition
|
|
|
|
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
|
|
|
|
if ( compare ) {
|
|
|
|
return compare;
|
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Calculate position if both inputs belong to the same document
|
|
|
|
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
|
|
|
|
a.compareDocumentPosition( b ) :
|
2013-02-19 04:52:29 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Otherwise we know they are disconnected
|
|
|
|
1;
|
2013-02-19 04:52:29 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Disconnected nodes
|
|
|
|
if ( compare & 1 ) {
|
2013-02-19 04:52:29 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Choose the first element that is related to our preferred document
|
|
|
|
if ( a === document || a.ownerDocument === document &&
|
|
|
|
jQuery.contains( document, a ) ) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if ( b === document || b.ownerDocument === document &&
|
|
|
|
jQuery.contains( document, b ) ) {
|
|
|
|
return 1;
|
2013-02-19 04:52:29 +00:00
|
|
|
}
|
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Maintain original order
|
|
|
|
return sortInput ?
|
|
|
|
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
|
|
|
|
0;
|
|
|
|
}
|
2015-07-13 12:39:52 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
return compare & 4 ? -1 : 1;
|
|
|
|
}
|
2015-07-13 12:39:52 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
function uniqueSort( results ) {
|
|
|
|
var elem,
|
|
|
|
duplicates = [],
|
|
|
|
j = 0,
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
hasDuplicate = false;
|
|
|
|
sortInput = !sortStable && results.slice( 0 );
|
|
|
|
results.sort( sortOrder );
|
|
|
|
|
|
|
|
if ( hasDuplicate ) {
|
|
|
|
while ( ( elem = results[ i++ ] ) ) {
|
|
|
|
if ( elem === results[ i ] ) {
|
|
|
|
j = duplicates.push( i );
|
2015-07-13 12:39:52 +00:00
|
|
|
}
|
|
|
|
}
|
2015-11-10 18:26:15 +00:00
|
|
|
while ( j-- ) {
|
|
|
|
results.splice( duplicates[ j ], 1 );
|
|
|
|
}
|
|
|
|
}
|
2015-07-13 12:39:52 +00:00
|
|
|
|
2015-11-10 18:26:15 +00:00
|
|
|
// Clear input after sorting to release objects
|
|
|
|
// See https://github.com/jquery/sizzle/pull/225
|
|
|
|
sortInput = null;
|
|
|
|
|
|
|
|
return results;
|
|
|
|
}
|
2013-02-19 04:52:29 +00:00
|
|
|
|
2016-01-27 17:57:04 +00:00
|
|
|
function escape( sel ) {
|
|
|
|
return ( sel + "" ).replace( rcssescape, fcssescape );
|
|
|
|
}
|
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery.extend( {
|
2016-01-27 17:57:04 +00:00
|
|
|
uniqueSort: uniqueSort,
|
|
|
|
unique: uniqueSort,
|
|
|
|
escapeSelector: escape,
|
2013-02-19 04:52:29 +00:00
|
|
|
find: function( selector, context, results, seed ) {
|
2013-05-06 19:42:00 +00:00
|
|
|
var elem, nodeType,
|
2013-02-19 04:52:29 +00:00
|
|
|
i = 0;
|
|
|
|
|
|
|
|
results = results || [];
|
|
|
|
context = context || document;
|
|
|
|
|
2013-05-06 19:42:00 +00:00
|
|
|
// Same basic safeguard as Sizzle
|
|
|
|
if ( !selector || typeof selector !== "string" ) {
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Early return if context is not an element or document
|
2015-08-16 06:59:58 +00:00
|
|
|
if ( ( nodeType = context.nodeType ) !== 1 && nodeType !== 9 ) {
|
2013-05-06 19:42:00 +00:00
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2013-02-19 04:52:29 +00:00
|
|
|
if ( seed ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
while ( ( elem = seed[ i++ ] ) ) {
|
|
|
|
if ( jQuery.find.matchesSelector( elem, selector ) ) {
|
2013-02-19 04:52:29 +00:00
|
|
|
results.push( elem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery.merge( results, context.querySelectorAll( selector ) );
|
2013-02-19 04:52:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return results;
|
|
|
|
},
|
|
|
|
text: function( elem ) {
|
|
|
|
var node,
|
|
|
|
ret = "",
|
|
|
|
i = 0,
|
|
|
|
nodeType = elem.nodeType;
|
|
|
|
|
|
|
|
if ( !nodeType ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2013-02-19 04:52:29 +00:00
|
|
|
// If no nodeType, this is expected to be an array
|
2015-08-16 06:59:58 +00:00
|
|
|
while ( ( node = elem[ i++ ] ) ) {
|
|
|
|
|
2013-02-19 04:52:29 +00:00
|
|
|
// Do not traverse comment nodes
|
|
|
|
ret += jQuery.text( node );
|
|
|
|
}
|
|
|
|
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2013-02-19 04:52:29 +00:00
|
|
|
// Use textContent for elements
|
|
|
|
return elem.textContent;
|
|
|
|
} else if ( nodeType === 3 || nodeType === 4 ) {
|
|
|
|
return elem.nodeValue;
|
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2013-02-19 04:52:29 +00:00
|
|
|
// Do not include comment or processing instruction nodes
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
contains: function( a, b ) {
|
|
|
|
var adown = a.nodeType === 9 ? a.documentElement : a,
|
|
|
|
bup = b && b.parentNode;
|
2015-08-16 06:59:58 +00:00
|
|
|
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains( bup ) );
|
2013-02-19 04:52:29 +00:00
|
|
|
},
|
|
|
|
isXMLDoc: function( elem ) {
|
2015-11-10 18:26:15 +00:00
|
|
|
|
|
|
|
// documentElement is verified for cases where it doesn't yet exist
|
|
|
|
// (such as loading iframes in IE - #4833)
|
|
|
|
var documentElement = elem && ( elem.ownerDocument || elem ).documentElement;
|
|
|
|
return documentElement ? documentElement.nodeName !== "HTML" : false;
|
2013-02-19 04:52:29 +00:00
|
|
|
},
|
|
|
|
expr: {
|
2013-04-05 05:04:44 +00:00
|
|
|
attrHandle: {},
|
2013-02-19 04:52:29 +00:00
|
|
|
match: {
|
2015-05-18 21:11:21 +00:00
|
|
|
bool: new RegExp( "^(?:checked|selected|async|autofocus|autoplay|controls|defer" +
|
|
|
|
"|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$", "i" ),
|
2013-02-19 04:52:29 +00:00
|
|
|
needsContext: /^[\x20\t\r\n\f]*[>+~]/
|
|
|
|
}
|
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2013-02-19 04:52:29 +00:00
|
|
|
|
|
|
|
jQuery.extend( jQuery.find, {
|
|
|
|
matches: function( expr, elements ) {
|
|
|
|
return jQuery.find( expr, null, null, elements );
|
|
|
|
},
|
|
|
|
matchesSelector: function( elem, expr ) {
|
|
|
|
return matches.call( elem, expr );
|
2013-04-05 05:04:44 +00:00
|
|
|
},
|
|
|
|
attr: function( elem, name ) {
|
2015-11-10 18:26:15 +00:00
|
|
|
var fn = jQuery.expr.attrHandle[ name.toLowerCase() ],
|
|
|
|
|
|
|
|
// Don't get fooled by Object.prototype properties (jQuery #13807)
|
|
|
|
value = fn && hasOwn.call( jQuery.expr.attrHandle, name.toLowerCase() ) ?
|
|
|
|
fn( elem, name, jQuery.isXMLDoc( elem ) ) :
|
|
|
|
undefined;
|
|
|
|
return value !== undefined ? value : elem.getAttribute( name );
|
2013-02-19 04:52:29 +00:00
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|