PageRenderTime 51ms CodeModel.GetById 2ms RepoModel.GetById 0ms app.codeStats 3ms

/public/assets/admin/application-2ec33b0347e5b490fc9aa8f9a1bc1984.js

https://gitlab.com/balajigalave/Ruby-CMS
JavaScript | 14667 lines | 9834 code | 2610 blank | 2223 comment | 2827 complexity | b172b37411e7fc1590fd19da57d992b5 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. /*!
  2. * jQuery JavaScript Library v1.11.3
  3. * http://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * http://sizzlejs.com/
  7. *
  8. * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
  9. * Released under the MIT license
  10. * http://jquery.org/license
  11. *
  12. * Date: 2015-04-28T16:19Z
  13. */
  14. (function( global, factory ) {
  15. if ( typeof module === "object" && typeof module.exports === "object" ) {
  16. // For CommonJS and CommonJS-like environments where a proper window is present,
  17. // execute the factory and get jQuery
  18. // For environments that do not inherently posses a window with a document
  19. // (such as Node.js), expose a jQuery-making factory as module.exports
  20. // This accentuates the need for the creation of a real window
  21. // e.g. var jQuery = require("jquery")(window);
  22. // See ticket #14549 for more info
  23. module.exports = global.document ?
  24. factory( global, true ) :
  25. function( w ) {
  26. if ( !w.document ) {
  27. throw new Error( "jQuery requires a window with a document" );
  28. }
  29. return factory( w );
  30. };
  31. } else {
  32. factory( global );
  33. }
  34. // Pass this if window is not defined yet
  35. }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  36. // Can't do this because several apps including ASP.NET trace
  37. // the stack via arguments.caller.callee and Firefox dies if
  38. // you try to trace through "use strict" call chains. (#13335)
  39. // Support: Firefox 18+
  40. //
  41. var deletedIds = [];
  42. var slice = deletedIds.slice;
  43. var concat = deletedIds.concat;
  44. var push = deletedIds.push;
  45. var indexOf = deletedIds.indexOf;
  46. var class2type = {};
  47. var toString = class2type.toString;
  48. var hasOwn = class2type.hasOwnProperty;
  49. var support = {};
  50. var
  51. version = "1.11.3",
  52. // Define a local copy of jQuery
  53. jQuery = function( selector, context ) {
  54. // The jQuery object is actually just the init constructor 'enhanced'
  55. // Need init if jQuery is called (just allow error to be thrown if not included)
  56. return new jQuery.fn.init( selector, context );
  57. },
  58. // Support: Android<4.1, IE<9
  59. // Make sure we trim BOM and NBSP
  60. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  61. // Matches dashed string for camelizing
  62. rmsPrefix = /^-ms-/,
  63. rdashAlpha = /-([\da-z])/gi,
  64. // Used by jQuery.camelCase as callback to replace()
  65. fcamelCase = function( all, letter ) {
  66. return letter.toUpperCase();
  67. };
  68. jQuery.fn = jQuery.prototype = {
  69. // The current version of jQuery being used
  70. jquery: version,
  71. constructor: jQuery,
  72. // Start with an empty selector
  73. selector: "",
  74. // The default length of a jQuery object is 0
  75. length: 0,
  76. toArray: function() {
  77. return slice.call( this );
  78. },
  79. // Get the Nth element in the matched element set OR
  80. // Get the whole matched element set as a clean array
  81. get: function( num ) {
  82. return num != null ?
  83. // Return just the one element from the set
  84. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  85. // Return all the elements in a clean array
  86. slice.call( this );
  87. },
  88. // Take an array of elements and push it onto the stack
  89. // (returning the new matched element set)
  90. pushStack: function( elems ) {
  91. // Build a new jQuery matched element set
  92. var ret = jQuery.merge( this.constructor(), elems );
  93. // Add the old object onto the stack (as a reference)
  94. ret.prevObject = this;
  95. ret.context = this.context;
  96. // Return the newly-formed element set
  97. return ret;
  98. },
  99. // Execute a callback for every element in the matched set.
  100. // (You can seed the arguments with an array of args, but this is
  101. // only used internally.)
  102. each: function( callback, args ) {
  103. return jQuery.each( this, callback, args );
  104. },
  105. map: function( callback ) {
  106. return this.pushStack( jQuery.map(this, function( elem, i ) {
  107. return callback.call( elem, i, elem );
  108. }));
  109. },
  110. slice: function() {
  111. return this.pushStack( slice.apply( this, arguments ) );
  112. },
  113. first: function() {
  114. return this.eq( 0 );
  115. },
  116. last: function() {
  117. return this.eq( -1 );
  118. },
  119. eq: function( i ) {
  120. var len = this.length,
  121. j = +i + ( i < 0 ? len : 0 );
  122. return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
  123. },
  124. end: function() {
  125. return this.prevObject || this.constructor(null);
  126. },
  127. // For internal use only.
  128. // Behaves like an Array's method, not like a jQuery method.
  129. push: push,
  130. sort: deletedIds.sort,
  131. splice: deletedIds.splice
  132. };
  133. jQuery.extend = jQuery.fn.extend = function() {
  134. var src, copyIsArray, copy, name, options, clone,
  135. target = arguments[0] || {},
  136. i = 1,
  137. length = arguments.length,
  138. deep = false;
  139. // Handle a deep copy situation
  140. if ( typeof target === "boolean" ) {
  141. deep = target;
  142. // skip the boolean and the target
  143. target = arguments[ i ] || {};
  144. i++;
  145. }
  146. // Handle case when target is a string or something (possible in deep copy)
  147. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  148. target = {};
  149. }
  150. // extend jQuery itself if only one argument is passed
  151. if ( i === length ) {
  152. target = this;
  153. i--;
  154. }
  155. for ( ; i < length; i++ ) {
  156. // Only deal with non-null/undefined values
  157. if ( (options = arguments[ i ]) != null ) {
  158. // Extend the base object
  159. for ( name in options ) {
  160. src = target[ name ];
  161. copy = options[ name ];
  162. // Prevent never-ending loop
  163. if ( target === copy ) {
  164. continue;
  165. }
  166. // Recurse if we're merging plain objects or arrays
  167. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  168. if ( copyIsArray ) {
  169. copyIsArray = false;
  170. clone = src && jQuery.isArray(src) ? src : [];
  171. } else {
  172. clone = src && jQuery.isPlainObject(src) ? src : {};
  173. }
  174. // Never move original objects, clone them
  175. target[ name ] = jQuery.extend( deep, clone, copy );
  176. // Don't bring in undefined values
  177. } else if ( copy !== undefined ) {
  178. target[ name ] = copy;
  179. }
  180. }
  181. }
  182. }
  183. // Return the modified object
  184. return target;
  185. };
  186. jQuery.extend({
  187. // Unique for each copy of jQuery on the page
  188. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  189. // Assume jQuery is ready without the ready module
  190. isReady: true,
  191. error: function( msg ) {
  192. throw new Error( msg );
  193. },
  194. noop: function() {},
  195. // See test/unit/core.js for details concerning isFunction.
  196. // Since version 1.3, DOM methods and functions like alert
  197. // aren't supported. They return false on IE (#2968).
  198. isFunction: function( obj ) {
  199. return jQuery.type(obj) === "function";
  200. },
  201. isArray: Array.isArray || function( obj ) {
  202. return jQuery.type(obj) === "array";
  203. },
  204. isWindow: function( obj ) {
  205. /* jshint eqeqeq: false */
  206. return obj != null && obj == obj.window;
  207. },
  208. isNumeric: function( obj ) {
  209. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  210. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  211. // subtraction forces infinities to NaN
  212. // adding 1 corrects loss of precision from parseFloat (#15100)
  213. return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
  214. },
  215. isEmptyObject: function( obj ) {
  216. var name;
  217. for ( name in obj ) {
  218. return false;
  219. }
  220. return true;
  221. },
  222. isPlainObject: function( obj ) {
  223. var key;
  224. // Must be an Object.
  225. // Because of IE, we also have to check the presence of the constructor property.
  226. // Make sure that DOM nodes and window objects don't pass through, as well
  227. if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  228. return false;
  229. }
  230. try {
  231. // Not own constructor property must be Object
  232. if ( obj.constructor &&
  233. !hasOwn.call(obj, "constructor") &&
  234. !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
  235. return false;
  236. }
  237. } catch ( e ) {
  238. // IE8,9 Will throw exceptions on certain host objects #9897
  239. return false;
  240. }
  241. // Support: IE<9
  242. // Handle iteration over inherited properties before own properties.
  243. if ( support.ownLast ) {
  244. for ( key in obj ) {
  245. return hasOwn.call( obj, key );
  246. }
  247. }
  248. // Own properties are enumerated firstly, so to speed up,
  249. // if last one is own, then all properties are own.
  250. for ( key in obj ) {}
  251. return key === undefined || hasOwn.call( obj, key );
  252. },
  253. type: function( obj ) {
  254. if ( obj == null ) {
  255. return obj + "";
  256. }
  257. return typeof obj === "object" || typeof obj === "function" ?
  258. class2type[ toString.call(obj) ] || "object" :
  259. typeof obj;
  260. },
  261. // Evaluates a script in a global context
  262. // Workarounds based on findings by Jim Driscoll
  263. // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
  264. globalEval: function( data ) {
  265. if ( data && jQuery.trim( data ) ) {
  266. // We use execScript on Internet Explorer
  267. // We use an anonymous function so that context is window
  268. // rather than jQuery in Firefox
  269. ( window.execScript || function( data ) {
  270. window[ "eval" ].call( window, data );
  271. } )( data );
  272. }
  273. },
  274. // Convert dashed to camelCase; used by the css and data modules
  275. // Microsoft forgot to hump their vendor prefix (#9572)
  276. camelCase: function( string ) {
  277. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  278. },
  279. nodeName: function( elem, name ) {
  280. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  281. },
  282. // args is for internal usage only
  283. each: function( obj, callback, args ) {
  284. var value,
  285. i = 0,
  286. length = obj.length,
  287. isArray = isArraylike( obj );
  288. if ( args ) {
  289. if ( isArray ) {
  290. for ( ; i < length; i++ ) {
  291. value = callback.apply( obj[ i ], args );
  292. if ( value === false ) {
  293. break;
  294. }
  295. }
  296. } else {
  297. for ( i in obj ) {
  298. value = callback.apply( obj[ i ], args );
  299. if ( value === false ) {
  300. break;
  301. }
  302. }
  303. }
  304. // A special, fast, case for the most common use of each
  305. } else {
  306. if ( isArray ) {
  307. for ( ; i < length; i++ ) {
  308. value = callback.call( obj[ i ], i, obj[ i ] );
  309. if ( value === false ) {
  310. break;
  311. }
  312. }
  313. } else {
  314. for ( i in obj ) {
  315. value = callback.call( obj[ i ], i, obj[ i ] );
  316. if ( value === false ) {
  317. break;
  318. }
  319. }
  320. }
  321. }
  322. return obj;
  323. },
  324. // Support: Android<4.1, IE<9
  325. trim: function( text ) {
  326. return text == null ?
  327. "" :
  328. ( text + "" ).replace( rtrim, "" );
  329. },
  330. // results is for internal usage only
  331. makeArray: function( arr, results ) {
  332. var ret = results || [];
  333. if ( arr != null ) {
  334. if ( isArraylike( Object(arr) ) ) {
  335. jQuery.merge( ret,
  336. typeof arr === "string" ?
  337. [ arr ] : arr
  338. );
  339. } else {
  340. push.call( ret, arr );
  341. }
  342. }
  343. return ret;
  344. },
  345. inArray: function( elem, arr, i ) {
  346. var len;
  347. if ( arr ) {
  348. if ( indexOf ) {
  349. return indexOf.call( arr, elem, i );
  350. }
  351. len = arr.length;
  352. i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
  353. for ( ; i < len; i++ ) {
  354. // Skip accessing in sparse arrays
  355. if ( i in arr && arr[ i ] === elem ) {
  356. return i;
  357. }
  358. }
  359. }
  360. return -1;
  361. },
  362. merge: function( first, second ) {
  363. var len = +second.length,
  364. j = 0,
  365. i = first.length;
  366. while ( j < len ) {
  367. first[ i++ ] = second[ j++ ];
  368. }
  369. // Support: IE<9
  370. // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
  371. if ( len !== len ) {
  372. while ( second[j] !== undefined ) {
  373. first[ i++ ] = second[ j++ ];
  374. }
  375. }
  376. first.length = i;
  377. return first;
  378. },
  379. grep: function( elems, callback, invert ) {
  380. var callbackInverse,
  381. matches = [],
  382. i = 0,
  383. length = elems.length,
  384. callbackExpect = !invert;
  385. // Go through the array, only saving the items
  386. // that pass the validator function
  387. for ( ; i < length; i++ ) {
  388. callbackInverse = !callback( elems[ i ], i );
  389. if ( callbackInverse !== callbackExpect ) {
  390. matches.push( elems[ i ] );
  391. }
  392. }
  393. return matches;
  394. },
  395. // arg is for internal usage only
  396. map: function( elems, callback, arg ) {
  397. var value,
  398. i = 0,
  399. length = elems.length,
  400. isArray = isArraylike( elems ),
  401. ret = [];
  402. // Go through the array, translating each of the items to their new values
  403. if ( isArray ) {
  404. for ( ; i < length; i++ ) {
  405. value = callback( elems[ i ], i, arg );
  406. if ( value != null ) {
  407. ret.push( value );
  408. }
  409. }
  410. // Go through every key on the object,
  411. } else {
  412. for ( i in elems ) {
  413. value = callback( elems[ i ], i, arg );
  414. if ( value != null ) {
  415. ret.push( value );
  416. }
  417. }
  418. }
  419. // Flatten any nested arrays
  420. return concat.apply( [], ret );
  421. },
  422. // A global GUID counter for objects
  423. guid: 1,
  424. // Bind a function to a context, optionally partially applying any
  425. // arguments.
  426. proxy: function( fn, context ) {
  427. var args, proxy, tmp;
  428. if ( typeof context === "string" ) {
  429. tmp = fn[ context ];
  430. context = fn;
  431. fn = tmp;
  432. }
  433. // Quick check to determine if target is callable, in the spec
  434. // this throws a TypeError, but we will just return undefined.
  435. if ( !jQuery.isFunction( fn ) ) {
  436. return undefined;
  437. }
  438. // Simulated bind
  439. args = slice.call( arguments, 2 );
  440. proxy = function() {
  441. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  442. };
  443. // Set the guid of unique handler to the same of original handler, so it can be removed
  444. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  445. return proxy;
  446. },
  447. now: function() {
  448. return +( new Date() );
  449. },
  450. // jQuery.support is not used in Core but other projects attach their
  451. // properties to it so it needs to exist.
  452. support: support
  453. });
  454. // Populate the class2type map
  455. jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
  456. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  457. });
  458. function isArraylike( obj ) {
  459. // Support: iOS 8.2 (not reproducible in simulator)
  460. // `in` check used to prevent JIT error (gh-2145)
  461. // hasOwn isn't used here due to false negatives
  462. // regarding Nodelist length in IE
  463. var length = "length" in obj && obj.length,
  464. type = jQuery.type( obj );
  465. if ( type === "function" || jQuery.isWindow( obj ) ) {
  466. return false;
  467. }
  468. if ( obj.nodeType === 1 && length ) {
  469. return true;
  470. }
  471. return type === "array" || length === 0 ||
  472. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  473. }
  474. var Sizzle =
  475. /*!
  476. * Sizzle CSS Selector Engine v2.2.0-pre
  477. * http://sizzlejs.com/
  478. *
  479. * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
  480. * Released under the MIT license
  481. * http://jquery.org/license
  482. *
  483. * Date: 2014-12-16
  484. */
  485. (function( window ) {
  486. var i,
  487. support,
  488. Expr,
  489. getText,
  490. isXML,
  491. tokenize,
  492. compile,
  493. select,
  494. outermostContext,
  495. sortInput,
  496. hasDuplicate,
  497. // Local document vars
  498. setDocument,
  499. document,
  500. docElem,
  501. documentIsHTML,
  502. rbuggyQSA,
  503. rbuggyMatches,
  504. matches,
  505. contains,
  506. // Instance-specific data
  507. expando = "sizzle" + 1 * new Date(),
  508. preferredDoc = window.document,
  509. dirruns = 0,
  510. done = 0,
  511. classCache = createCache(),
  512. tokenCache = createCache(),
  513. compilerCache = createCache(),
  514. sortOrder = function( a, b ) {
  515. if ( a === b ) {
  516. hasDuplicate = true;
  517. }
  518. return 0;
  519. },
  520. // General-purpose constants
  521. MAX_NEGATIVE = 1 << 31,
  522. // Instance methods
  523. hasOwn = ({}).hasOwnProperty,
  524. arr = [],
  525. pop = arr.pop,
  526. push_native = arr.push,
  527. push = arr.push,
  528. slice = arr.slice,
  529. // Use a stripped-down indexOf as it's faster than native
  530. // http://jsperf.com/thor-indexof-vs-for/5
  531. indexOf = function( list, elem ) {
  532. var i = 0,
  533. len = list.length;
  534. for ( ; i < len; i++ ) {
  535. if ( list[i] === elem ) {
  536. return i;
  537. }
  538. }
  539. return -1;
  540. },
  541. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  542. // Regular expressions
  543. // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
  544. whitespace = "[\\x20\\t\\r\\n\\f]",
  545. // http://www.w3.org/TR/css3-syntax/#characters
  546. characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
  547. // Loosely modeled on CSS identifier characters
  548. // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
  549. // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  550. identifier = characterEncoding.replace( "w", "w#" ),
  551. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  552. attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
  553. // Operator (capture 2)
  554. "*([*^$|!~]?=)" + whitespace +
  555. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  556. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  557. "*\\]",
  558. pseudos = ":(" + characterEncoding + ")(?:\\((" +
  559. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  560. // 1. quoted (capture 3; capture 4 or capture 5)
  561. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  562. // 2. simple (capture 6)
  563. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  564. // 3. anything else (capture 2)
  565. ".*" +
  566. ")\\)|)",
  567. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  568. rwhitespace = new RegExp( whitespace + "+", "g" ),
  569. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  570. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  571. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  572. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  573. rpseudo = new RegExp( pseudos ),
  574. ridentifier = new RegExp( "^" + identifier + "$" ),
  575. matchExpr = {
  576. "ID": new RegExp( "^#(" + characterEncoding + ")" ),
  577. "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
  578. "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
  579. "ATTR": new RegExp( "^" + attributes ),
  580. "PSEUDO": new RegExp( "^" + pseudos ),
  581. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  582. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  583. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  584. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  585. // For use in libraries implementing .is()
  586. // We use this for POS matching in `select`
  587. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  588. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  589. },
  590. rinputs = /^(?:input|select|textarea|button)$/i,
  591. rheader = /^h\d$/i,
  592. rnative = /^[^{]+\{\s*\[native \w/,
  593. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  594. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  595. rsibling = /[+~]/,
  596. rescape = /'|\\/g,
  597. // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  598. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  599. funescape = function( _, escaped, escapedWhitespace ) {
  600. var high = "0x" + escaped - 0x10000;
  601. // NaN means non-codepoint
  602. // Support: Firefox<24
  603. // Workaround erroneous numeric interpretation of +"0x"
  604. return high !== high || escapedWhitespace ?
  605. escaped :
  606. high < 0 ?
  607. // BMP codepoint
  608. String.fromCharCode( high + 0x10000 ) :
  609. // Supplemental Plane codepoint (surrogate pair)
  610. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  611. },
  612. // Used for iframes
  613. // See setDocument()
  614. // Removing the function wrapper causes a "Permission Denied"
  615. // error in IE
  616. unloadHandler = function() {
  617. setDocument();
  618. };
  619. // Optimize for push.apply( _, NodeList )
  620. try {
  621. push.apply(
  622. (arr = slice.call( preferredDoc.childNodes )),
  623. preferredDoc.childNodes
  624. );
  625. // Support: Android<4.0
  626. // Detect silently failing push.apply
  627. arr[ preferredDoc.childNodes.length ].nodeType;
  628. } catch ( e ) {
  629. push = { apply: arr.length ?
  630. // Leverage slice if possible
  631. function( target, els ) {
  632. push_native.apply( target, slice.call(els) );
  633. } :
  634. // Support: IE<9
  635. // Otherwise append directly
  636. function( target, els ) {
  637. var j = target.length,
  638. i = 0;
  639. // Can't trust NodeList.length
  640. while ( (target[j++] = els[i++]) ) {}
  641. target.length = j - 1;
  642. }
  643. };
  644. }
  645. function Sizzle( selector, context, results, seed ) {
  646. var match, elem, m, nodeType,
  647. // QSA vars
  648. i, groups, old, nid, newContext, newSelector;
  649. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  650. setDocument( context );
  651. }
  652. context = context || document;
  653. results = results || [];
  654. nodeType = context.nodeType;
  655. if ( typeof selector !== "string" || !selector ||
  656. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  657. return results;
  658. }
  659. if ( !seed && documentIsHTML ) {
  660. // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
  661. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  662. // Speed-up: Sizzle("#ID")
  663. if ( (m = match[1]) ) {
  664. if ( nodeType === 9 ) {
  665. elem = context.getElementById( m );
  666. // Check parentNode to catch when Blackberry 4.6 returns
  667. // nodes that are no longer in the document (jQuery #6963)
  668. if ( elem && elem.parentNode ) {
  669. // Handle the case where IE, Opera, and Webkit return items
  670. // by name instead of ID
  671. if ( elem.id === m ) {
  672. results.push( elem );
  673. return results;
  674. }
  675. } else {
  676. return results;
  677. }
  678. } else {
  679. // Context is not a document
  680. if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
  681. contains( context, elem ) && elem.id === m ) {
  682. results.push( elem );
  683. return results;
  684. }
  685. }
  686. // Speed-up: Sizzle("TAG")
  687. } else if ( match[2] ) {
  688. push.apply( results, context.getElementsByTagName( selector ) );
  689. return results;
  690. // Speed-up: Sizzle(".CLASS")
  691. } else if ( (m = match[3]) && support.getElementsByClassName ) {
  692. push.apply( results, context.getElementsByClassName( m ) );
  693. return results;
  694. }
  695. }
  696. // QSA path
  697. if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  698. nid = old = expando;
  699. newContext = context;
  700. newSelector = nodeType !== 1 && selector;
  701. // qSA works strangely on Element-rooted queries
  702. // We can work around this by specifying an extra ID on the root
  703. // and working up from there (Thanks to Andrew Dupont for the technique)
  704. // IE 8 doesn't work on object elements
  705. if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
  706. groups = tokenize( selector );
  707. if ( (old = context.getAttribute("id")) ) {
  708. nid = old.replace( rescape, "\\$&" );
  709. } else {
  710. context.setAttribute( "id", nid );
  711. }
  712. nid = "[id='" + nid + "'] ";
  713. i = groups.length;
  714. while ( i-- ) {
  715. groups[i] = nid + toSelector( groups[i] );
  716. }
  717. newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
  718. newSelector = groups.join(",");
  719. }
  720. if ( newSelector ) {
  721. try {
  722. push.apply( results,
  723. newContext.querySelectorAll( newSelector )
  724. );
  725. return results;
  726. } catch(qsaError) {
  727. } finally {
  728. if ( !old ) {
  729. context.removeAttribute("id");
  730. }
  731. }
  732. }
  733. }
  734. }
  735. // All others
  736. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  737. }
  738. /**
  739. * Create key-value caches of limited size
  740. * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
  741. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  742. * deleting the oldest entry
  743. */
  744. function createCache() {
  745. var keys = [];
  746. function cache( key, value ) {
  747. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  748. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  749. // Only keep the most recent entries
  750. delete cache[ keys.shift() ];
  751. }
  752. return (cache[ key + " " ] = value);
  753. }
  754. return cache;
  755. }
  756. /**
  757. * Mark a function for special use by Sizzle
  758. * @param {Function} fn The function to mark
  759. */
  760. function markFunction( fn ) {
  761. fn[ expando ] = true;
  762. return fn;
  763. }
  764. /**
  765. * Support testing using an element
  766. * @param {Function} fn Passed the created div and expects a boolean result
  767. */
  768. function assert( fn ) {
  769. var div = document.createElement("div");
  770. try {
  771. return !!fn( div );
  772. } catch (e) {
  773. return false;
  774. } finally {
  775. // Remove from its parent by default
  776. if ( div.parentNode ) {
  777. div.parentNode.removeChild( div );
  778. }
  779. // release memory in IE
  780. div = null;
  781. }
  782. }
  783. /**
  784. * Adds the same handler for all of the specified attrs
  785. * @param {String} attrs Pipe-separated list of attributes
  786. * @param {Function} handler The method that will be applied
  787. */
  788. function addHandle( attrs, handler ) {
  789. var arr = attrs.split("|"),
  790. i = attrs.length;
  791. while ( i-- ) {
  792. Expr.attrHandle[ arr[i] ] = handler;
  793. }
  794. }
  795. /**
  796. * Checks document order of two siblings
  797. * @param {Element} a
  798. * @param {Element} b
  799. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  800. */
  801. function siblingCheck( a, b ) {
  802. var cur = b && a,
  803. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  804. ( ~b.sourceIndex || MAX_NEGATIVE ) -
  805. ( ~a.sourceIndex || MAX_NEGATIVE );
  806. // Use IE sourceIndex if available on both nodes
  807. if ( diff ) {
  808. return diff;
  809. }
  810. // Check if b follows a
  811. if ( cur ) {
  812. while ( (cur = cur.nextSibling) ) {
  813. if ( cur === b ) {
  814. return -1;
  815. }
  816. }
  817. }
  818. return a ? 1 : -1;
  819. }
  820. /**
  821. * Returns a function to use in pseudos for input types
  822. * @param {String} type
  823. */
  824. function createInputPseudo( type ) {
  825. return function( elem ) {
  826. var name = elem.nodeName.toLowerCase();
  827. return name === "input" && elem.type === type;
  828. };
  829. }
  830. /**
  831. * Returns a function to use in pseudos for buttons
  832. * @param {String} type
  833. */
  834. function createButtonPseudo( type ) {
  835. return function( elem ) {
  836. var name = elem.nodeName.toLowerCase();
  837. return (name === "input" || name === "button") && elem.type === type;
  838. };
  839. }
  840. /**
  841. * Returns a function to use in pseudos for positionals
  842. * @param {Function} fn
  843. */
  844. function createPositionalPseudo( fn ) {
  845. return markFunction(function( argument ) {
  846. argument = +argument;
  847. return markFunction(function( seed, matches ) {
  848. var j,
  849. matchIndexes = fn( [], seed.length, argument ),
  850. i = matchIndexes.length;
  851. // Match elements found at the specified indexes
  852. while ( i-- ) {
  853. if ( seed[ (j = matchIndexes[i]) ] ) {
  854. seed[j] = !(matches[j] = seed[j]);
  855. }
  856. }
  857. });
  858. });
  859. }
  860. /**
  861. * Checks a node for validity as a Sizzle context
  862. * @param {Element|Object=} context
  863. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  864. */
  865. function testContext( context ) {
  866. return context && typeof context.getElementsByTagName !== "undefined" && context;
  867. }
  868. // Expose support vars for convenience
  869. support = Sizzle.support = {};
  870. /**
  871. * Detects XML nodes
  872. * @param {Element|Object} elem An element or a document
  873. * @returns {Boolean} True iff elem is a non-HTML XML node
  874. */
  875. isXML = Sizzle.isXML = function( elem ) {
  876. // documentElement is verified for cases where it doesn't yet exist
  877. // (such as loading iframes in IE - #4833)
  878. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  879. return documentElement ? documentElement.nodeName !== "HTML" : false;
  880. };
  881. /**
  882. * Sets document-related variables once based on the current document
  883. * @param {Element|Object} [doc] An element or document object to use to set the document
  884. * @returns {Object} Returns the current document
  885. */
  886. setDocument = Sizzle.setDocument = function( node ) {
  887. var hasCompare, parent,
  888. doc = node ? node.ownerDocument || node : preferredDoc;
  889. // If no document and documentElement is available, return
  890. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  891. return document;
  892. }
  893. // Set our document
  894. document = doc;
  895. docElem = doc.documentElement;
  896. parent = doc.defaultView;
  897. // Support: IE>8
  898. // If iframe document is assigned to "document" variable and if iframe has been reloaded,
  899. // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
  900. // IE6-8 do not support the defaultView property so parent will be undefined
  901. if ( parent && parent !== parent.top ) {
  902. // IE11 does not have attachEvent, so all must suffer
  903. if ( parent.addEventListener ) {
  904. parent.addEventListener( "unload", unloadHandler, false );
  905. } else if ( parent.attachEvent ) {
  906. parent.attachEvent( "onunload", unloadHandler );
  907. }
  908. }
  909. /* Support tests
  910. ---------------------------------------------------------------------- */
  911. documentIsHTML = !isXML( doc );
  912. /* Attributes
  913. ---------------------------------------------------------------------- */
  914. // Support: IE<8
  915. // Verify that getAttribute really returns attributes and not properties
  916. // (excepting IE8 booleans)
  917. support.attributes = assert(function( div ) {
  918. div.className = "i";
  919. return !div.getAttribute("className");
  920. });
  921. /* getElement(s)By*
  922. ---------------------------------------------------------------------- */
  923. // Check if getElementsByTagName("*") returns only elements
  924. support.getElementsByTagName = assert(function( div ) {
  925. div.appendChild( doc.createComment("") );
  926. return !div.getElementsByTagName("*").length;
  927. });
  928. // Support: IE<9
  929. support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
  930. // Support: IE<10
  931. // Check if getElementById returns elements by name
  932. // The broken getElementById methods don't pick up programatically-set names,
  933. // so use a roundabout getElementsByName test
  934. support.getById = assert(function( div ) {
  935. docElem.appendChild( div ).id = expando;
  936. return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
  937. });
  938. // ID find and filter
  939. if ( support.getById ) {
  940. Expr.find["ID"] = function( id, context ) {
  941. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  942. var m = context.getElementById( id );
  943. // Check parentNode to catch when Blackberry 4.6 returns
  944. // nodes that are no longer in the document #6963
  945. return m && m.parentNode ? [ m ] : [];
  946. }
  947. };
  948. Expr.filter["ID"] = function( id ) {
  949. var attrId = id.replace( runescape, funescape );
  950. return function( elem ) {
  951. return elem.getAttribute("id") === attrId;
  952. };
  953. };
  954. } else {
  955. // Support: IE6/7
  956. // getElementById is not reliable as a find shortcut
  957. delete Expr.find["ID"];
  958. Expr.filter["ID"] = function( id ) {
  959. var attrId = id.replace( runescape, funescape );
  960. return function( elem ) {
  961. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  962. return node && node.value === attrId;
  963. };
  964. };
  965. }
  966. // Tag
  967. Expr.find["TAG"] = support.getElementsByTagName ?
  968. function( tag, context ) {
  969. if ( typeof context.getElementsByTagName !== "undefined" ) {
  970. return context.getElementsByTagName( tag );
  971. // DocumentFragment nodes don't have gEBTN
  972. } else if ( support.qsa ) {
  973. return context.querySelectorAll( tag );
  974. }
  975. } :
  976. function( tag, context ) {
  977. var elem,
  978. tmp = [],
  979. i = 0,
  980. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  981. results = context.getElementsByTagName( tag );
  982. // Filter out possible comments
  983. if ( tag === "*" ) {
  984. while ( (elem = results[i++]) ) {
  985. if ( elem.nodeType === 1 ) {
  986. tmp.push( elem );
  987. }
  988. }
  989. return tmp;
  990. }
  991. return results;
  992. };
  993. // Class
  994. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  995. if ( documentIsHTML ) {
  996. return context.getElementsByClassName( className );
  997. }
  998. };
  999. /* QSA/matchesSelector
  1000. ---------------------------------------------------------------------- */
  1001. // QSA and matchesSelector support
  1002. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1003. rbuggyMatches = [];
  1004. // qSa(:focus) reports false when true (Chrome 21)
  1005. // We allow this because of a bug in IE8/9 that throws an error
  1006. // whenever `document.activeElement` is accessed on an iframe
  1007. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1008. // See http://bugs.jquery.com/ticket/13378
  1009. rbuggyQSA = [];
  1010. if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
  1011. // Build QSA regex
  1012. // Regex strategy adopted from Diego Perini
  1013. assert(function( div ) {
  1014. // Select is set to empty string on purpose
  1015. // This is to test IE's treatment of not explicitly
  1016. // setting a boolean content attribute,
  1017. // since its presence should be enough
  1018. // http://bugs.jquery.com/ticket/12359
  1019. docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
  1020. "<select id='" + expando + "-\f]' msallowcapture=''>" +
  1021. "<option selected=''></option></select>";
  1022. // Support: IE8, Opera 11-12.16
  1023. // Nothing should be selected when empty strings follow ^= or $= or *=
  1024. // The test attribute must be unknown in Opera but "safe" for WinRT
  1025. // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1026. if ( div.querySelectorAll("[msallowcapture^='']").length ) {
  1027. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1028. }
  1029. // Support: IE8
  1030. // Boolean attributes and "value" are not treated correctly
  1031. if ( !div.querySelectorAll("[selected]").length ) {
  1032. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1033. }
  1034. // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
  1035. if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1036. rbuggyQSA.push("~=");
  1037. }
  1038. // Webkit/Opera - :checked should return selected option elements
  1039. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1040. // IE8 throws error here and will not see later tests
  1041. if ( !div.querySelectorAll(":checked").length ) {
  1042. rbuggyQSA.push(":checked");
  1043. }
  1044. // Support: Safari 8+, iOS 8+
  1045. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1046. // In-page `selector#id sibing-combinator selector` fails
  1047. if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1048. rbuggyQSA.push(".#.+[+~]");
  1049. }
  1050. });
  1051. assert(function( div ) {
  1052. // Support: Windows 8 Native Apps
  1053. // The type and name attributes are restricted during .innerHTML assignment
  1054. var input = doc.createElement("input");
  1055. input.setAttribute( "type", "hidden" );
  1056. div.appendChild( input ).setAttribute( "name", "D" );
  1057. // Support: IE8
  1058. // Enforce case-sensitivity of name attribute
  1059. if ( div.querySelectorAll("[name=d]").length ) {
  1060. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1061. }
  1062. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1063. // IE8 throws error here and will not see later tests
  1064. if ( !div.querySelectorAll(":enabled").length ) {
  1065. rbuggyQSA.push( ":enabled", ":disabled" );
  1066. }
  1067. // Opera 10-11 does not throw on post-comma invalid pseudos
  1068. div.querySelectorAll("*,:x");
  1069. rbuggyQSA.push(",.*:");
  1070. });
  1071. }
  1072. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1073. docElem.webkitMatchesSelector ||
  1074. docElem.mozMatchesSelector ||
  1075. docElem.oMatchesSelector ||
  1076. docElem.msMatchesSelector) )) ) {
  1077. assert(function( div ) {
  1078. // Check to see if it's possible to do matchesSelector
  1079. // on a disconnected node (IE 9)
  1080. support.disconnectedMatch = matches.call( div, "div" );
  1081. // This should fail with an exception
  1082. // Gecko does not error, returns false instead
  1083. matches.call( div, "[s!='']:x" );
  1084. rbuggyMatches.push( "!=", pseudos );
  1085. });
  1086. }
  1087. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1088. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1089. /* Contains
  1090. ---------------------------------------------------------------------- */
  1091. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1092. // Element contains another
  1093. // Purposefully does not implement inclusive descendent
  1094. // As in, an element does not contain itself
  1095. contains = hasCompare || rnative.test( docElem.contains ) ?
  1096. function( a, b ) {
  1097. var adown = a.nodeType === 9 ? a.documentElement : a,
  1098. bup = b && b.parentNode;
  1099. return a === bup || !!( bup && bup.nodeType === 1 && (
  1100. adown.contains ?
  1101. adown.contains( bup ) :
  1102. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1103. ));
  1104. } :
  1105. function( a, b ) {
  1106. if ( b ) {
  1107. while ( (b = b.parentNode) ) {
  1108. if ( b === a ) {
  1109. return true;
  1110. }
  1111. }
  1112. }
  1113. return false;
  1114. };
  1115. /* Sorting
  1116. ---------------------------------------------------------------------- */
  1117. // Document order sorting
  1118. sortOrder = hasCompare ?
  1119. function( a, b ) {
  1120. // Flag for duplicate removal
  1121. if ( a === b ) {
  1122. hasDuplicate = true;
  1123. return 0;
  1124. }
  1125. // Sort on method existence if only one input has compareDocumentPosition
  1126. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1127. if ( compare ) {
  1128. return compare;
  1129. }
  1130. // Calculate position if both inputs belong to the same document
  1131. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1132. a.compareDocumentPosition( b ) :
  1133. // Otherwise we know they are disconnected
  1134. 1;
  1135. // Disconnected nodes
  1136. if ( compare & 1 ||
  1137. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1138. // Choose the first element that is related to our preferred document
  1139. if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1140. return -1;
  1141. }
  1142. if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1143. return 1;
  1144. }
  1145. // Maintain original order
  1146. return sortInput ?
  1147. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1148. 0;
  1149. }
  1150. return compare & 4 ? -1 : 1;
  1151. } :
  1152. function( a, b ) {
  1153. // Exit early if the nodes are identical
  1154. if ( a === b ) {
  1155. hasDuplicate = true;
  1156. return 0;
  1157. }
  1158. var cur,
  1159. i = 0,
  1160. aup = a.parentNode,
  1161. bup = b.parentNode,
  1162. ap = [ a ],
  1163. bp = [ b ];
  1164. // Parentless nodes are either documents or disconnected
  1165. if ( !aup || !bup ) {
  1166. return a === doc ? -1 :
  1167. b === doc ? 1 :
  1168. aup ? -1 :
  1169. bup ? 1 :
  1170. sortInput ?
  1171. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1172. 0;
  1173. // If the nodes are siblings, we can do a quick check
  1174. } else if ( aup === bup ) {
  1175. return siblingCheck( a, b );
  1176. }
  1177. // Otherwise we need full lists of their ancestors for comparison
  1178. cur = a;
  1179. while ( (cur = cur.parentNode) ) {
  1180. ap.unshift( cur );
  1181. }
  1182. cur = b;
  1183. while ( (cur = cur.parentNode) ) {
  1184. bp.unshift( cur );
  1185. }
  1186. // Walk down the tree looking for a discrepancy
  1187. while ( ap[i] === bp[i] ) {
  1188. i++;
  1189. }
  1190. return i ?
  1191. // Do a sibling check if the nodes have a common ancestor
  1192. siblingCheck( ap[i], bp[i] ) :
  1193. // Otherwise nodes in our document sort first
  1194. ap[i] === preferredDoc ? -1 :
  1195. bp[i] === preferredDoc ? 1 :
  1196. 0;
  1197. };
  1198. return doc;
  1199. };
  1200. Sizzle.matches = function( expr, elements ) {
  1201. return Sizzle( expr, null, null, elements );
  1202. };
  1203. Sizzle.matchesSelector = function( elem, expr ) {
  1204. // Set document vars if needed
  1205. if ( ( elem.ownerDocument || elem ) !== document ) {
  1206. setDocument( elem );
  1207. }
  1208. // Make sure that attribute selectors are quoted
  1209. expr = expr.replace( rattributeQuotes, "='$1']" );
  1210. if ( support.matchesSelector && documentIsHTML &&
  1211. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1212. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1213. try {
  1214. var ret = matches.call( elem, expr );
  1215. // IE 9's matchesSelector returns false on disconnected nodes
  1216. if ( ret || support.disconnectedMatch ||
  1217. // As well, disconnected nodes are said to be in a document
  1218. // fragment in IE 9
  1219. elem.document && elem.document.nodeType !== 11 ) {
  1220. return ret;
  1221. }
  1222. } catch (e) {}
  1223. }
  1224. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1225. };
  1226. Sizzle.contains = function( context, elem ) {
  1227. // Set document vars if needed
  1228. if ( ( context.ownerDocument || context ) !== document ) {
  1229. setDocument( context );
  1230. }
  1231. return contains( context, elem );
  1232. };
  1233. Sizzle.attr = function( elem, name ) {
  1234. // Set document vars if needed
  1235. if ( ( elem.ownerDocument || elem ) !== document ) {
  1236. setDocument( elem );
  1237. }
  1238. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1239. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1240. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1241. fn( elem, name, !documentIsHTML ) :
  1242. undefined;
  1243. return val !== undefined ?
  1244. val :
  1245. support.attributes || !documentIsHTML ?
  1246. elem.getAttribute( name ) :
  1247. (val = elem.getAttributeNode(name)) && val.specified ?
  1248. val.value :
  1249. null;
  1250. };
  1251. Sizzle.error = function( msg ) {
  1252. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1253. };
  1254. /**
  1255. * Document sorting and removing duplicates
  1256. * @param {ArrayLike} results
  1257. */
  1258. Sizzle.uniqueSort = function( results ) {
  1259. var elem,
  1260. duplicates = [],
  1261. j = 0,
  1262. i = 0;
  1263. // Unless we *know* we can detect duplicates, assume their presence
  1264. hasDuplicate = !support.detectDuplicates;
  1265. sortInput = !support.sortStable && results.slice( 0 );
  1266. results.sort( sortOrder );
  1267. if ( hasDuplicate ) {
  1268. while ( (elem = results[i++]) ) {
  1269. if ( elem === results[ i ] ) {
  1270. j = duplicates.push( i );
  1271. }
  1272. }
  1273. while ( j-- ) {
  1274. results.splice( duplicates[ j ], 1 );
  1275. }
  1276. }
  1277. // Clear input after sorting to release objects
  1278. // See https://github.com/jquery/sizzle/pull/225
  1279. sortInput = null;
  1280. return results;
  1281. };
  1282. /**
  1283. * Utility function for retrieving the text value of an array of DOM nodes
  1284. * @param {Array|Element} elem
  1285. */
  1286. getText = Sizzle.getText = function( elem ) {
  1287. var node,
  1288. ret = "",
  1289. i = 0,
  1290. nodeType = elem.nodeType;
  1291. if ( !nodeType ) {
  1292. // If no nodeType, this is expected to be an array
  1293. while ( (node = elem[i++]) ) {
  1294. // Do not traverse comment nodes
  1295. ret += getText( node );
  1296. }
  1297. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1298. // Use textContent for elements
  1299. // innerText usage removed for consistency of new lines (jQuery #11153)
  1300. if ( typeof elem.textContent === "string" ) {
  1301. return elem.textContent;
  1302. } else {
  1303. // Traverse its children
  1304. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1305. ret += getText( elem );
  1306. }
  1307. }
  1308. } else if ( nodeType === 3 || nodeType === 4 ) {
  1309. return elem.nodeValue;
  1310. }
  1311. // Do not include comment or processing instruction nodes
  1312. return ret;
  1313. };
  1314. Expr = Sizzle.selectors = {
  1315. // Can be adjusted by the user
  1316. cacheLength: 50,
  1317. createPseudo: markFunction,
  1318. match: matchExpr,
  1319. attrHandle: {},
  1320. find: {},
  1321. relative: {
  1322. ">": { dir: "parentNode", first: true },
  1323. " ": { dir: "parentNode" },
  1324. "+": { dir: "previousSibling", first: true },
  1325. "~": { dir: "previousSibling" }
  1326. },
  1327. preFilter: {
  1328. "ATTR": function( match ) {
  1329. match[1] = match[1].replace( runescape, funescape );
  1330. // Move the given value to match[3] whether quoted or unquoted
  1331. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1332. if ( match[2] === "~=" ) {
  1333. match[3] = " " + match[3] + " ";
  1334. }
  1335. return match.slice( 0, 4 );
  1336. },
  1337. "CHILD": function( match ) {
  1338. /* matches from matchExpr["CHILD"]
  1339. 1 type (only|nth|...)
  1340. 2 what (child|of-type)
  1341. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1342. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1343. 5 sign of xn-component
  1344. 6 x of xn-component
  1345. 7 sign of y-component
  1346. 8 y of y-component
  1347. */
  1348. match[1] = match[1].toLowerCase();
  1349. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1350. // nth-* requires argument
  1351. if ( !match[3] ) {
  1352. Sizzle.error( match[0] );
  1353. }
  1354. // numeric x and y parameters for Expr.filter.CHILD
  1355. // remember that false/true cast respectively to 0/1
  1356. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1357. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1358. // other types prohibit arguments
  1359. } else if ( match[3] ) {
  1360. Sizzle.error( match[0] );
  1361. }
  1362. return match;
  1363. },
  1364. "PSEUDO": function( match ) {
  1365. var excess,
  1366. unquoted = !match[6] && match[2];
  1367. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1368. return null;
  1369. }
  1370. // Accept quoted arguments as-is
  1371. if ( match[3] ) {
  1372. match[2] = match[4] || match[5] || "";
  1373. // Strip excess characters from unquoted arguments
  1374. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1375. // Get excess from tokenize (recursively)
  1376. (excess = tokenize( unquoted, true )) &&
  1377. // advance to the next closing parenthesis
  1378. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1379. // excess is a negative index
  1380. match[0] = match[0].slice( 0, excess );
  1381. match[2] = unquoted.slice( 0, excess );
  1382. }
  1383. // Return only captures needed by the pseudo filter method (type and argument)
  1384. return match.slice( 0, 3 );
  1385. }
  1386. },
  1387. filter: {
  1388. "TAG": function( nodeNameSelector ) {
  1389. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1390. return nodeNameSelector === "*" ?
  1391. function() { return true; } :
  1392. function( elem ) {
  1393. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1394. };
  1395. },
  1396. "CLASS": function( className ) {
  1397. var pattern = classCache[ className + " " ];
  1398. return pattern ||
  1399. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1400. classCache( className, function( elem ) {
  1401. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1402. });
  1403. },
  1404. "ATTR": function( name, operator, check ) {
  1405. return function( elem ) {
  1406. var result = Sizzle.attr( elem, name );
  1407. if ( result == null ) {
  1408. return operator === "!=";
  1409. }
  1410. if ( !operator ) {
  1411. return true;
  1412. }
  1413. result += "";
  1414. return operator === "=" ? result === check :
  1415. operator === "!=" ? result !== check :
  1416. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1417. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1418. operator === "$=" ? check && result.slice( -check.length ) === check :
  1419. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1420. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1421. false;
  1422. };
  1423. },
  1424. "CHILD": function( type, what, argument, first, last ) {
  1425. var simple = type.slice( 0, 3 ) !== "nth",
  1426. forward = type.slice( -4 ) !== "last",
  1427. ofType = what === "of-type";
  1428. return first === 1 && last === 0 ?
  1429. // Shortcut for :nth-*(n)
  1430. function( elem ) {
  1431. return !!elem.parentNode;
  1432. } :
  1433. function( elem, context, xml ) {
  1434. var cache, outerCache, node, diff, nodeIndex, start,
  1435. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1436. parent = elem.parentNode,
  1437. name = ofType && elem.nodeName.toLowerCase(),
  1438. useCache = !xml && !ofType;
  1439. if ( parent ) {
  1440. // :(first|last|only)-(child|of-type)
  1441. if ( simple ) {
  1442. while ( dir ) {
  1443. node = elem;
  1444. while ( (node = node[ dir ]) ) {
  1445. if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
  1446. return false;
  1447. }
  1448. }
  1449. // Reverse direction for :only-* (if we haven't yet done so)
  1450. start = dir = type === "only" && !start && "nextSibling";
  1451. }
  1452. return true;
  1453. }
  1454. start = [ forward ? parent.firstChild : parent.lastChild ];
  1455. // non-xml :nth-child(...) stores cache data on `parent`
  1456. if ( forward && useCache ) {
  1457. // Seek `elem` from a previously-cached index
  1458. outerCache = parent[ expando ] || (parent[ expando ] = {});
  1459. cache = outerCache[ type ] || [];
  1460. nodeIndex = cache[0] === dirruns && cache[1];
  1461. diff = cache[0] === dirruns && cache[2];
  1462. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1463. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1464. // Fallback to seeking `elem` from the start
  1465. (diff = nodeIndex = 0) || start.pop()) ) {
  1466. // When found, cache indexes on `parent` and break
  1467. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1468. outerCache[ type ] = [ dirruns, nodeIndex, diff ];
  1469. break;
  1470. }
  1471. }
  1472. // Use previously-cached element index if available
  1473. } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
  1474. diff = cache[1];
  1475. // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1476. } else {
  1477. // Use the same loop as above to seek `elem` from the start
  1478. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1479. (diff = nodeIndex = 0) || start.pop()) ) {
  1480. if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
  1481. // Cache the index of each encountered element
  1482. if ( useCache ) {
  1483. (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
  1484. }
  1485. if ( node === elem ) {
  1486. break;
  1487. }
  1488. }
  1489. }
  1490. }
  1491. // Incorporate the offset, then check against cycle size
  1492. diff -= last;
  1493. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1494. }
  1495. };
  1496. },
  1497. "PSEUDO": function( pseudo, argument ) {
  1498. // pseudo-class names are case-insensitive
  1499. // http://www.w3.org/TR/selectors/#pseudo-classes
  1500. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1501. // Remember that setFilters inherits from pseudos
  1502. var args,
  1503. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1504. Sizzle.error( "unsupported pseudo: " + pseudo );
  1505. // The user may use createPseudo to indicate that
  1506. // arguments are needed to create the filter function
  1507. // just as Sizzle does
  1508. if ( fn[ expando ] ) {
  1509. return fn( argument );
  1510. }
  1511. // But maintain support for old signatures
  1512. if ( fn.length > 1 ) {
  1513. args = [ pseudo, pseudo, "", argument ];
  1514. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1515. markFunct

Large files files are truncated, but you can click here to view the full file