UNPKG

funcunit

Version:
1,030 lines (1,022 loc) 456 kB
/*[process-shim]*/ (function(global, env) { // jshint ignore:line if (typeof process === "undefined") { global.process = { argv: [], cwd: function() { return ""; }, browser: true, env: { NODE_ENV: env || "development" }, version: "", platform: global.navigator && global.navigator.userAgent && /Windows/.test(global.navigator.userAgent) ? "win" : "" }; } })( typeof self == "object" && self.Object == Object ? self : typeof process === "object" && Object.prototype.toString.call(process) === "[object process]" ? global : window, "development" ); /*[global-shim-start]*/ (function(exports, global, doEval) { // jshint ignore:line var origDefine = global.define; var get = function(name) { var parts = name.split("."), cur = global, i; for (i = 0; i < parts.length; i++) { if (!cur) { break; } cur = cur[parts[i]]; } return cur; }; var set = function(name, val) { var parts = name.split("."), cur = global, i, part, next; for (i = 0; i < parts.length - 1; i++) { part = parts[i]; next = cur[part]; if (!next) { next = cur[part] = {}; } cur = next; } part = parts[parts.length - 1]; cur[part] = val; }; var useDefault = function(mod) { if (!mod || !mod.__esModule) return false; var esProps = { __esModule: true, default: true }; for (var p in mod) { if (!esProps[p]) return false; } return true; }; var hasCjsDependencies = function(deps) { return ( deps[0] === "require" && deps[1] === "exports" && deps[2] === "module" ); }; var modules = (global.define && global.define.modules) || (global._define && global._define.modules) || {}; var ourDefine = (global.define = function(moduleName, deps, callback) { var module; if (typeof deps === "function") { callback = deps; deps = []; } var args = [], i; for (i = 0; i < deps.length; i++) { args.push( exports[deps[i]] ? get(exports[deps[i]]) : modules[deps[i]] || get(deps[i]) ); } // CJS has no dependencies but 3 callback arguments if (hasCjsDependencies(deps) || (!deps.length && callback.length)) { module = { exports: {} }; args[0] = function(name) { return exports[name] ? get(exports[name]) : modules[name]; }; args[1] = module.exports; args[2] = module; } // Babel uses the exports and module object. else if (!args[0] && deps[0] === "exports") { module = { exports: {} }; args[0] = module.exports; if (deps[1] === "module") { args[1] = module; } } else if (!args[0] && deps[0] === "module") { args[0] = { id: moduleName }; } global.define = origDefine; var result = callback ? callback.apply(null, args) : undefined; global.define = ourDefine; // Favor CJS module.exports over the return value result = module && module.exports ? module.exports : result; modules[moduleName] = result; // Set global exports var globalExport = exports[moduleName]; if (globalExport && !get(globalExport)) { if (useDefault(result)) { result = result["default"]; } set(globalExport, result); } }); global.define.orig = origDefine; global.define.modules = modules; global.define.amd = true; ourDefine("@loader", [], function() { // shim for @@global-helpers var noop = function() {}; return { get: function() { return { prepareGlobal: noop, retrieveGlobal: noop }; }, global: global, __exec: function(__load) { doEval(__load.source, global); } }; }); })( { jquery: "jQuery" }, typeof self == "object" && self.Object == Object ? self : typeof process === "object" && Object.prototype.toString.call(process) === "[object process]" ? global : window, function(__$source__, __$global__) { // jshint ignore:line eval("(function() { " + __$source__ + " \n }).call(__$global__);"); } ); /*funcunit@3.6.3#browser/jquery*/ define('funcunit/browser/jquery', function (require, exports, module) { (function (global, require, exports, module) { 'format cjs'; (function (global, factory) { if (typeof module === 'object' && typeof module.exports === 'object') { module.exports = global.document ? factory(global, true) : function (w) { if (!w.document) { throw new Error('jQuery requires a window with a document'); } return factory(w); }; module.exports = module.exports.noConflict(true); } else { factory(global); } }(typeof window !== 'undefined' ? window : this, function (window, noGlobal) { var deletedIds = []; var slice = deletedIds.slice; var concat = deletedIds.concat; var push = deletedIds.push; var indexOf = deletedIds.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var trim = ''.trim; var support = {}; var version = '1.11.0', jQuery = function (selector, context) { return new jQuery.fn.init(selector, context); }, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, fcamelCase = function (all, letter) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { jquery: version, constructor: jQuery, selector: '', length: 0, toArray: function () { return slice.call(this); }, get: function (num) { return num != null ? num < 0 ? this[num + this.length] : this[num] : slice.call(this); }, pushStack: function (elems) { var ret = jQuery.merge(this.constructor(), elems); ret.prevObject = this; ret.context = this.context; return ret; }, each: function (callback, args) { return jQuery.each(this, callback, args); }, map: function (callback) { return this.pushStack(jQuery.map(this, function (elem, i) { return callback.call(elem, i, elem); })); }, slice: function () { return this.pushStack(slice.apply(this, arguments)); }, first: function () { return this.eq(0); }, last: function () { return this.eq(-1); }, eq: function (i) { var len = this.length, j = +i + (i < 0 ? len : 0); return this.pushStack(j >= 0 && j < len ? [this[j]] : []); }, end: function () { return this.prevObject || this.constructor(null); }, push: push, sort: deletedIds.sort, splice: deletedIds.splice }; jQuery.extend = jQuery.fn.extend = function () { var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; if (typeof target === 'boolean') { deep = target; target = arguments[i] || {}; i++; } if (typeof target !== 'object' && !jQuery.isFunction(target)) { target = {}; } if (i === length) { target = this; i--; } for (; i < length; i++) { if ((options = arguments[i]) != null) { for (name in options) { src = target[name]; copy = options[name]; if (target === copy) { continue; } if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } target[name] = jQuery.extend(deep, clone, copy); } else if (copy !== undefined) { target[name] = copy; } } } } return target; }; jQuery.extend({ expando: 'jQuery' + (version + Math.random()).replace(/\D/g, ''), isReady: true, error: function (msg) { throw new Error(msg); }, noop: function () { }, isFunction: function (obj) { return jQuery.type(obj) === 'function'; }, isArray: Array.isArray || function (obj) { return jQuery.type(obj) === 'array'; }, isWindow: function (obj) { return obj != null && obj == obj.window; }, isNumeric: function (obj) { return obj - parseFloat(obj) >= 0; }, isEmptyObject: function (obj) { var name; for (name in obj) { return false; } return true; }, isPlainObject: function (obj) { var key; if (!obj || jQuery.type(obj) !== 'object' || obj.nodeType || jQuery.isWindow(obj)) { return false; } try { if (obj.constructor && !hasOwn.call(obj, 'constructor') && !hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')) { return false; } } catch (e) { return false; } if (support.ownLast) { for (key in obj) { return hasOwn.call(obj, key); } } for (key in obj) { } return key === undefined || hasOwn.call(obj, key); }, type: function (obj) { if (obj == null) { return obj + ''; } return typeof obj === 'object' || typeof obj === 'function' ? class2type[toString.call(obj)] || 'object' : typeof obj; }, globalEval: function (data) { if (data && jQuery.trim(data)) { (window.execScript || function (data) { window['eval'].call(window, data); })(data); } }, camelCase: function (string) { return string.replace(rmsPrefix, 'ms-').replace(rdashAlpha, fcamelCase); }, nodeName: function (elem, name) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, each: function (obj, callback, args) { var value, i = 0, length = obj.length, isArray = isArraylike(obj); if (args) { if (isArray) { for (; i < length; i++) { value = callback.apply(obj[i], args); if (value === false) { break; } } } else { for (i in obj) { value = callback.apply(obj[i], args); if (value === false) { break; } } } } else { if (isArray) { for (; i < length; i++) { value = callback.call(obj[i], i, obj[i]); if (value === false) { break; } } } else { for (i in obj) { value = callback.call(obj[i], i, obj[i]); if (value === false) { break; } } } } return obj; }, trim: trim && !trim.call('\uFEFF\xA0') ? function (text) { return text == null ? '' : trim.call(text); } : function (text) { return text == null ? '' : (text + '').replace(rtrim, ''); }, makeArray: function (arr, results) { var ret = results || []; if (arr != null) { if (isArraylike(Object(arr))) { jQuery.merge(ret, typeof arr === 'string' ? [arr] : arr); } else { push.call(ret, arr); } } return ret; }, inArray: function (elem, arr, i) { var len; if (arr) { if (indexOf) { return indexOf.call(arr, elem, i); } len = arr.length; i = i ? i < 0 ? Math.max(0, len + i) : i : 0; for (; i < len; i++) { if (i in arr && arr[i] === elem) { return i; } } } return -1; }, merge: function (first, second) { var len = +second.length, j = 0, i = first.length; while (j < len) { first[i++] = second[j++]; } if (len !== len) { while (second[j] !== undefined) { first[i++] = second[j++]; } } first.length = i; return first; }, grep: function (elems, callback, invert) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; for (; i < length; i++) { callbackInverse = !callback(elems[i], i); if (callbackInverse !== callbackExpect) { matches.push(elems[i]); } } return matches; }, map: function (elems, callback, arg) { var value, i = 0, length = elems.length, isArray = isArraylike(elems), ret = []; if (isArray) { for (; i < length; i++) { value = callback(elems[i], i, arg); if (value != null) { ret.push(value); } } } else { for (i in elems) { value = callback(elems[i], i, arg); if (value != null) { ret.push(value); } } } return concat.apply([], ret); }, guid: 1, proxy: function (fn, context) { var args, proxy, tmp; if (typeof context === 'string') { tmp = fn[context]; context = fn; fn = tmp; } if (!jQuery.isFunction(fn)) { return undefined; } args = slice.call(arguments, 2); proxy = function () { return fn.apply(context || this, args.concat(slice.call(arguments))); }; proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: function () { return +new Date(); }, support: support }); jQuery.each('Boolean Number String Function Array Date RegExp Object Error'.split(' '), function (i, name) { class2type['[object ' + name + ']'] = name.toLowerCase(); }); function isArraylike(obj) { var length = obj.length, type = jQuery.type(obj); if (type === 'function' || jQuery.isWindow(obj)) { return false; } if (obj.nodeType === 1 && length) { return true; } return type === 'array' || length === 0 || typeof length === 'number' && length > 0 && length - 1 in obj; } var Sizzle = function (window) { var i, support, Expr, getText, isXML, compile, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = 'sizzle' + -new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function (a, b) { if (a === b) { hasDuplicate = true; } return 0; }, strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, indexOf = arr.indexOf || function (elem) { var i = 0, len = this.length; for (; i < len; i++) { if (this[i] === elem) { return i; } } return -1; }, booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped', whitespace = '[\\x20\\t\\r\\n\\f]', characterEncoding = '(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+', identifier = characterEncoding.replace('w', 'w#'), attributes = '\\[' + whitespace + '*(' + characterEncoding + ')' + whitespace + '*(?:([*^$|!~]?=)' + whitespace + '*(?:([\'"])((?:\\\\.|[^\\\\])*?)\\3|(' + identifier + ')|)|)' + whitespace + '*\\]', pseudos = ':(' + characterEncoding + ')(?:\\((([\'"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|' + attributes.replace(3, 8) + ')*)|.*)\\)|)', rtrim = new RegExp('^' + whitespace + '+|((?:^|[^\\\\])(?:\\\\.)*)' + whitespace + '+$', 'g'), rcomma = new RegExp('^' + whitespace + '*,' + whitespace + '*'), rcombinators = new RegExp('^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*'), rattributeQuotes = new RegExp('=' + whitespace + '*([^\\]\'"]*?)' + whitespace + '*\\]', 'g'), rpseudo = new RegExp(pseudos), ridentifier = new RegExp('^' + identifier + '$'), matchExpr = { 'ID': new RegExp('^#(' + characterEncoding + ')'), 'CLASS': new RegExp('^\\.(' + characterEncoding + ')'), 'TAG': new RegExp('^(' + characterEncoding.replace('w', 'w*') + ')'), 'ATTR': new RegExp('^' + attributes), 'PSEUDO': new RegExp('^' + pseudos), 'CHILD': new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' + whitespace + '*(even|odd|(([+-]|)(\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + '*(\\d+)|))' + whitespace + '*\\)|)', 'i'), 'bool': new RegExp('^(?:' + booleans + ')$', 'i'), 'needsContext': new RegExp('^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' + whitespace + '*((?:-\\d)?\\d*)' + whitespace + '*\\)|)(?=[^-]|$)', 'i') }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, runescape = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig'), funescape = function (_, escaped, escapedWhitespace) { var high = '0x' + escaped - 65536; return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320); }; try { push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes); arr[preferredDoc.childNodes.length].nodeType; } catch (e) { push = { apply: arr.length ? function (target, els) { push_native.apply(target, slice.call(els)); } : function (target, els) { var j = target.length, i = 0; while (target[j++] = els[i++]) { } target.length = j - 1; } }; } function Sizzle(selector, context, results, seed) { var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector; if ((context ? context.ownerDocument || context : preferredDoc) !== document) { setDocument(context); } context = context || document; results = results || []; if (!selector || typeof selector !== 'string') { return results; } if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) { return []; } if (documentIsHTML && !seed) { if (match = rquickExpr.exec(selector)) { if (m = match[1]) { if (nodeType === 9) { elem = context.getElementById(m); if (elem && elem.parentNode) { if (elem.id === m) { results.push(elem); return results; } } else { return results; } } else { if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) { results.push(elem); return results; } } } else if (match[2]) { push.apply(results, context.getElementsByTagName(selector)); return results; } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) { push.apply(results, context.getElementsByClassName(m)); return results; } } if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) { nid = old = expando; newContext = context; newSelector = nodeType === 9 && selector; if (nodeType === 1 && context.nodeName.toLowerCase() !== 'object') { groups = tokenize(selector); if (old = context.getAttribute('id')) { nid = old.replace(rescape, '\\$&'); } else { context.setAttribute('id', nid); } nid = '[id=\'' + nid + '\'] '; i = groups.length; while (i--) { groups[i] = nid + toSelector(groups[i]); } newContext = rsibling.test(selector) && testContext(context.parentNode) || context; newSelector = groups.join(','); } if (newSelector) { try { push.apply(results, newContext.querySelectorAll(newSelector)); return results; } catch (qsaError) { } finally { if (!old) { context.removeAttribute('id'); } } } } } return select(selector.replace(rtrim, '$1'), context, results, seed); } function createCache() { var keys = []; function cache(key, value) { if (keys.push(key + ' ') > Expr.cacheLength) { delete cache[keys.shift()]; } return cache[key + ' '] = value; } return cache; } function markFunction(fn) { fn[expando] = true; return fn; } function assert(fn) { var div = document.createElement('div'); try { return !!fn(div); } catch (e) { return false; } finally { if (div.parentNode) { div.parentNode.removeChild(div); } div = null; } } function addHandle(attrs, handler) { var arr = attrs.split('|'), i = attrs.length; while (i--) { Expr.attrHandle[arr[i]] = handler; } } function siblingCheck(a, b) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE); if (diff) { return diff; } if (cur) { while (cur = cur.nextSibling) { if (cur === b) { return -1; } } } return a ? 1 : -1; } function createInputPseudo(type) { return function (elem) { var name = elem.nodeName.toLowerCase(); return name === 'input' && elem.type === type; }; } function createButtonPseudo(type) { return function (elem) { var name = elem.nodeName.toLowerCase(); return (name === 'input' || name === 'button') && elem.type === type; }; } function createPositionalPseudo(fn) { return markFunction(function (argument) { argument = +argument; return markFunction(function (seed, matches) { var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length; while (i--) { if (seed[j = matchIndexes[i]]) { seed[j] = !(matches[j] = seed[j]); } } }); }); } function testContext(context) { return context && typeof context.getElementsByTagName !== strundefined && context; } support = Sizzle.support = {}; isXML = Sizzle.isXML = function (elem) { var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== 'HTML' : false; }; setDocument = Sizzle.setDocument = function (node) { var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView; if (doc === document || doc.nodeType !== 9 || !doc.documentElement) { return document; } document = doc; docElem = doc.documentElement; documentIsHTML = !isXML(doc); if (parent && parent !== parent.top) { if (parent.addEventListener) { parent.addEventListener('unload', function () { setDocument(); }, false); } else if (parent.attachEvent) { parent.attachEvent('onunload', function () { setDocument(); }); } } support.attributes = assert(function (div) { div.className = 'i'; return !div.getAttribute('className'); }); support.getElementsByTagName = assert(function (div) { div.appendChild(doc.createComment('')); return !div.getElementsByTagName('*').length; }); support.getElementsByClassName = rnative.test(doc.getElementsByClassName) && assert(function (div) { div.innerHTML = '<div class=\'a\'></div><div class=\'a i\'></div>'; div.firstChild.className = 'i'; return div.getElementsByClassName('i').length === 2; }); support.getById = assert(function (div) { docElem.appendChild(div).id = expando; return !doc.getElementsByName || !doc.getElementsByName(expando).length; }); if (support.getById) { Expr.find['ID'] = function (id, context) { if (typeof context.getElementById !== strundefined && documentIsHTML) { var m = context.getElementById(id); return m && m.parentNode ? [m] : []; } }; Expr.filter['ID'] = function (id) { var attrId = id.replace(runescape, funescape); return function (elem) { return elem.getAttribute('id') === attrId; }; }; } else { delete Expr.find['ID']; Expr.filter['ID'] = function (id) { var attrId = id.replace(runescape, funescape); return function (elem) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode('id'); return node && node.value === attrId; }; }; } Expr.find['TAG'] = support.getElementsByTagName ? function (tag, context) { if (typeof context.getElementsByTagName !== strundefined) { return context.getElementsByTagName(tag); } } : function (tag, context) { var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag); if (tag === '*') { while (elem = results[i++]) { if (elem.nodeType === 1) { tmp.push(elem); } } return tmp; } return results; }; Expr.find['CLASS'] = support.getElementsByClassName && function (className, context) { if (typeof context.getElementsByClassName !== strundefined && documentIsHTML) { return context.getElementsByClassName(className); } }; rbuggyMatches = []; rbuggyQSA = []; if (support.qsa = rnative.test(doc.querySelectorAll)) { assert(function (div) { div.innerHTML = '<select t=\'\'><option selected=\'\'></option></select>'; if (div.querySelectorAll('[t^=\'\']').length) { rbuggyQSA.push('[*^$]=' + whitespace + '*(?:\'\'|"")'); } if (!div.querySelectorAll('[selected]').length) { rbuggyQSA.push('\\[' + whitespace + '*(?:value|' + booleans + ')'); } if (!div.querySelectorAll(':checked').length) { rbuggyQSA.push(':checked'); } }); assert(function (div) { var input = doc.createElement('input'); input.setAttribute('type', 'hidden'); div.appendChild(input).setAttribute('name', 'D'); if (div.querySelectorAll('[name=d]').length) { rbuggyQSA.push('name' + whitespace + '*[*^$|!~]?='); } if (!div.querySelectorAll(':enabled').length) { rbuggyQSA.push(':enabled', ':disabled'); } div.querySelectorAll('*,:x'); rbuggyQSA.push(',.*:'); }); } if (support.matchesSelector = rnative.test(matches = docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) { assert(function (div) { support.disconnectedMatch = matches.call(div, 'div'); matches.call(div, '[s!=\'\']:x'); rbuggyMatches.push('!=', pseudos); }); } rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join('|')); rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join('|')); hasCompare = rnative.test(docElem.compareDocumentPosition); contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16)); } : function (a, b) { if (b) { while (b = b.parentNode) { if (b === a) { return true; } } } return false; }; sortOrder = hasCompare ? function (a, b) { if (a === b) { hasDuplicate = true; return 0; } var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if (compare) { return compare; } compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1; if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) { if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) { return -1; } if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) { return 1; } return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0; } return compare & 4 ? -1 : 1; } : function (a, b) { if (a === b) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b]; if (!aup || !bup) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0; } else if (aup === bup) { return siblingCheck(a, b); } cur = a; while (cur = cur.parentNode) { ap.unshift(cur); } cur = b; while (cur = cur.parentNode) { bp.unshift(cur); } while (ap[i] === bp[i]) { i++; } return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return doc; }; Sizzle.matches = function (expr, elements) { return Sizzle(expr, null, null, elements); }; Sizzle.matchesSelector = function (elem, expr) { if ((elem.ownerDocument || elem) !== document) { setDocument(elem); } expr = expr.replace(rattributeQuotes, '=\'$1\']'); if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) { try { var ret = matches.call(elem, expr); if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) { return ret; } } catch (e) { } } return Sizzle(expr, document, null, [elem]).length > 0; }; Sizzle.contains = function (context, elem) { if ((context.ownerDocument || context) !== document) { setDocument(context); } return contains(context, elem); }; Sizzle.attr = function (elem, name) { if ((elem.ownerDocument || elem) !== document) { setDocument(elem); } var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function (msg) { throw new Error('Syntax error, unrecognized expression: ' + msg); }; Sizzle.uniqueSort = function (results) { var elem, duplicates = [], j = 0, i = 0; hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice(0); results.sort(sortOrder); if (hasDuplicate) { while (elem = results[i++]) { if (elem === results[i]) { j = duplicates.push(i); } } while (j--) { results.splice(duplicates[j], 1); } } sortInput = null; return results; }; getText = Sizzle.getText = function (elem) { var node, ret = '', i = 0, nodeType = elem.nodeType; if (!nodeType) { while (node = elem[i++]) { ret += getText(node); } } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { if (typeof elem.textContent === 'string') { return elem.textContent; } else { for (elem = elem.firstChild; elem; elem = elem.nextSibling) { ret += getText(elem); } } } else if (nodeType === 3 || nodeType === 4) { return elem.nodeValue; } return ret; }; Expr = Sizzle.selectors = { cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { '>': { dir: 'parentNode', first: true }, ' ': { dir: 'parentNode' }, '+': { dir: 'previousSibling', first: true }, '~': { dir: 'previousSibling' } }, preFilter: { 'ATTR': function (match) { match[1] = match[1].replace(runescape, funescape); match[3] = (match[4] || match[5] || '').replace(runescape, funescape); if (match[2] === '~=') { match[3] = ' ' + match[3] + ' '; } return match.slice(0, 4); }, 'CHILD': function (match) { match[1] = match[1].toLowerCase(); if (match[1].slice(0, 3) === 'nth') { if (!match[3]) { Sizzle.error(match[0]); } match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === 'even' || match[3] === 'odd')); match[5] = +(match[7] + match[8] || match[3] === 'odd'); } else if (match[3]) { Sizzle.error(match[0]); } return match; }, 'PSEUDO': function (match) { var excess, unquoted = !match[5] && match[2]; if (matchExpr['CHILD'].test(match[0])) { return null; } if (match[3] && match[4] !== undefined) { match[2] = match[4]; } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(')', unquoted.length - excess) - unquoted.length)) { match[0] = match[0].slice(0, excess); match[2] = unquoted.slice(0, excess); } return match.slice(0, 3); } }, filter: { 'TAG': function (nodeNameSelector) { var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); return nodeNameSelector === '*' ? function () { return true; } : function (elem) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, 'CLASS': function (className) { var pattern = classCache[className + ' ']; return pattern || (pattern = new RegExp('(^|' + whitespace + ')' + className + '(' + whitespace + '|$)')) && classCache(className, function (elem) { return pattern.test(typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute('class') || ''); }); }, 'ATTR': function (name, operator, check) { return function (elem) { var result = Sizzle.attr(elem, name); if (result == null) { return operator === '!='; } if (!operator) { return true; } result += ''; return operator === '=' ? result === check : operator === '!=' ? result !== check : operator === '^=' ? check && result.indexOf(check) === 0 : operator === '*=' ? check && result.indexOf(check) > -1 : operator === '$=' ? check && result.slice(-check.length) === check : operator === '~=' ? (' ' + result + ' ').indexOf(check) > -1 : operator === '|=' ? result === check || result.slice(0, check.length + 1) === check + '-' : false; }; }, 'CHILD': function (type, what, argument, first, last) { var simple = type.slice(0, 3) !== 'nth', forward = type.slice(-4) !== 'last', ofType = what === 'of-type'; return first === 1 && last === 0 ? function (elem) { return !!elem.parentNode; } : function (elem, context, xml) { var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? 'nextSibling' : 'previousSibli