您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

2144 行
60KB

  1. /*!
  2. * Sizzle CSS Selector Engine v2.2.1
  3. * http://sizzlejs.com/
  4. *
  5. * Copyright jQuery Foundation and other contributors
  6. * Released under the MIT license
  7. * http://jquery.org/license
  8. *
  9. * Date: 2015-10-17
  10. */
  11. (function( window ) {
  12. var i,
  13. support,
  14. Expr,
  15. getText,
  16. isXML,
  17. tokenize,
  18. compile,
  19. select,
  20. outermostContext,
  21. sortInput,
  22. hasDuplicate,
  23. // Local document vars
  24. setDocument,
  25. document,
  26. docElem,
  27. documentIsHTML,
  28. rbuggyQSA,
  29. rbuggyMatches,
  30. matches,
  31. contains,
  32. // Instance-specific data
  33. expando = "sizzle" + 1 * new Date(),
  34. preferredDoc = window.document,
  35. dirruns = 0,
  36. done = 0,
  37. classCache = createCache(),
  38. tokenCache = createCache(),
  39. compilerCache = createCache(),
  40. sortOrder = function( a, b ) {
  41. if ( a === b ) {
  42. hasDuplicate = true;
  43. }
  44. return 0;
  45. },
  46. // General-purpose constants
  47. MAX_NEGATIVE = 1 << 31,
  48. // Instance methods
  49. hasOwn = ({}).hasOwnProperty,
  50. arr = [],
  51. pop = arr.pop,
  52. push_native = arr.push,
  53. push = arr.push,
  54. slice = arr.slice,
  55. // Use a stripped-down indexOf as it's faster than native
  56. // http://jsperf.com/thor-indexof-vs-for/5
  57. indexOf = function( list, elem ) {
  58. var i = 0,
  59. len = list.length;
  60. for ( ; i < len; i++ ) {
  61. if ( list[i] === elem ) {
  62. return i;
  63. }
  64. }
  65. return -1;
  66. },
  67. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  68. // Regular expressions
  69. // http://www.w3.org/TR/css3-selectors/#whitespace
  70. whitespace = "[\\x20\\t\\r\\n\\f]",
  71. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  72. identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  73. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  74. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  75. // Operator (capture 2)
  76. "*([*^$|!~]?=)" + whitespace +
  77. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  78. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  79. "*\\]",
  80. pseudos = ":(" + identifier + ")(?:\\((" +
  81. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  82. // 1. quoted (capture 3; capture 4 or capture 5)
  83. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  84. // 2. simple (capture 6)
  85. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  86. // 3. anything else (capture 2)
  87. ".*" +
  88. ")\\)|)",
  89. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  90. rwhitespace = new RegExp( whitespace + "+", "g" ),
  91. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  92. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  93. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  94. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  95. rpseudo = new RegExp( pseudos ),
  96. ridentifier = new RegExp( "^" + identifier + "$" ),
  97. matchExpr = {
  98. "ID": new RegExp( "^#(" + identifier + ")" ),
  99. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  100. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  101. "ATTR": new RegExp( "^" + attributes ),
  102. "PSEUDO": new RegExp( "^" + pseudos ),
  103. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  104. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  105. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  106. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  107. // For use in libraries implementing .is()
  108. // We use this for POS matching in `select`
  109. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  110. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  111. },
  112. rinputs = /^(?:input|select|textarea|button)$/i,
  113. rheader = /^h\d$/i,
  114. rnative = /^[^{]+\{\s*\[native \w/,
  115. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  116. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  117. rsibling = /[+~]/,
  118. rescape = /'|\\/g,
  119. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  120. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  121. funescape = function( _, escaped, escapedWhitespace ) {
  122. var high = "0x" + escaped - 0x10000;
  123. // NaN means non-codepoint
  124. // Support: Firefox<24
  125. // Workaround erroneous numeric interpretation of +"0x"
  126. return high !== high || escapedWhitespace ?
  127. escaped :
  128. high < 0 ?
  129. // BMP codepoint
  130. String.fromCharCode( high + 0x10000 ) :
  131. // Supplemental Plane codepoint (surrogate pair)
  132. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  133. },
  134. // Used for iframes
  135. // See setDocument()
  136. // Removing the function wrapper causes a "Permission Denied"
  137. // error in IE
  138. unloadHandler = function() {
  139. setDocument();
  140. };
  141. // Optimize for push.apply( _, NodeList )
  142. try {
  143. push.apply(
  144. (arr = slice.call( preferredDoc.childNodes )),
  145. preferredDoc.childNodes
  146. );
  147. // Support: Android<4.0
  148. // Detect silently failing push.apply
  149. arr[ preferredDoc.childNodes.length ].nodeType;
  150. } catch ( e ) {
  151. push = { apply: arr.length ?
  152. // Leverage slice if possible
  153. function( target, els ) {
  154. push_native.apply( target, slice.call(els) );
  155. } :
  156. // Support: IE<9
  157. // Otherwise append directly
  158. function( target, els ) {
  159. var j = target.length,
  160. i = 0;
  161. // Can't trust NodeList.length
  162. while ( (target[j++] = els[i++]) ) {}
  163. target.length = j - 1;
  164. }
  165. };
  166. }
  167. function Sizzle( selector, context, results, seed ) {
  168. var m, i, elem, nid, nidselect, match, groups, newSelector,
  169. newContext = context && context.ownerDocument,
  170. // nodeType defaults to 9, since context defaults to document
  171. nodeType = context ? context.nodeType : 9;
  172. results = results || [];
  173. // Return early from calls with invalid selector or context
  174. if ( typeof selector !== "string" || !selector ||
  175. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  176. return results;
  177. }
  178. // Try to shortcut find operations (as opposed to filters) in HTML documents
  179. if ( !seed ) {
  180. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  181. setDocument( context );
  182. }
  183. context = context || document;
  184. if ( documentIsHTML ) {
  185. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  186. // (excepting DocumentFragment context, where the methods don't exist)
  187. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  188. // ID selector
  189. if ( (m = match[1]) ) {
  190. // Document context
  191. if ( nodeType === 9 ) {
  192. if ( (elem = context.getElementById( m )) ) {
  193. // Support: IE, Opera, Webkit
  194. // TODO: identify versions
  195. // getElementById can match elements by name instead of ID
  196. if ( elem.id === m ) {
  197. results.push( elem );
  198. return results;
  199. }
  200. } else {
  201. return results;
  202. }
  203. // Element context
  204. } else {
  205. // Support: IE, Opera, Webkit
  206. // TODO: identify versions
  207. // getElementById can match elements by name instead of ID
  208. if ( newContext && (elem = newContext.getElementById( m )) &&
  209. contains( context, elem ) &&
  210. elem.id === m ) {
  211. results.push( elem );
  212. return results;
  213. }
  214. }
  215. // Type selector
  216. } else if ( match[2] ) {
  217. push.apply( results, context.getElementsByTagName( selector ) );
  218. return results;
  219. // Class selector
  220. } else if ( (m = match[3]) && support.getElementsByClassName &&
  221. context.getElementsByClassName ) {
  222. push.apply( results, context.getElementsByClassName( m ) );
  223. return results;
  224. }
  225. }
  226. // Take advantage of querySelectorAll
  227. if ( support.qsa &&
  228. !compilerCache[ selector + " " ] &&
  229. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  230. if ( nodeType !== 1 ) {
  231. newContext = context;
  232. newSelector = selector;
  233. // qSA looks outside Element context, which is not what we want
  234. // Thanks to Andrew Dupont for this workaround technique
  235. // Support: IE <=8
  236. // Exclude object elements
  237. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  238. // Capture the context ID, setting it first if necessary
  239. if ( (nid = context.getAttribute( "id" )) ) {
  240. nid = nid.replace( rescape, "\\$&" );
  241. } else {
  242. context.setAttribute( "id", (nid = expando) );
  243. }
  244. // Prefix every selector in the list
  245. groups = tokenize( selector );
  246. i = groups.length;
  247. nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
  248. while ( i-- ) {
  249. groups[i] = nidselect + " " + toSelector( groups[i] );
  250. }
  251. newSelector = groups.join( "," );
  252. // Expand context for sibling selectors
  253. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  254. context;
  255. }
  256. if ( newSelector ) {
  257. try {
  258. push.apply( results,
  259. newContext.querySelectorAll( newSelector )
  260. );
  261. return results;
  262. } catch ( qsaError ) {
  263. } finally {
  264. if ( nid === expando ) {
  265. context.removeAttribute( "id" );
  266. }
  267. }
  268. }
  269. }
  270. }
  271. }
  272. // All others
  273. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  274. }
  275. /**
  276. * Create key-value caches of limited size
  277. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  278. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  279. * deleting the oldest entry
  280. */
  281. function createCache() {
  282. var keys = [];
  283. function cache( key, value ) {
  284. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  285. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  286. // Only keep the most recent entries
  287. delete cache[ keys.shift() ];
  288. }
  289. return (cache[ key + " " ] = value);
  290. }
  291. return cache;
  292. }
  293. /**
  294. * Mark a function for special use by Sizzle
  295. * @param {Function} fn The function to mark
  296. */
  297. function markFunction( fn ) {
  298. fn[ expando ] = true;
  299. return fn;
  300. }
  301. /**
  302. * Support testing using an element
  303. * @param {Function} fn Passed the created div and expects a boolean result
  304. */
  305. function assert( fn ) {
  306. var div = document.createElement("div");
  307. try {
  308. return !!fn( div );
  309. } catch (e) {
  310. return false;
  311. } finally {
  312. // Remove from its parent by default
  313. if ( div.parentNode ) {
  314. div.parentNode.removeChild( div );
  315. }
  316. // release memory in IE
  317. div = null;
  318. }
  319. }
  320. /**
  321. * Adds the same handler for all of the specified attrs
  322. * @param {String} attrs Pipe-separated list of attributes
  323. * @param {Function} handler The method that will be applied
  324. */
  325. function addHandle( attrs, handler ) {
  326. var arr = attrs.split("|"),
  327. i = arr.length;
  328. while ( i-- ) {
  329. Expr.attrHandle[ arr[i] ] = handler;
  330. }
  331. }
  332. /**
  333. * Checks document order of two siblings
  334. * @param {Element} a
  335. * @param {Element} b
  336. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  337. */
  338. function siblingCheck( a, b ) {
  339. var cur = b && a,
  340. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  341. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  342. ( ~a.sourceIndex || MAX_NEGATIVE );
  343. // Use IE sourceIndex if available on both nodes
  344. if ( diff ) {
  345. return diff;
  346. }
  347. // Check if b follows a
  348. if ( cur ) {
  349. while ( (cur = cur.nextSibling) ) {
  350. if ( cur === b ) {
  351. return -1;
  352. }
  353. }
  354. }
  355. return a ? 1 : -1;
  356. }
  357. /**
  358. * Returns a function to use in pseudos for input types
  359. * @param {String} type
  360. */
  361. function createInputPseudo( type ) {
  362. return function( elem ) {
  363. var name = elem.nodeName.toLowerCase();
  364. return name === "input" && elem.type === type;
  365. };
  366. }
  367. /**
  368. * Returns a function to use in pseudos for buttons
  369. * @param {String} type
  370. */
  371. function createButtonPseudo( type ) {
  372. return function( elem ) {
  373. var name = elem.nodeName.toLowerCase();
  374. return (name === "input" || name === "button") && elem.type === type;
  375. };
  376. }
  377. /**
  378. * Returns a function to use in pseudos for positionals
  379. * @param {Function} fn
  380. */
  381. function createPositionalPseudo( fn ) {
  382. return markFunction(function( argument ) {
  383. argument = +argument;
  384. return markFunction(function( seed, matches ) {
  385. var j,
  386. matchIndexes = fn( [], seed.length, argument ),
  387. i = matchIndexes.length;
  388. // Match elements found at the specified indexes
  389. while ( i-- ) {
  390. if ( seed[ (j = matchIndexes[i]) ] ) {
  391. seed[j] = !(matches[j] = seed[j]);
  392. }
  393. }
  394. });
  395. });
  396. }
  397. /**
  398. * Checks a node for validity as a Sizzle context
  399. * @param {Element|Object=} context
  400. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  401. */
  402. function testContext( context ) {
  403. return context && typeof context.getElementsByTagName !== "undefined" && context;
  404. }
  405. // Expose support vars for convenience
  406. support = Sizzle.support = {};
  407. /**
  408. * Detects XML nodes
  409. * @param {Element|Object} elem An element or a document
  410. * @returns {Boolean} True iff elem is a non-HTML XML node
  411. */
  412. isXML = Sizzle.isXML = function( elem ) {
  413. // documentElement is verified for cases where it doesn't yet exist
  414. // (such as loading iframes in IE - #4833)
  415. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  416. return documentElement ? documentElement.nodeName !== "HTML" : false;
  417. };
  418. /**
  419. * Sets document-related variables once based on the current document
  420. * @param {Element|Object} [doc] An element or document object to use to set the document
  421. * @returns {Object} Returns the current document
  422. */
  423. setDocument = Sizzle.setDocument = function( node ) {
  424. var hasCompare, parent,
  425. doc = node ? node.ownerDocument || node : preferredDoc;
  426. // Return early if doc is invalid or already selected
  427. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  428. return document;
  429. }
  430. // Update global variables
  431. document = doc;
  432. docElem = document.documentElement;
  433. documentIsHTML = !isXML( document );
  434. // Support: IE 9-11, Edge
  435. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  436. if ( (parent = document.defaultView) && parent.top !== parent ) {
  437. // Support: IE 11
  438. if ( parent.addEventListener ) {
  439. parent.addEventListener( "unload", unloadHandler, false );
  440. // Support: IE 9 - 10 only
  441. } else if ( parent.attachEvent ) {
  442. parent.attachEvent( "onunload", unloadHandler );
  443. }
  444. }
  445. /* Attributes
  446. ---------------------------------------------------------------------- */
  447. // Support: IE<8
  448. // Verify that getAttribute really returns attributes and not properties
  449. // (excepting IE8 booleans)
  450. support.attributes = assert(function( div ) {
  451. div.className = "i";
  452. return !div.getAttribute("className");
  453. });
  454. /* getElement(s)By*
  455. ---------------------------------------------------------------------- */
  456. // Check if getElementsByTagName("*") returns only elements
  457. support.getElementsByTagName = assert(function( div ) {
  458. div.appendChild( document.createComment("") );
  459. return !div.getElementsByTagName("*").length;
  460. });
  461. // Support: IE<9
  462. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  463. // Support: IE<10
  464. // Check if getElementById returns elements by name
  465. // The broken getElementById methods don't pick up programatically-set names,
  466. // so use a roundabout getElementsByName test
  467. support.getById = assert(function( div ) {
  468. docElem.appendChild( div ).id = expando;
  469. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  470. });
  471. // ID find and filter
  472. if ( support.getById ) {
  473. Expr.find["ID"] = function( id, context ) {
  474. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  475. var m = context.getElementById( id );
  476. return m ? [ m ] : [];
  477. }
  478. };
  479. Expr.filter["ID"] = function( id ) {
  480. var attrId = id.replace( runescape, funescape );
  481. return function( elem ) {
  482. return elem.getAttribute("id") === attrId;
  483. };
  484. };
  485. } else {
  486. // Support: IE6/7
  487. // getElementById is not reliable as a find shortcut
  488. delete Expr.find["ID"];
  489. Expr.filter["ID"] = function( id ) {
  490. var attrId = id.replace( runescape, funescape );
  491. return function( elem ) {
  492. var node = typeof elem.getAttributeNode !== "undefined" &&
  493. elem.getAttributeNode("id");
  494. return node && node.value === attrId;
  495. };
  496. };
  497. }
  498. // Tag
  499. Expr.find["TAG"] = support.getElementsByTagName ?
  500. function( tag, context ) {
  501. if ( typeof context.getElementsByTagName !== "undefined" ) {
  502. return context.getElementsByTagName( tag );
  503. // DocumentFragment nodes don't have gEBTN
  504. } else if ( support.qsa ) {
  505. return context.querySelectorAll( tag );
  506. }
  507. } :
  508. function( tag, context ) {
  509. var elem,
  510. tmp = [],
  511. i = 0,
  512. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  513. results = context.getElementsByTagName( tag );
  514. // Filter out possible comments
  515. if ( tag === "*" ) {
  516. while ( (elem = results[i++]) ) {
  517. if ( elem.nodeType === 1 ) {
  518. tmp.push( elem );
  519. }
  520. }
  521. return tmp;
  522. }
  523. return results;
  524. };
  525. // Class
  526. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  527. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  528. return context.getElementsByClassName( className );
  529. }
  530. };
  531. /* QSA/matchesSelector
  532. ---------------------------------------------------------------------- */
  533. // QSA and matchesSelector support
  534. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  535. rbuggyMatches = [];
  536. // qSa(:focus) reports false when true (Chrome 21)
  537. // We allow this because of a bug in IE8/9 that throws an error
  538. // whenever `document.activeElement` is accessed on an iframe
  539. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  540. // See http://bugs.jquery.com/ticket/13378
  541. rbuggyQSA = [];
  542. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  543. // Build QSA regex
  544. // Regex strategy adopted from Diego Perini
  545. assert(function( div ) {
  546. // Select is set to empty string on purpose
  547. // This is to test IE's treatment of not explicitly
  548. // setting a boolean content attribute,
  549. // since its presence should be enough
  550. // http://bugs.jquery.com/ticket/12359
  551. docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
  552. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  553. "<option selected=''></option></select>";
  554. // Support: IE8, Opera 11-12.16
  555. // Nothing should be selected when empty strings follow ^= or $= or *=
  556. // The test attribute must be unknown in Opera but "safe" for WinRT
  557. // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  558. if ( div.querySelectorAll("[msallowcapture^='']").length ) {
  559. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  560. }
  561. // Support: IE8
  562. // Boolean attributes and "value" are not treated correctly
  563. if ( !div.querySelectorAll("[selected]").length ) {
  564. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  565. }
  566. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  567. if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  568. rbuggyQSA.push("~=");
  569. }
  570. // Webkit/Opera - :checked should return selected option elements
  571. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  572. // IE8 throws error here and will not see later tests
  573. if ( !div.querySelectorAll(":checked").length ) {
  574. rbuggyQSA.push(":checked");
  575. }
  576. // Support: Safari 8+, iOS 8+
  577. // https://bugs.webkit.org/show_bug.cgi?id=136851
  578. // In-page `selector#id sibing-combinator selector` fails
  579. if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
  580. rbuggyQSA.push(".#.+[+~]");
  581. }
  582. });
  583. assert(function( div ) {
  584. // Support: Windows 8 Native Apps
  585. // The type and name attributes are restricted during .innerHTML assignment
  586. var input = document.createElement("input");
  587. input.setAttribute( "type", "hidden" );
  588. div.appendChild( input ).setAttribute( "name", "D" );
  589. // Support: IE8
  590. // Enforce case-sensitivity of name attribute
  591. if ( div.querySelectorAll("[name=d]").length ) {
  592. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  593. }
  594. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  595. // IE8 throws error here and will not see later tests
  596. if ( !div.querySelectorAll(":enabled").length ) {
  597. rbuggyQSA.push( ":enabled", ":disabled" );
  598. }
  599. // Opera 10-11 does not throw on post-comma invalid pseudos
  600. div.querySelectorAll("*,:x");
  601. rbuggyQSA.push(",.*:");
  602. });
  603. }
  604. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  605. docElem.webkitMatchesSelector ||
  606. docElem.mozMatchesSelector ||
  607. docElem.oMatchesSelector ||
  608. docElem.msMatchesSelector) )) ) {
  609. assert(function( div ) {
  610. // Check to see if it's possible to do matchesSelector
  611. // on a disconnected node (IE 9)
  612. support.disconnectedMatch = matches.call( div, "div" );
  613. // This should fail with an exception
  614. // Gecko does not error, returns false instead
  615. matches.call( div, "[s!='']:x" );
  616. rbuggyMatches.push( "!=", pseudos );
  617. });
  618. }
  619. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  620. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  621. /* Contains
  622. ---------------------------------------------------------------------- */
  623. hasCompare = rnative.test( docElem.compareDocumentPosition );
  624. // Element contains another
  625. // Purposefully self-exclusive
  626. // As in, an element does not contain itself
  627. contains = hasCompare || rnative.test( docElem.contains ) ?
  628. function( a, b ) {
  629. var adown = a.nodeType === 9 ? a.documentElement : a,
  630. bup = b && b.parentNode;
  631. return a === bup || !!( bup && bup.nodeType === 1 && (
  632. adown.contains ?
  633. adown.contains( bup ) :
  634. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  635. ));
  636. } :
  637. function( a, b ) {
  638. if ( b ) {
  639. while ( (b = b.parentNode) ) {
  640. if ( b === a ) {
  641. return true;
  642. }
  643. }
  644. }
  645. return false;
  646. };
  647. /* Sorting
  648. ---------------------------------------------------------------------- */
  649. // Document order sorting
  650. sortOrder = hasCompare ?
  651. function( a, b ) {
  652. // Flag for duplicate removal
  653. if ( a === b ) {
  654. hasDuplicate = true;
  655. return 0;
  656. }
  657. // Sort on method existence if only one input has compareDocumentPosition
  658. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  659. if ( compare ) {
  660. return compare;
  661. }
  662. // Calculate position if both inputs belong to the same document
  663. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  664. a.compareDocumentPosition( b ) :
  665. // Otherwise we know they are disconnected
  666. 1;
  667. // Disconnected nodes
  668. if ( compare & 1 ||
  669. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  670. // Choose the first element that is related to our preferred document
  671. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  672. return -1;
  673. }
  674. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  675. return 1;
  676. }
  677. // Maintain original order
  678. return sortInput ?
  679. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  680. 0;
  681. }
  682. return compare & 4 ? -1 : 1;
  683. } :
  684. function( a, b ) {
  685. // Exit early if the nodes are identical
  686. if ( a === b ) {
  687. hasDuplicate = true;
  688. return 0;
  689. }
  690. var cur,
  691. i = 0,
  692. aup = a.parentNode,
  693. bup = b.parentNode,
  694. ap = [ a ],
  695. bp = [ b ];
  696. // Parentless nodes are either documents or disconnected
  697. if ( !aup || !bup ) {
  698. return a === document ? -1 :
  699. b === document ? 1 :
  700. aup ? -1 :
  701. bup ? 1 :
  702. sortInput ?
  703. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  704. 0;
  705. // If the nodes are siblings, we can do a quick check
  706. } else if ( aup === bup ) {
  707. return siblingCheck( a, b );
  708. }
  709. // Otherwise we need full lists of their ancestors for comparison
  710. cur = a;
  711. while ( (cur = cur.parentNode) ) {
  712. ap.unshift( cur );
  713. }
  714. cur = b;
  715. while ( (cur = cur.parentNode) ) {
  716. bp.unshift( cur );
  717. }
  718. // Walk down the tree looking for a discrepancy
  719. while ( ap[i] === bp[i] ) {
  720. i++;
  721. }
  722. return i ?
  723. // Do a sibling check if the nodes have a common ancestor
  724. siblingCheck( ap[i], bp[i] ) :
  725. // Otherwise nodes in our document sort first
  726. ap[i] === preferredDoc ? -1 :
  727. bp[i] === preferredDoc ? 1 :
  728. 0;
  729. };
  730. return document;
  731. };
  732. Sizzle.matches = function( expr, elements ) {
  733. return Sizzle( expr, null, null, elements );
  734. };
  735. Sizzle.matchesSelector = function( elem, expr ) {
  736. // Set document vars if needed
  737. if ( ( elem.ownerDocument || elem ) !== document ) {
  738. setDocument( elem );
  739. }
  740. // Make sure that attribute selectors are quoted
  741. expr = expr.replace( rattributeQuotes, "='$1']" );
  742. if ( support.matchesSelector && documentIsHTML &&
  743. !compilerCache[ expr + " " ] &&
  744. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  745. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  746. try {
  747. var ret = matches.call( elem, expr );
  748. // IE 9's matchesSelector returns false on disconnected nodes
  749. if ( ret || support.disconnectedMatch ||
  750. // As well, disconnected nodes are said to be in a document
  751. // fragment in IE 9
  752. elem.document && elem.document.nodeType !== 11 ) {
  753. return ret;
  754. }
  755. } catch (e) {}
  756. }
  757. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  758. };
  759. Sizzle.contains = function( context, elem ) {
  760. // Set document vars if needed
  761. if ( ( context.ownerDocument || context ) !== document ) {
  762. setDocument( context );
  763. }
  764. return contains( context, elem );
  765. };
  766. Sizzle.attr = function( elem, name ) {
  767. // Set document vars if needed
  768. if ( ( elem.ownerDocument || elem ) !== document ) {
  769. setDocument( elem );
  770. }
  771. var fn = Expr.attrHandle[ name.toLowerCase() ],
  772. // Don't get fooled by Object.prototype properties (jQuery #13807)
  773. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  774. fn( elem, name, !documentIsHTML ) :
  775. undefined;
  776. return val !== undefined ?
  777. val :
  778. support.attributes || !documentIsHTML ?
  779. elem.getAttribute( name ) :
  780. (val = elem.getAttributeNode(name)) && val.specified ?
  781. val.value :
  782. null;
  783. };
  784. Sizzle.error = function( msg ) {
  785. throw new Error( "Syntax error, unrecognized expression: " + msg );
  786. };
  787. /**
  788. * Document sorting and removing duplicates
  789. * @param {ArrayLike} results
  790. */
  791. Sizzle.uniqueSort = function( results ) {
  792. var elem,
  793. duplicates = [],
  794. j = 0,
  795. i = 0;
  796. // Unless we *know* we can detect duplicates, assume their presence
  797. hasDuplicate = !support.detectDuplicates;
  798. sortInput = !support.sortStable && results.slice( 0 );
  799. results.sort( sortOrder );
  800. if ( hasDuplicate ) {
  801. while ( (elem = results[i++]) ) {
  802. if ( elem === results[ i ] ) {
  803. j = duplicates.push( i );
  804. }
  805. }
  806. while ( j-- ) {
  807. results.splice( duplicates[ j ], 1 );
  808. }
  809. }
  810. // Clear input after sorting to release objects
  811. // See https://github.com/jquery/sizzle/pull/225
  812. sortInput = null;
  813. return results;
  814. };
  815. /**
  816. * Utility function for retrieving the text value of an array of DOM nodes
  817. * @param {Array|Element} elem
  818. */
  819. getText = Sizzle.getText = function( elem ) {
  820. var node,
  821. ret = "",
  822. i = 0,
  823. nodeType = elem.nodeType;
  824. if ( !nodeType ) {
  825. // If no nodeType, this is expected to be an array
  826. while ( (node = elem[i++]) ) {
  827. // Do not traverse comment nodes
  828. ret += getText( node );
  829. }
  830. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  831. // Use textContent for elements
  832. // innerText usage removed for consistency of new lines (jQuery #11153)
  833. if ( typeof elem.textContent === "string" ) {
  834. return elem.textContent;
  835. } else {
  836. // Traverse its children
  837. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  838. ret += getText( elem );
  839. }
  840. }
  841. } else if ( nodeType === 3 || nodeType === 4 ) {
  842. return elem.nodeValue;
  843. }
  844. // Do not include comment or processing instruction nodes
  845. return ret;
  846. };
  847. Expr = Sizzle.selectors = {
  848. // Can be adjusted by the user
  849. cacheLength: 50,
  850. createPseudo: markFunction,
  851. match: matchExpr,
  852. attrHandle: {},
  853. find: {},
  854. relative: {
  855. ">": { dir: "parentNode", first: true },
  856. " ": { dir: "parentNode" },
  857. "+": { dir: "previousSibling", first: true },
  858. "~": { dir: "previousSibling" }
  859. },
  860. preFilter: {
  861. "ATTR": function( match ) {
  862. match[1] = match[1].replace( runescape, funescape );
  863. // Move the given value to match[3] whether quoted or unquoted
  864. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  865. if ( match[2] === "~=" ) {
  866. match[3] = " " + match[3] + " ";
  867. }
  868. return match.slice( 0, 4 );
  869. },
  870. "CHILD": function( match ) {
  871. /* matches from matchExpr["CHILD"]
  872. 1 type (only|nth|...)
  873. 2 what (child|of-type)
  874. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  875. 4 xn-component of xn+y argument ([+-]?\d*n|)
  876. 5 sign of xn-component
  877. 6 x of xn-component
  878. 7 sign of y-component
  879. 8 y of y-component
  880. */
  881. match[1] = match[1].toLowerCase();
  882. if ( match[1].slice( 0, 3 ) === "nth" ) {
  883. // nth-* requires argument
  884. if ( !match[3] ) {
  885. Sizzle.error( match[0] );
  886. }
  887. // numeric x and y parameters for Expr.filter.CHILD
  888. // remember that false/true cast respectively to 0/1
  889. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  890. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  891. // other types prohibit arguments
  892. } else if ( match[3] ) {
  893. Sizzle.error( match[0] );
  894. }
  895. return match;
  896. },
  897. "PSEUDO": function( match ) {
  898. var excess,
  899. unquoted = !match[6] && match[2];
  900. if ( matchExpr["CHILD"].test( match[0] ) ) {
  901. return null;
  902. }
  903. // Accept quoted arguments as-is
  904. if ( match[3] ) {
  905. match[2] = match[4] || match[5] || "";
  906. // Strip excess characters from unquoted arguments
  907. } else if ( unquoted && rpseudo.test( unquoted ) &&
  908. // Get excess from tokenize (recursively)
  909. (excess = tokenize( unquoted, true )) &&
  910. // advance to the next closing parenthesis
  911. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  912. // excess is a negative index
  913. match[0] = match[0].slice( 0, excess );
  914. match[2] = unquoted.slice( 0, excess );
  915. }
  916. // Return only captures needed by the pseudo filter method (type and argument)
  917. return match.slice( 0, 3 );
  918. }
  919. },
  920. filter: {
  921. "TAG": function( nodeNameSelector ) {
  922. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  923. return nodeNameSelector === "*" ?
  924. function() { return true; } :
  925. function( elem ) {
  926. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  927. };
  928. },
  929. "CLASS": function( className ) {
  930. var pattern = classCache[ className + " " ];
  931. return pattern ||
  932. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  933. classCache( className, function( elem ) {
  934. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  935. });
  936. },
  937. "ATTR": function( name, operator, check ) {
  938. return function( elem ) {
  939. var result = Sizzle.attr( elem, name );
  940. if ( result == null ) {
  941. return operator === "!=";
  942. }
  943. if ( !operator ) {
  944. return true;
  945. }
  946. result += "";
  947. return operator === "=" ? result === check :
  948. operator === "!=" ? result !== check :
  949. operator === "^=" ? check && result.indexOf( check ) === 0 :
  950. operator === "*=" ? check && result.indexOf( check ) > -1 :
  951. operator === "$=" ? check && result.slice( -check.length ) === check :
  952. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  953. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  954. false;
  955. };
  956. },
  957. "CHILD": function( type, what, argument, first, last ) {
  958. var simple = type.slice( 0, 3 ) !== "nth",
  959. forward = type.slice( -4 ) !== "last",
  960. ofType = what === "of-type";
  961. return first === 1 && last === 0 ?
  962. // Shortcut for :nth-*(n)
  963. function( elem ) {
  964. return !!elem.parentNode;
  965. } :
  966. function( elem, context, xml ) {
  967. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  968. dir = simple !== forward ? "nextSibling" : "previousSibling",
  969. parent = elem.parentNode,
  970. name = ofType && elem.nodeName.toLowerCase(),
  971. useCache = !xml && !ofType,
  972. diff = false;
  973. if ( parent ) {
  974. // :(first|last|only)-(child|of-type)
  975. if ( simple ) {
  976. while ( dir ) {
  977. node = elem;
  978. while ( (node = node[ dir ]) ) {
  979. if ( ofType ?
  980. node.nodeName.toLowerCase() === name :
  981. node.nodeType === 1 ) {
  982. return false;
  983. }
  984. }
  985. // Reverse direction for :only-* (if we haven't yet done so)
  986. start = dir = type === "only" && !start && "nextSibling";
  987. }
  988. return true;
  989. }
  990. start = [ forward ? parent.firstChild : parent.lastChild ];
  991. // non-xml :nth-child(...) stores cache data on `parent`
  992. if ( forward && useCache ) {
  993. // Seek `elem` from a previously-cached index
  994. // ...in a gzip-friendly way
  995. node = parent;
  996. outerCache = node[ expando ] || (node[ expando ] = {});
  997. // Support: IE <9 only
  998. // Defend against cloned attroperties (jQuery gh-1709)
  999. uniqueCache = outerCache[ node.uniqueID ] ||
  1000. (outerCache[ node.uniqueID ] = {});
  1001. cache = uniqueCache[ type ] || [];
  1002. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1003. diff = nodeIndex && cache[ 2 ];
  1004. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1005. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1006. // Fallback to seeking `elem` from the start
  1007. (diff = nodeIndex = 0) || start.pop()) ) {
  1008. // When found, cache indexes on `parent` and break
  1009. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1010. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1011. break;
  1012. }
  1013. }
  1014. } else {
  1015. // Use previously-cached element index if available
  1016. if ( useCache ) {
  1017. // ...in a gzip-friendly way
  1018. node = elem;
  1019. outerCache = node[ expando ] || (node[ expando ] = {});
  1020. // Support: IE <9 only
  1021. // Defend against cloned attroperties (jQuery gh-1709)
  1022. uniqueCache = outerCache[ node.uniqueID ] ||
  1023. (outerCache[ node.uniqueID ] = {});
  1024. cache = uniqueCache[ type ] || [];
  1025. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1026. diff = nodeIndex;
  1027. }
  1028. // xml :nth-child(...)
  1029. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1030. if ( diff === false ) {
  1031. // Use the same loop as above to seek `elem` from the start
  1032. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1033. (diff = nodeIndex = 0) || start.pop()) ) {
  1034. if ( ( ofType ?
  1035. node.nodeName.toLowerCase() === name :
  1036. node.nodeType === 1 ) &&
  1037. ++diff ) {
  1038. // Cache the index of each encountered element
  1039. if ( useCache ) {
  1040. outerCache = node[ expando ] || (node[ expando ] = {});
  1041. // Support: IE <9 only
  1042. // Defend against cloned attroperties (jQuery gh-1709)
  1043. uniqueCache = outerCache[ node.uniqueID ] ||
  1044. (outerCache[ node.uniqueID ] = {});
  1045. uniqueCache[ type ] = [ dirruns, diff ];
  1046. }
  1047. if ( node === elem ) {
  1048. break;
  1049. }
  1050. }
  1051. }
  1052. }
  1053. }
  1054. // Incorporate the offset, then check against cycle size
  1055. diff -= last;
  1056. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1057. }
  1058. };
  1059. },
  1060. "PSEUDO": function( pseudo, argument ) {
  1061. // pseudo-class names are case-insensitive
  1062. // http://www.w3.org/TR/selectors/#pseudo-classes
  1063. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1064. // Remember that setFilters inherits from pseudos
  1065. var args,
  1066. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1067. Sizzle.error( "unsupported pseudo: " + pseudo );
  1068. // The user may use createPseudo to indicate that
  1069. // arguments are needed to create the filter function
  1070. // just as Sizzle does
  1071. if ( fn[ expando ] ) {
  1072. return fn( argument );
  1073. }
  1074. // But maintain support for old signatures
  1075. if ( fn.length > 1 ) {
  1076. args = [ pseudo, pseudo, "", argument ];
  1077. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1078. markFunction(function( seed, matches ) {
  1079. var idx,
  1080. matched = fn( seed, argument ),
  1081. i = matched.length;
  1082. while ( i-- ) {
  1083. idx = indexOf( seed, matched[i] );
  1084. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1085. }
  1086. }) :
  1087. function( elem ) {
  1088. return fn( elem, 0, args );
  1089. };
  1090. }
  1091. return fn;
  1092. }
  1093. },
  1094. pseudos: {
  1095. // Potentially complex pseudos
  1096. "not": markFunction(function( selector ) {
  1097. // Trim the selector passed to compile
  1098. // to avoid treating leading and trailing
  1099. // spaces as combinators
  1100. var input = [],
  1101. results = [],
  1102. matcher = compile( selector.replace( rtrim, "$1" ) );
  1103. return matcher[ expando ] ?
  1104. markFunction(function( seed, matches, context, xml ) {
  1105. var elem,
  1106. unmatched = matcher( seed, null, xml, [] ),
  1107. i = seed.length;
  1108. // Match elements unmatched by `matcher`
  1109. while ( i-- ) {
  1110. if ( (elem = unmatched[i]) ) {
  1111. seed[i] = !(matches[i] = elem);
  1112. }
  1113. }
  1114. }) :
  1115. function( elem, context, xml ) {
  1116. input[0] = elem;
  1117. matcher( input, null, xml, results );
  1118. // Don't keep the element (issue #299)
  1119. input[0] = null;
  1120. return !results.pop();
  1121. };
  1122. }),
  1123. "has": markFunction(function( selector ) {
  1124. return function( elem ) {
  1125. return Sizzle( selector, elem ).length > 0;
  1126. };
  1127. }),
  1128. "contains": markFunction(function( text ) {
  1129. text = text.replace( runescape, funescape );
  1130. return function( elem ) {
  1131. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1132. };
  1133. }),
  1134. // "Whether an element is represented by a :lang() selector
  1135. // is based solely on the element's language value
  1136. // being equal to the identifier C,
  1137. // or beginning with the identifier C immediately followed by "-".
  1138. // The matching of C against the element's language value is performed case-insensitively.
  1139. // The identifier C does not have to be a valid language name."
  1140. // http://www.w3.org/TR/selectors/#lang-pseudo
  1141. "lang": markFunction( function( lang ) {
  1142. // lang value must be a valid identifier
  1143. if ( !ridentifier.test(lang || "") ) {
  1144. Sizzle.error( "unsupported lang: " + lang );
  1145. }
  1146. lang = lang.replace( runescape, funescape ).toLowerCase();
  1147. return function( elem ) {
  1148. var elemLang;
  1149. do {
  1150. if ( (elemLang = documentIsHTML ?
  1151. elem.lang :
  1152. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1153. elemLang = elemLang.toLowerCase();
  1154. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1155. }
  1156. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1157. return false;
  1158. };
  1159. }),
  1160. // Miscellaneous
  1161. "target": function( elem ) {
  1162. var hash = window.location && window.location.hash;
  1163. return hash && hash.slice( 1 ) === elem.id;
  1164. },
  1165. "root": function( elem ) {
  1166. return elem === docElem;
  1167. },
  1168. "focus": function( elem ) {
  1169. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1170. },
  1171. // Boolean properties
  1172. "enabled": function( elem ) {
  1173. return elem.disabled === false;
  1174. },
  1175. "disabled": function( elem ) {
  1176. return elem.disabled === true;
  1177. },
  1178. "checked": function( elem ) {
  1179. // In CSS3, :checked should return both checked and selected elements
  1180. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1181. var nodeName = elem.nodeName.toLowerCase();
  1182. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1183. },
  1184. "selected": function( elem ) {
  1185. // Accessing this property makes selected-by-default
  1186. // options in Safari work properly
  1187. if ( elem.parentNode ) {
  1188. elem.parentNode.selectedIndex;
  1189. }
  1190. return elem.selected === true;
  1191. },
  1192. // Contents
  1193. "empty": function( elem ) {
  1194. // http://www.w3.org/TR/selectors/#empty-pseudo
  1195. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1196. // but not by others (comment: 8; processing instruction: 7; etc.)
  1197. // nodeType < 6 works because attributes (2) do not appear as children
  1198. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1199. if ( elem.nodeType < 6 ) {
  1200. return false;
  1201. }
  1202. }
  1203. return true;
  1204. },
  1205. "parent": function( elem ) {
  1206. return !Expr.pseudos["empty"]( elem );
  1207. },
  1208. // Element/input types
  1209. "header": function( elem ) {
  1210. return rheader.test( elem.nodeName );
  1211. },
  1212. "input": function( elem ) {
  1213. return rinputs.test( elem.nodeName );
  1214. },
  1215. "button": function( elem ) {
  1216. var name = elem.nodeName.toLowerCase();
  1217. return name === "input" && elem.type === "button" || name === "button";
  1218. },
  1219. "text": function( elem ) {
  1220. var attr;
  1221. return elem.nodeName.toLowerCase() === "input" &&
  1222. elem.type === "text" &&
  1223. // Support: IE<8
  1224. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1225. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1226. },
  1227. // Position-in-collection
  1228. "first": createPositionalPseudo(function() {
  1229. return [ 0 ];
  1230. }),
  1231. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1232. return [ length - 1 ];
  1233. }),
  1234. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1235. return [ argument < 0 ? argument + length : argument ];
  1236. }),
  1237. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1238. var i = 0;
  1239. for ( ; i < length; i += 2 ) {
  1240. matchIndexes.push( i );
  1241. }
  1242. return matchIndexes;
  1243. }),
  1244. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1245. var i = 1;
  1246. for ( ; i < length; i += 2 ) {
  1247. matchIndexes.push( i );
  1248. }
  1249. return matchIndexes;
  1250. }),
  1251. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1252. var i = argument < 0 ? argument + length : argument;
  1253. for ( ; --i >= 0; ) {
  1254. matchIndexes.push( i );
  1255. }
  1256. return matchIndexes;
  1257. }),
  1258. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1259. var i = argument < 0 ? argument + length : argument;
  1260. for ( ; ++i < length; ) {
  1261. matchIndexes.push( i );
  1262. }
  1263. return matchIndexes;
  1264. })
  1265. }
  1266. };
  1267. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1268. // Add button/input type pseudos
  1269. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1270. Expr.pseudos[ i ] = createInputPseudo( i );
  1271. }
  1272. for ( i in { submit: true, reset: true } ) {
  1273. Expr.pseudos[ i ] = createButtonPseudo( i );
  1274. }
  1275. // Easy API for creating new setFilters
  1276. function setFilters() {}
  1277. setFilters.prototype = Expr.filters = Expr.pseudos;
  1278. Expr.setFilters = new setFilters();
  1279. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1280. var matched, match, tokens, type,
  1281. soFar, groups, preFilters,
  1282. cached = tokenCache[ selector + " " ];
  1283. if ( cached ) {
  1284. return parseOnly ? 0 : cached.slice( 0 );
  1285. }
  1286. soFar = selector;
  1287. groups = [];
  1288. preFilters = Expr.preFilter;
  1289. while ( soFar ) {
  1290. // Comma and first run
  1291. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1292. if ( match ) {
  1293. // Don't consume trailing commas as valid
  1294. soFar = soFar.slice( match[0].length ) || soFar;
  1295. }
  1296. groups.push( (tokens = []) );
  1297. }
  1298. matched = false;
  1299. // Combinators
  1300. if ( (match = rcombinators.exec( soFar )) ) {
  1301. matched = match.shift();
  1302. tokens.push({
  1303. value: matched,
  1304. // Cast descendant combinators to space
  1305. type: match[0].replace( rtrim, " " )
  1306. });
  1307. soFar = soFar.slice( matched.length );
  1308. }
  1309. // Filters
  1310. for ( type in Expr.filter ) {
  1311. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1312. (match = preFilters[ type ]( match ))) ) {
  1313. matched = match.shift();
  1314. tokens.push({
  1315. value: matched,
  1316. type: type,
  1317. matches: match
  1318. });
  1319. soFar = soFar.slice( matched.length );
  1320. }
  1321. }
  1322. if ( !matched ) {
  1323. break;
  1324. }
  1325. }
  1326. // Return the length of the invalid excess
  1327. // if we're just parsing
  1328. // Otherwise, throw an error or return tokens
  1329. return parseOnly ?
  1330. soFar.length :
  1331. soFar ?
  1332. Sizzle.error( selector ) :
  1333. // Cache the tokens
  1334. tokenCache( selector, groups ).slice( 0 );
  1335. };
  1336. function toSelector( tokens ) {
  1337. var i = 0,
  1338. len = tokens.length,
  1339. selector = "";
  1340. for ( ; i < len; i++ ) {
  1341. selector += tokens[i].value;
  1342. }
  1343. return selector;
  1344. }
  1345. function addCombinator( matcher, combinator, base ) {
  1346. var dir = combinator.dir,
  1347. checkNonElements = base && dir === "parentNode",
  1348. doneName = done++;
  1349. return combinator.first ?
  1350. // Check against closest ancestor/preceding element
  1351. function( elem, context, xml ) {
  1352. while ( (elem = elem[ dir ]) ) {
  1353. if ( elem.nodeType === 1 || checkNonElements ) {
  1354. return matcher( elem, context, xml );
  1355. }
  1356. }
  1357. } :
  1358. // Check against all ancestor/preceding elements
  1359. function( elem, context, xml ) {
  1360. var oldCache, uniqueCache, outerCache,
  1361. newCache = [ dirruns, doneName ];
  1362. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1363. if ( xml ) {
  1364. while ( (elem = elem[ dir ]) ) {
  1365. if ( elem.nodeType === 1 || checkNonElements ) {
  1366. if ( matcher( elem, context, xml ) ) {
  1367. return true;
  1368. }
  1369. }
  1370. }
  1371. } else {
  1372. while ( (elem = elem[ dir ]) ) {
  1373. if ( elem.nodeType === 1 || checkNonElements ) {
  1374. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1375. // Support: IE <9 only
  1376. // Defend against cloned attroperties (jQuery gh-1709)
  1377. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1378. if ( (oldCache = uniqueCache[ dir ]) &&
  1379. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1380. // Assign to newCache so results back-propagate to previous elements
  1381. return (newCache[ 2 ] = oldCache[ 2 ]);
  1382. } else {
  1383. // Reuse newcache so results back-propagate to previous elements
  1384. uniqueCache[ dir ] = newCache;
  1385. // A match means we're done; a fail means we have to keep checking
  1386. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1387. return true;
  1388. }
  1389. }
  1390. }
  1391. }
  1392. }
  1393. };
  1394. }
  1395. function elementMatcher( matchers ) {
  1396. return matchers.length > 1 ?
  1397. function( elem, context, xml ) {
  1398. var i = matchers.length;
  1399. while ( i-- ) {
  1400. if ( !matchers[i]( elem, context, xml ) ) {
  1401. return false;
  1402. }
  1403. }
  1404. return true;
  1405. } :
  1406. matchers[0];
  1407. }
  1408. function multipleContexts( selector, contexts, results ) {
  1409. var i = 0,
  1410. len = contexts.length;
  1411. for ( ; i < len; i++ ) {
  1412. Sizzle( selector, contexts[i], results );
  1413. }
  1414. return results;
  1415. }
  1416. function condense( unmatched, map, filter, context, xml ) {
  1417. var elem,
  1418. newUnmatched = [],
  1419. i = 0,
  1420. len = unmatched.length,
  1421. mapped = map != null;
  1422. for ( ; i < len; i++ ) {
  1423. if ( (elem = unmatched[i]) ) {
  1424. if ( !filter || filter( elem, context, xml ) ) {
  1425. newUnmatched.push( elem );
  1426. if ( mapped ) {
  1427. map.push( i );
  1428. }
  1429. }
  1430. }
  1431. }
  1432. return newUnmatched;
  1433. }
  1434. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1435. if ( postFilter && !postFilter[ expando ] ) {
  1436. postFilter = setMatcher( postFilter );
  1437. }
  1438. if ( postFinder && !postFinder[ expando ] ) {
  1439. postFinder = setMatcher( postFinder, postSelector );
  1440. }
  1441. return markFunction(function( seed, results, context, xml ) {
  1442. var temp, i, elem,
  1443. preMap = [],
  1444. postMap = [],
  1445. preexisting = results.length,
  1446. // Get initial elements from seed or context
  1447. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1448. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1449. matcherIn = preFilter && ( seed || !selector ) ?
  1450. condense( elems, preMap, preFilter, context, xml ) :
  1451. elems,
  1452. matcherOut = matcher ?
  1453. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1454. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1455. // ...intermediate processing is necessary
  1456. [] :
  1457. // ...otherwise use results directly
  1458. results :
  1459. matcherIn;
  1460. // Find primary matches
  1461. if ( matcher ) {
  1462. matcher( matcherIn, matcherOut, context, xml );
  1463. }
  1464. // Apply postFilter
  1465. if ( postFilter ) {
  1466. temp = condense( matcherOut, postMap );
  1467. postFilter( temp, [], context, xml );
  1468. // Un-match failing elements by moving them back to matcherIn
  1469. i = temp.length;
  1470. while ( i-- ) {
  1471. if ( (elem = temp[i]) ) {
  1472. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1473. }
  1474. }
  1475. }
  1476. if ( seed ) {
  1477. if ( postFinder || preFilter ) {
  1478. if ( postFinder ) {
  1479. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1480. temp = [];
  1481. i = matcherOut.length;
  1482. while ( i-- ) {
  1483. if ( (elem = matcherOut[i]) ) {
  1484. // Restore matcherIn since elem is not yet a final match
  1485. temp.push( (matcherIn[i] = elem) );
  1486. }
  1487. }
  1488. postFinder( null, (matcherOut = []), temp, xml );
  1489. }
  1490. // Move matched elements from seed to results to keep them synchronized
  1491. i = matcherOut.length;
  1492. while ( i-- ) {
  1493. if ( (elem = matcherOut[i]) &&
  1494. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1495. seed[temp] = !(results[temp] = elem);
  1496. }
  1497. }
  1498. }
  1499. // Add elements to results, through postFinder if defined
  1500. } else {
  1501. matcherOut = condense(
  1502. matcherOut === results ?
  1503. matcherOut.splice( preexisting, matcherOut.length ) :
  1504. matcherOut
  1505. );
  1506. if ( postFinder ) {
  1507. postFinder( null, results, matcherOut, xml );
  1508. } else {
  1509. push.apply( results, matcherOut );
  1510. }
  1511. }
  1512. });
  1513. }
  1514. function matcherFromTokens( tokens ) {
  1515. var checkContext, matcher, j,
  1516. len = tokens.length,
  1517. leadingRelative = Expr.relative[ tokens[0].type ],
  1518. implicitRelative = leadingRelative || Expr.relative[" "],
  1519. i = leadingRelative ? 1 : 0,
  1520. // The foundational matcher ensures that elements are reachable from top-level context(s)
  1521. matchContext = addCombinator( function( elem ) {
  1522. return elem === checkContext;
  1523. }, implicitRelative, true ),
  1524. matchAnyContext = addCombinator( function( elem ) {
  1525. return indexOf( checkContext, elem ) > -1;
  1526. }, implicitRelative, true ),
  1527. matchers = [ function( elem, context, xml ) {
  1528. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  1529. (checkContext = context).nodeType ?
  1530. matchContext( elem, context, xml ) :
  1531. matchAnyContext( elem, context, xml ) );
  1532. // Avoid hanging onto element (issue #299)
  1533. checkContext = null;
  1534. return ret;
  1535. } ];
  1536. for ( ; i < len; i++ ) {
  1537. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  1538. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  1539. } else {
  1540. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  1541. // Return special upon seeing a positional matcher
  1542. if ( matcher[ expando ] ) {
  1543. // Find the next relative operator (if any) for proper handling
  1544. j = ++i;
  1545. for ( ; j < len; j++ ) {
  1546. if ( Expr.relative[ tokens[j].type ] ) {
  1547. break;
  1548. }
  1549. }
  1550. return setMatcher(
  1551. i > 1 && elementMatcher( matchers ),
  1552. i > 1 && toSelector(
  1553. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  1554. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  1555. ).replace( rtrim, "$1" ),
  1556. matcher,
  1557. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  1558. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  1559. j < len && toSelector( tokens )
  1560. );
  1561. }
  1562. matchers.push( matcher );
  1563. }
  1564. }
  1565. return elementMatcher( matchers );
  1566. }
  1567. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  1568. var bySet = setMatchers.length > 0,
  1569. byElement = elementMatchers.length > 0,
  1570. superMatcher = function( seed, context, xml, results, outermost ) {
  1571. var elem, j, matcher,
  1572. matchedCount = 0,
  1573. i = "0",
  1574. unmatched = seed && [],
  1575. setMatched = [],
  1576. contextBackup = outermostContext,
  1577. // We must always have either seed elements or outermost context
  1578. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  1579. // Use integer dirruns iff this is the outermost matcher
  1580. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  1581. len = elems.length;
  1582. if ( outermost ) {
  1583. outermostContext = context === document || context || outermost;
  1584. }
  1585. // Add elements passing elementMatchers directly to results
  1586. // Support: IE<9, Safari
  1587. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  1588. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  1589. if ( byElement && elem ) {
  1590. j = 0;
  1591. if ( !context && elem.ownerDocument !== document ) {
  1592. setDocument( elem );
  1593. xml = !documentIsHTML;
  1594. }
  1595. while ( (matcher = elementMatchers[j++]) ) {
  1596. if ( matcher( elem, context || document, xml) ) {
  1597. results.push( elem );
  1598. break;
  1599. }
  1600. }
  1601. if ( outermost ) {
  1602. dirruns = dirrunsUnique;
  1603. }
  1604. }
  1605. // Track unmatched elements for set filters
  1606. if ( bySet ) {
  1607. // They will have gone through all possible matchers
  1608. if ( (elem = !matcher && elem) ) {
  1609. matchedCount--;
  1610. }
  1611. // Lengthen the array for every element, matched or not
  1612. if ( seed ) {
  1613. unmatched.push( elem );
  1614. }
  1615. }
  1616. }
  1617. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  1618. // makes the latter nonnegative.
  1619. matchedCount += i;
  1620. // Apply set filters to unmatched elements
  1621. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  1622. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  1623. // no element matchers and no seed.
  1624. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  1625. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  1626. // numerically zero.
  1627. if ( bySet && i !== matchedCount ) {
  1628. j = 0;
  1629. while ( (matcher = setMatchers[j++]) ) {
  1630. matcher( unmatched, setMatched, context, xml );
  1631. }
  1632. if ( seed ) {
  1633. // Reintegrate element matches to eliminate the need for sorting
  1634. if ( matchedCount > 0 ) {
  1635. while ( i-- ) {
  1636. if ( !(unmatched[i] || setMatched[i]) ) {
  1637. setMatched[i] = pop.call( results );
  1638. }
  1639. }
  1640. }
  1641. // Discard index placeholder values to get only actual matches
  1642. setMatched = condense( setMatched );
  1643. }
  1644. // Add matches to results
  1645. push.apply( results, setMatched );
  1646. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  1647. if ( outermost && !seed && setMatched.length > 0 &&
  1648. ( matchedCount + setMatchers.length ) > 1 ) {
  1649. Sizzle.uniqueSort( results );
  1650. }
  1651. }
  1652. // Override manipulation of globals by nested matchers
  1653. if ( outermost ) {
  1654. dirruns = dirrunsUnique;
  1655. outermostContext = contextBackup;
  1656. }
  1657. return unmatched;
  1658. };
  1659. return bySet ?
  1660. markFunction( superMatcher ) :
  1661. superMatcher;
  1662. }
  1663. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  1664. var i,
  1665. setMatchers = [],
  1666. elementMatchers = [],
  1667. cached = compilerCache[ selector + " " ];
  1668. if ( !cached ) {
  1669. // Generate a function of recursive functions that can be used to check each element
  1670. if ( !match ) {
  1671. match = tokenize( selector );
  1672. }
  1673. i = match.length;
  1674. while ( i-- ) {
  1675. cached = matcherFromTokens( match[i] );
  1676. if ( cached[ expando ] ) {
  1677. setMatchers.push( cached );
  1678. } else {
  1679. elementMatchers.push( cached );
  1680. }
  1681. }
  1682. // Cache the compiled function
  1683. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  1684. // Save selector and tokenization
  1685. cached.selector = selector;
  1686. }
  1687. return cached;
  1688. };
  1689. /**
  1690. * A low-level selection function that works with Sizzle's compiled
  1691. * selector functions
  1692. * @param {String|Function} selector A selector or a pre-compiled
  1693. * selector function built with Sizzle.compile
  1694. * @param {Element} context
  1695. * @param {Array} [results]
  1696. * @param {Array} [seed] A set of elements to match against
  1697. */
  1698. select = Sizzle.select = function( selector, context, results, seed ) {
  1699. var i, tokens, token, type, find,
  1700. compiled = typeof selector === "function" && selector,
  1701. match = !seed && tokenize( (selector = compiled.selector || selector) );
  1702. results = results || [];
  1703. // Try to minimize operations if there is only one selector in the list and no seed
  1704. // (the latter of which guarantees us context)
  1705. if ( match.length === 1 ) {
  1706. // Reduce context if the leading compound selector is an ID
  1707. tokens = match[0] = match[0].slice( 0 );
  1708. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  1709. support.getById && context.nodeType === 9 && documentIsHTML &&
  1710. Expr.relative[ tokens[1].type ] ) {
  1711. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  1712. if ( !context ) {
  1713. return results;
  1714. // Precompiled matchers will still verify ancestry, so step up a level
  1715. } else if ( compiled ) {
  1716. context = context.parentNode;
  1717. }
  1718. selector = selector.slice( tokens.shift().value.length );
  1719. }
  1720. // Fetch a seed set for right-to-left matching
  1721. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  1722. while ( i-- ) {
  1723. token = tokens[i];
  1724. // Abort if we hit a combinator
  1725. if ( Expr.relative[ (type = token.type) ] ) {
  1726. break;
  1727. }
  1728. if ( (find = Expr.find[ type ]) ) {
  1729. // Search, expanding context for leading sibling combinators
  1730. if ( (seed = find(
  1731. token.matches[0].replace( runescape, funescape ),
  1732. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  1733. )) ) {
  1734. // If seed is empty or no tokens remain, we can return early
  1735. tokens.splice( i, 1 );
  1736. selector = seed.length && toSelector( tokens );
  1737. if ( !selector ) {
  1738. push.apply( results, seed );
  1739. return results;
  1740. }
  1741. break;
  1742. }
  1743. }
  1744. }
  1745. }
  1746. // Compile and execute a filtering function if one is not provided
  1747. // Provide `match` to avoid retokenization if we modified the selector above
  1748. ( compiled || compile( selector, match ) )(
  1749. seed,
  1750. context,
  1751. !documentIsHTML,
  1752. results,
  1753. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  1754. );
  1755. return results;
  1756. };
  1757. // One-time assignments
  1758. // Sort stability
  1759. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  1760. // Support: Chrome 14-35+
  1761. // Always assume duplicates if they aren't passed to the comparison function
  1762. support.detectDuplicates = !!hasDuplicate;
  1763. // Initialize against the default document
  1764. setDocument();
  1765. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  1766. // Detached nodes confoundingly follow *each other*
  1767. support.sortDetached = assert(function( div1 ) {
  1768. // Should return 1, but returns 4 (following)
  1769. return div1.compareDocumentPosition( document.createElement("div") ) & 1;
  1770. });
  1771. // Support: IE<8
  1772. // Prevent attribute/property "interpolation"
  1773. // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  1774. if ( !assert(function( div ) {
  1775. div.innerHTML = "<a href='#'></a>";
  1776. return div.firstChild.getAttribute("href") === "#" ;
  1777. }) ) {
  1778. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  1779. if ( !isXML ) {
  1780. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  1781. }
  1782. });
  1783. }
  1784. // Support: IE<9
  1785. // Use defaultValue in place of getAttribute("value")
  1786. if ( !support.attributes || !assert(function( div ) {
  1787. div.innerHTML = "<input/>";
  1788. div.firstChild.setAttribute( "value", "" );
  1789. return div.firstChild.getAttribute( "value" ) === "";
  1790. }) ) {
  1791. addHandle( "value", function( elem, name, isXML ) {
  1792. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  1793. return elem.defaultValue;
  1794. }
  1795. });
  1796. }
  1797. // Support: IE<9
  1798. // Use getAttributeNode to fetch booleans when getAttribute lies
  1799. if ( !assert(function( div ) {
  1800. return div.getAttribute("disabled") == null;
  1801. }) ) {
  1802. addHandle( booleans, function( elem, name, isXML ) {
  1803. var val;
  1804. if ( !isXML ) {
  1805. return elem[ name ] === true ? name.toLowerCase() :
  1806. (val = elem.getAttributeNode( name )) && val.specified ?
  1807. val.value :
  1808. null;
  1809. }
  1810. });
  1811. }
  1812. // EXPOSE
  1813. if ( typeof define === "function" && define.amd ) {
  1814. define(function() { return Sizzle; });
  1815. // Sizzle requires that there be a global window in Common-JS like environments
  1816. } else if ( typeof module !== "undefined" && module.exports ) {
  1817. module.exports = Sizzle;
  1818. } else {
  1819. window.Sizzle = Sizzle;
  1820. }
  1821. // EXPOSE
  1822. })( window );