| 1 | define( [
|
| 2 | "./core",
|
| 3 | "./var/document",
|
| 4 | "./var/documentElement",
|
| 5 | "./var/hasOwn",
|
| 6 | "./var/indexOf"
|
| 7 | ], function( jQuery, document, documentElement, hasOwn, indexOf ) {
|
| 8 |
|
| 9 | "use strict";
|
| 10 |
|
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 |
|
| 35 |
|
| 36 | var hasDuplicate, sortInput,
|
| 37 | rhtmlSuffix = /HTML$/i,
|
| 38 | sortStable = jQuery.expando.split( "" ).sort( sortOrder ).join( "" ) === jQuery.expando,
|
| 39 | matches = documentElement.matches ||
|
| 40 | documentElement.webkitMatchesSelector ||
|
| 41 | documentElement.mozMatchesSelector ||
|
| 42 | documentElement.oMatchesSelector ||
|
| 43 | documentElement.msMatchesSelector,
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 | rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
|
| 48 | fcssescape = function( ch, asCodePoint ) {
|
| 49 | if ( asCodePoint ) {
|
| 50 |
|
| 51 |
|
| 52 | if ( ch === "\0" ) {
|
| 53 | return "\uFFFD";
|
| 54 | }
|
| 55 |
|
| 56 |
|
| 57 | return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
|
| 58 | }
|
| 59 |
|
| 60 |
|
| 61 | return "\\" + ch;
|
| 62 | };
|
| 63 |
|
| 64 | function sortOrder( a, b ) {
|
| 65 |
|
| 66 |
|
| 67 | if ( a === b ) {
|
| 68 | hasDuplicate = true;
|
| 69 | return 0;
|
| 70 | }
|
| 71 |
|
| 72 |
|
| 73 | var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
|
| 74 | if ( compare ) {
|
| 75 | return compare;
|
| 76 | }
|
| 77 |
|
| 78 |
|
| 79 | compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
|
| 80 | a.compareDocumentPosition( b ) :
|
| 81 |
|
| 82 |
|
| 83 | 1;
|
| 84 |
|
| 85 |
|
| 86 | if ( compare & 1 ) {
|
| 87 |
|
| 88 |
|
| 89 | if ( a === document || a.ownerDocument === document &&
|
| 90 | jQuery.contains( document, a ) ) {
|
| 91 | return -1;
|
| 92 | }
|
| 93 | if ( b === document || b.ownerDocument === document &&
|
| 94 | jQuery.contains( document, b ) ) {
|
| 95 | return 1;
|
| 96 | }
|
| 97 |
|
| 98 |
|
| 99 | return sortInput ?
|
| 100 | ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
|
| 101 | 0;
|
| 102 | }
|
| 103 |
|
| 104 | return compare & 4 ? -1 : 1;
|
| 105 | }
|
| 106 |
|
| 107 | function uniqueSort( results ) {
|
| 108 | var elem,
|
| 109 | duplicates = [],
|
| 110 | j = 0,
|
| 111 | i = 0;
|
| 112 |
|
| 113 | hasDuplicate = false;
|
| 114 | sortInput = !sortStable && results.slice( 0 );
|
| 115 | results.sort( sortOrder );
|
| 116 |
|
| 117 | if ( hasDuplicate ) {
|
| 118 | while ( ( elem = results[ i++ ] ) ) {
|
| 119 | if ( elem === results[ i ] ) {
|
| 120 | j = duplicates.push( i );
|
| 121 | }
|
| 122 | }
|
| 123 | while ( j-- ) {
|
| 124 | results.splice( duplicates[ j ], 1 );
|
| 125 | }
|
| 126 | }
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 | sortInput = null;
|
| 131 |
|
| 132 | return results;
|
| 133 | }
|
| 134 |
|
| 135 | function escape( sel ) {
|
| 136 | return ( sel + "" ).replace( rcssescape, fcssescape );
|
| 137 | }
|
| 138 |
|
| 139 | jQuery.extend( {
|
| 140 | uniqueSort: uniqueSort,
|
| 141 | unique: uniqueSort,
|
| 142 | escapeSelector: escape,
|
| 143 | find: function( selector, context, results, seed ) {
|
| 144 | var elem, nodeType,
|
| 145 | i = 0;
|
| 146 |
|
| 147 | results = results || [];
|
| 148 | context = context || document;
|
| 149 |
|
| 150 |
|
| 151 | if ( !selector || typeof selector !== "string" ) {
|
| 152 | return results;
|
| 153 | }
|
| 154 |
|
| 155 |
|
| 156 | if ( ( nodeType = context.nodeType ) !== 1 && nodeType !== 9 ) {
|
| 157 | return [];
|
| 158 | }
|
| 159 |
|
| 160 | if ( seed ) {
|
| 161 | while ( ( elem = seed[ i++ ] ) ) {
|
| 162 | if ( jQuery.find.matchesSelector( elem, selector ) ) {
|
| 163 | results.push( elem );
|
| 164 | }
|
| 165 | }
|
| 166 | } else {
|
| 167 | jQuery.merge( results, context.querySelectorAll( selector ) );
|
| 168 | }
|
| 169 |
|
| 170 | return results;
|
| 171 | },
|
| 172 | text: function( elem ) {
|
| 173 | var node,
|
| 174 | ret = "",
|
| 175 | i = 0,
|
| 176 | nodeType = elem.nodeType;
|
| 177 |
|
| 178 | if ( !nodeType ) {
|
| 179 |
|
| 180 |
|
| 181 | while ( ( node = elem[ i++ ] ) ) {
|
| 182 |
|
| 183 |
|
| 184 | ret += jQuery.text( node );
|
| 185 | }
|
| 186 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
|
| 187 |
|
| 188 |
|
| 189 | return elem.textContent;
|
| 190 | } else if ( nodeType === 3 || nodeType === 4 ) {
|
| 191 | return elem.nodeValue;
|
| 192 | }
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 | return ret;
|
| 197 | },
|
| 198 | contains: function( a, b ) {
|
| 199 | var bup = b && b.parentNode;
|
| 200 | return a === bup || !!( bup && bup.nodeType === 1 && a.contains( bup ) );
|
| 201 | },
|
| 202 | isXMLDoc: function( elem ) {
|
| 203 | var namespace = elem.namespaceURI,
|
| 204 | documentElement = ( elem.ownerDocument || elem ).documentElement;
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 | return !rhtmlSuffix.test( namespace ||
|
| 209 | documentElement && documentElement.nodeName ||
|
| 210 | "HTML" );
|
| 211 | },
|
| 212 | expr: {
|
| 213 | attrHandle: {},
|
| 214 | match: {
|
| 215 | bool: new RegExp( "^(?:checked|selected|async|autofocus|autoplay|controls|defer" +
|
| 216 | "|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$", "i" ),
|
| 217 | needsContext: /^[\x20\t\r\n\f]*[>+~]/
|
| 218 | }
|
| 219 | }
|
| 220 | } );
|
| 221 |
|
| 222 | jQuery.extend( jQuery.find, {
|
| 223 | matches: function( expr, elements ) {
|
| 224 | return jQuery.find( expr, null, null, elements );
|
| 225 | },
|
| 226 | matchesSelector: function( elem, expr ) {
|
| 227 | return matches.call( elem, expr );
|
| 228 | },
|
| 229 | attr: function( elem, name ) {
|
| 230 | var fn = jQuery.expr.attrHandle[ name.toLowerCase() ],
|
| 231 |
|
| 232 |
|
| 233 | value = fn && hasOwn.call( jQuery.expr.attrHandle, name.toLowerCase() ) ?
|
| 234 | fn( elem, name, jQuery.isXMLDoc( elem ) ) :
|
| 235 | undefined;
|
| 236 | return value !== undefined ? value : elem.getAttribute( name );
|
| 237 | }
|
| 238 | } );
|
| 239 |
|
| 240 | } );
|