From 034ebf5b6369a0a198c4f7679f9816c70b6b4980 Mon Sep 17 00:00:00 2001 From: William Lin 22 Date: Wed, 8 Feb 2017 16:05:12 -0500 Subject: [PATCH] test bundlers --- .babelrc | 3 + a.js | 7 + b.js | 5 + b.min.js | 16 + bundle.js | 119 + bundle.js.map | 1 + c.js | 5 + dist/go-native.ie8.js | 2842 ---------------------- dist/go-native.ie8.min.js | 3 - dist/go-native.js | 1035 +++----- dist/go-native.js.map | 1 + dist/go-native.min.js | 2 - dist/sourcemaps/go-native.ie8.min.js.map | 1 - dist/sourcemaps/go-native.min.js.map | 1 - docker-compose.yml | 6 +- gulpfile.js | 115 +- rollup.config.js | 7 + src/gn/DOM.ready.js | 11 +- src/gn/append.js | 11 +- src/gn/base.js | 5 +- src/gn/createElement.js | 17 +- src/gn/extend.js | 5 +- src/gn/getClosest.js | 20 +- src/gn/getHeight.js | 32 +- src/gn/getOffsetLeft.js | 5 +- src/gn/getOffsetTop.js | 5 +- src/gn/getOuterHeight.js | 7 +- src/gn/getOuterWidth.js | 9 +- src/gn/getParents.js | 6 +- src/gn/getParentsUntil.js | 6 +- src/gn/getSiblings.js | 9 +- src/gn/getSupportedProp.js | 5 +- src/gn/getWidth.js | 29 +- src/gn/indexOf.js | 5 +- src/gn/isInViewport.js | 5 +- src/gn/isNodeList.js | 9 +- src/gn/optimizedResize.js | 9 +- src/gn/prepend.js | 6 +- src/gn/unwrap.js | 6 +- src/gn/wrap.js | 9 +- src/gn/wrapAll.js | 8 +- src/go-native.ie8.js | 0 src/go-native.js | 51 + src/vendors/Length.js | 143 ++ src/vendors/requestAnimationFrame.js | 26 + src/vendors/token-list.js | 352 +++ webpack.config.js | 44 + 47 files changed, 1253 insertions(+), 3771 deletions(-) create mode 100644 .babelrc create mode 100644 a.js create mode 100644 b.js create mode 100644 b.min.js create mode 100644 bundle.js create mode 100644 bundle.js.map create mode 100644 c.js delete mode 100755 dist/go-native.ie8.js delete mode 100755 dist/go-native.ie8.min.js create mode 100644 dist/go-native.js.map delete mode 100644 dist/go-native.min.js delete mode 100644 dist/sourcemaps/go-native.ie8.min.js.map delete mode 100644 dist/sourcemaps/go-native.min.js.map create mode 100644 rollup.config.js create mode 100644 src/go-native.ie8.js create mode 100644 src/go-native.js create mode 100644 src/vendors/Length.js create mode 100644 src/vendors/requestAnimationFrame.js create mode 100644 src/vendors/token-list.js create mode 100644 webpack.config.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..af0f0c3 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} \ No newline at end of file diff --git a/a.js b/a.js new file mode 100644 index 0000000..9ef564c --- /dev/null +++ b/a.js @@ -0,0 +1,7 @@ +import { multiply } from "./c"; + +var sum = function (a, b) { + return a + b; +}; + +export { sum }; \ No newline at end of file diff --git a/b.js b/b.js new file mode 100644 index 0000000..b25e870 --- /dev/null +++ b/b.js @@ -0,0 +1,5 @@ +import { sum } from './a'; +import { multiply } from "./c"; + +alert(sum(1, 2)); +console.log(multiply(1, 2)); \ No newline at end of file diff --git a/b.min.js b/b.min.js new file mode 100644 index 0000000..ea045d5 --- /dev/null +++ b/b.min.js @@ -0,0 +1,16 @@ +(function () { +'use strict'; + +var multiply = function (a, b) { + return a * b; +}; + +var sum = function (a, b) { + return a + b; +}; + +alert(sum(1, 2)); +console.log(multiply(1, 2)); + +}()); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYi5taW4uanMiLCJzb3VyY2VzIjpbImMuanMiLCJhLmpzIiwiYi5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgbXVsdGlwbHkgPSBmdW5jdGlvbiAoYSwgYikge1xuICByZXR1cm4gYSAqIGI7XG59O1xuXG5leHBvcnQgeyBtdWx0aXBseSB9OyIsImltcG9ydCB7IG11bHRpcGx5IH0gZnJvbSBcIi4vY1wiO1xuXG52YXIgc3VtID0gZnVuY3Rpb24gKGEsIGIpIHtcbiAgcmV0dXJuIGEgKyBiO1xufTtcblxuZXhwb3J0IHsgc3VtIH07IiwiaW1wb3J0IHsgc3VtIH0gZnJvbSAnLi9hJztcbmltcG9ydCB7IG11bHRpcGx5IH0gZnJvbSBcIi4vY1wiO1xuXG5hbGVydChzdW0oMSwgMikpO1xuY29uc29sZS5sb2cobXVsdGlwbHkoMSwgMikpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxJQUFJLFFBQVEsR0FBRyxVQUFVLENBQUMsRUFBRSxDQUFDLEVBQUU7RUFDN0IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0NBQ2QsQ0FBQyxBQUVGOztBQ0ZBLElBQUksR0FBRyxHQUFHLFVBQVUsQ0FBQyxFQUFFLENBQUMsRUFBRTtFQUN4QixPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7Q0FDZCxDQUFDLEFBRUY7O0FDSEEsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUNqQixPQUFPLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsOzsifQ== diff --git a/bundle.js b/bundle.js new file mode 100644 index 0000000..e1341d4 --- /dev/null +++ b/bundle.js @@ -0,0 +1,119 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 3); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return multiply; }); +var multiply = function (a, b) { + return a * b; +}; + + + +/***/ }), +/* 1 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__a__ = __webpack_require__(2); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__c__ = __webpack_require__(0); + + + +alert(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__a__["a" /* sum */])(1, 2)); +console.log(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__c__["a" /* multiply */])(1, 2)); + +/***/ }), +/* 2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__c__ = __webpack_require__(0); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return sum; }); + + +var sum = function (a, b) { + return a + b; +}; + + + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(1); + + +/***/ }) +/******/ ]); +//# sourceMappingURL=bundle.js.map \ No newline at end of file diff --git a/bundle.js.map b/bundle.js.map new file mode 100644 index 0000000..95e4af2 --- /dev/null +++ b/bundle.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap ca5e53e49bccf10742a1","webpack:///./c.js","webpack:///./b.js","webpack:///./a.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AChEA;AAAA;AACA;AACA;;;;;;;;;;;;ACFc;AACK;;AAEnB;AACA,+F;;;;;;;;;ACJmB;;AAEnB;AACA;AACA","file":"bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 3);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap ca5e53e49bccf10742a1","var multiply = function (a, b) {\n return a * b;\n};\n\nexport { multiply };\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./c.js\n// module id = 0\n// module chunks = 0","import { sum } from './a';\nimport { multiply } from \"./c\";\n\nalert(sum(1, 2));\nconsole.log(multiply(1, 2));\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./b.js\n// module id = 1\n// module chunks = 0","import { multiply } from \"./c\";\n\nvar sum = function (a, b) {\n return a + b;\n};\n\nexport { sum };\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./a.js\n// module id = 2\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/c.js b/c.js new file mode 100644 index 0000000..815763c --- /dev/null +++ b/c.js @@ -0,0 +1,5 @@ +var multiply = function (a, b) { + return a * b; +}; + +export { multiply }; \ No newline at end of file diff --git a/dist/go-native.ie8.js b/dist/go-native.ie8.js deleted file mode 100755 index c8a36fa..0000000 --- a/dist/go-native.ie8.js +++ /dev/null @@ -1,2842 +0,0 @@ -/* - * Copyright (C) 2007-2015 Diego Perini - * All rights reserved. - * - * nwmatcher.js - A fast CSS selector engine and matcher - * - * Author: Diego Perini - * Version: 1.3.6 - * Created: 20070722 - * Release: 20150710 - * - * License: - * http://javascript.nwbox.com/NWMatcher/MIT-LICENSE - * Download: - * http://javascript.nwbox.com/NWMatcher/nwmatcher.js - */ - -(function(global, factory) { - - if (typeof module == 'object' && typeof exports == 'object') { - // in a Node.js environment, the nwmatcher functions will operate on - // the passed "browserGlobal" and will be returned in an object - module.exports = function (browserGlobal) { - // passed global does not contain - // references to native objects - browserGlobal.console = console; - browserGlobal.parseInt = parseInt; - browserGlobal.Function = Function; - browserGlobal.Boolean = Boolean; - browserGlobal.Number = Number; - browserGlobal.RegExp = RegExp; - browserGlobal.String = String; - browserGlobal.Object = Object; - browserGlobal.Array = Array; - browserGlobal.Error = Error; - browserGlobal.Date = Date; - browserGlobal.Math = Math; - var exports = browserGlobal.Object(); - factory(browserGlobal, exports); - return exports; - }; - module.factory = factory; - } else { - // in a browser environment, the nwmatcher functions will operate on - // the "global" loading them and be attached to "global.NW.Dom" - factory(global, - (global.NW || (global.NW = global.Object())) && - (global.NW.Dom || (global.NW.Dom = global.Object()))); - global.NW.Dom.factory = factory; - } - -})(this, function(global, exports) { - - var version = 'nwmatcher-1.3.6', - - Dom = exports, - - // processing context & root element - doc = global.document, - root = doc.documentElement, - - // save utility methods references - slice = global.Array.prototype.slice, - string = global.Object.prototype.toString, - - // persist previous parsed data - isSingleMatch, - isSingleSelect, - - lastSlice, - lastContext, - lastPosition, - - lastMatcher, - lastSelector, - - lastPartsMatch, - lastPartsSelect, - - // accepted prefix identifiers - // (id, class & pseudo-class) - prefixes = '[#.:]?', - - // accepted attribute operators - operators = '([~*^$|!]?={1})', - - // accepted whitespace characters - whitespace = '[\\x20\\t\\n\\r\\f]*', - - // 4 combinators F E, F>E, F+E, F~E - combinators = '[\\x20]|[>+~][^>+~]', - - // an+b format params for pseudo-classes - pseudoparms = '(?:[-+]?\\d*n)?[-+]?\\d*', - - // CSS quoted string values - quotedvalue = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"' + "|'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'", - - // skip round brackets groups - skipround = '\\([^()]+\\)|\\(.*\\)', - // skip curly brackets groups - skipcurly = '\\{[^{}]+\\}|\\{.*\\}', - // skip square brackets groups - skipsquare = '\\[[^[\\]]*\\]|\\[.*\\]', - - // skip [ ], ( ), { } brackets groups - skipgroup = '\\[.*\\]|\\(.*\\)|\\{.*\\}', - - // http://www.w3.org/TR/css3-syntax/#characters - // unicode/ISO 10646 characters 161 and higher - // NOTE: Safari 2.0.x crashes with escaped (\\) - // Unicode ranges in regular expressions so we - // use a negated character range class instead - encoding = '(?:[-\\w]|[^\\x00-\\xa0]|\\\\.)', - - // CSS identifier syntax - identifier = '(?:-?[_a-zA-Z]{1}[-\\w]*|[^\\x00-\\xa0]+|\\\\.+)+', - - // build attribute string - attrcheck = '(' + quotedvalue + '|' + identifier + ')', - attributes = whitespace + '(' + encoding + '*:?' + encoding + '+)' + - whitespace + '(?:' + operators + whitespace + attrcheck + ')?' + whitespace, - attrmatcher = attributes.replace(attrcheck, '([\\x22\\x27]*)((?:\\\\?.)*?)\\3'), - - // build pseudoclass string - pseudoclass = '((?:' + - // an+b parameters or quoted string - pseudoparms + '|' + quotedvalue + '|' + - // id, class, pseudo-class selector - prefixes + '|' + encoding + '+|' + - // nested HTML attribute selector - '\\[' + attributes + '\\]|' + - // nested pseudo-class selector - '\\(.+\\)|' + whitespace + '|' + - // nested pseudos/separators - ',)+)', - - // placeholder for extensions - extensions = '.+', - - // CSS3: syntax scanner and - // one pass validation only - // using regular expression - standardValidator = - // discard start - '(?=[\\x20\\t\\n\\r\\f]*[^>+~(){}<>])' + - // open match group - '(' + - //universal selector - '\\*' + - // id/class/tag/pseudo-class identifier - '|(?:' + prefixes + identifier + ')' + - // combinator selector - '|' + combinators + - // HTML attribute selector - '|\\[' + attributes + '\\]' + - // pseudo-classes parameters - '|\\(' + pseudoclass + '\\)' + - // dom properties selector (extension) - '|\\{' + extensions + '\\}' + - // selector group separator (comma) - '|(?:,|' + whitespace + ')' + - // close match group - ')+', - - // validator for complex selectors in ':not()' pseudo-classes - extendedValidator = standardValidator.replace(pseudoclass, '.*'), - - // validator for standard selectors as default - reValidator = new global.RegExp(standardValidator, 'g'), - - // whitespace is any combination of these 5 character [\x20\t\n\r\f] - // http://www.w3.org/TR/css3-selectors/#selector-syntax - reTrimSpaces = new global.RegExp('^' + - whitespace + '|' + whitespace + '$', 'g'), - - // only allow simple selectors nested in ':not()' pseudo-classes - reSimpleNot = new global.RegExp('^(' + - '(?!:not)' + - '(' + prefixes + - '|' + identifier + - '|\\([^()]*\\))+' + - '|\\[' + attributes + '\\]' + - ')$'), - - // split comma groups, exclude commas from - // quotes '' "" and from brackets () [] {} - reSplitGroup = new global.RegExp('(' + - '[^,\\\\()[\\]]+' + - '|' + skipsquare + - '|' + skipround + - '|' + skipcurly + - '|\\\\.' + - ')+', 'g'), - - // split last, right most, selector group token - reSplitToken = new global.RegExp('(' + - '\\[' + attributes + '\\]|' + - '\\(' + pseudoclass + '\\)|' + - '\\\\.|[^\\x20\\t\\r\\n\\f>+~])+', 'g'), - - // for in excess whitespace removal - reWhiteSpace = /[\x20\t\n\r\f]+/g, - - reOptimizeSelector = new global.RegExp(identifier + '|^$'), - - /*----------------------------- FEATURE TESTING ----------------------------*/ - - // detect native methods - isNative = (function() { - var re = / \w+\(/, - isnative = String(Object.prototype.toString).replace(re, ' ('); - return function(method) { - return method && typeof method != 'string' && - isnative == String(method).replace(re, ' ('); - }; - })(), - - // NATIVE_XXXXX true if method exist and is callable - // detect if DOM methods are native in browsers - NATIVE_FOCUS = isNative(doc.hasFocus), - NATIVE_QSAPI = isNative(doc.querySelector), - NATIVE_GEBID = isNative(doc.getElementById), - NATIVE_GEBTN = isNative(root.getElementsByTagName), - NATIVE_GEBCN = isNative(root.getElementsByClassName), - - // detect native getAttribute/hasAttribute methods, - // frameworks extend these to elements, but it seems - // this does not work for XML namespaced attributes, - // used to check both getAttribute/hasAttribute in IE - NATIVE_GET_ATTRIBUTE = isNative(root.getAttribute), - NATIVE_HAS_ATTRIBUTE = isNative(root.hasAttribute), - - // check if slice() can convert nodelist to array - // see http://yura.thinkweb2.com/cft/ - NATIVE_SLICE_PROTO = - (function() { - var isBuggy = false; - try { - isBuggy = !!slice.call(doc.childNodes, 0)[0]; - } catch(e) { } - return isBuggy; - })(), - - // supports the new traversal API - NATIVE_TRAVERSAL_API = - 'nextElementSibling' in root && 'previousElementSibling' in root, - - // BUGGY_XXXXX true if method is feature tested and has known bugs - // detect buggy gEBID - BUGGY_GEBID = NATIVE_GEBID ? - (function() { - var isBuggy = true, x = 'x' + global.String(+new global.Date), - a = doc.createElementNS ? 'a' : ''; - (a = doc.createElement(a)).name = x; - root.insertBefore(a, root.firstChild); - isBuggy = !!doc.getElementById(x); - root.removeChild(a); - return isBuggy; - })() : - true, - - // detect IE gEBTN comment nodes bug - BUGGY_GEBTN = NATIVE_GEBTN ? - (function() { - var div = doc.createElement('div'); - div.appendChild(doc.createComment('')); - return !!div.getElementsByTagName('*')[0]; - })() : - true, - - // detect Opera gEBCN second class and/or UTF8 bugs as well as Safari 3.2 - // caching class name results and not detecting when changed, - // tests are based on the jQuery selector test suite - BUGGY_GEBCN = NATIVE_GEBCN ? - (function() { - var isBuggy, div = doc.createElement('div'), test = '\u53f0\u5317'; - - // Opera tests - div.appendChild(doc.createElement('span')). - setAttribute('class', test + 'abc ' + test); - div.appendChild(doc.createElement('span')). - setAttribute('class', 'x'); - - isBuggy = !div.getElementsByClassName(test)[0]; - - // Safari test - div.lastChild.className = test; - return isBuggy || div.getElementsByClassName(test).length != 2; - })() : - true, - - // detect IE bug with dynamic attributes - BUGGY_GET_ATTRIBUTE = NATIVE_GET_ATTRIBUTE ? - (function() { - var input = doc.createElement('input'); - input.setAttribute('value', 5); - return input.defaultValue != 5; - })() : - true, - - // detect IE bug with non-standard boolean attributes - BUGGY_HAS_ATTRIBUTE = NATIVE_HAS_ATTRIBUTE ? - (function() { - var option = doc.createElement('option'); - option.setAttribute('selected', 'selected'); - return !option.hasAttribute('selected'); - })() : - true, - - // detect Safari bug with selected option elements - BUGGY_SELECTED = - (function() { - var select = doc.createElement('select'); - select.appendChild(doc.createElement('option')); - return !select.firstChild.selected; - })(), - - // initialized with the loading context - // and reset for each different context - BUGGY_QUIRKS_GEBCN, - BUGGY_QUIRKS_QSAPI, - - QUIRKS_MODE, - XML_DOCUMENT, - - // detect Opera browser - OPERA = /opera/i.test(string.call(global.opera)), - - // skip simple selector optimizations for Opera >= 11 - OPERA_QSAPI = OPERA && global.parseFloat(global.opera.version()) >= 11, - - // check Selector API implementations - RE_BUGGY_QSAPI = NATIVE_QSAPI ? - (function() { - var pattern = new global.Array(), context, element, - - expect = function(selector, element, n) { - var result = false; - context.appendChild(element); - try { result = context.querySelectorAll(selector).length == n; } catch(e) { } - while (context.firstChild) { context.removeChild(context.firstChild); } - return result; - }; - - // certain bugs can only be detected in standard documents - // to avoid writing a live loading document create a fake one - if (doc.implementation && doc.implementation.createDocument) { - // use a shadow document body as context - context = doc.implementation.createDocument('', '', null). - appendChild(doc.createElement('html')). - appendChild(doc.createElement('head')).parentNode. - appendChild(doc.createElement('body')); - } else { - // use an unattached div node as context - context = doc.createElement('div'); - } - - // fix for Safari 8.x and other engines that - // fail querying filtered sibling combinators - element = doc.createElement('div'); - element.innerHTML = '


'; - expect('p#a+*', element, 0) && - pattern.push('\\w+#\\w+.*[+~]'); - - // ^= $= *= operators bugs with empty values (Opera 10 / IE8) - element = doc.createElement('p'); - element.setAttribute('class', ''); - expect('[class^=""]', element, 1) && - pattern.push('[*^$]=[\\x20\\t\\n\\r\\f]*(?:""|' + "'')"); - - // :checked bug with option elements (Firefox 3.6.x) - // it wrongly includes 'selected' options elements - // HTML5 rules says selected options also match - element = doc.createElement('option'); - element.setAttribute('selected', 'selected'); - expect(':checked', element, 0) && - pattern.push(':checked'); - - // :enabled :disabled bugs with hidden fields (Firefox 3.5) - // http://www.w3.org/TR/html5/links.html#selector-enabled - // http://www.w3.org/TR/css3-selectors/#enableddisabled - // not supported by IE8 Query Selector - element = doc.createElement('input'); - element.setAttribute('type', 'hidden'); - expect(':enabled', element, 0) && - pattern.push(':enabled', ':disabled'); - - // :link bugs with hyperlinks matching (Firefox/Safari) - element = doc.createElement('link'); - element.setAttribute('href', 'x'); - expect(':link', element, 1) || - pattern.push(':link'); - - // avoid attribute selectors for IE QSA - if (BUGGY_HAS_ATTRIBUTE) { - // IE fails in reading: - // - original values for input/textarea - // - original boolean values for controls - pattern.push('\\[[\\x20\\t\\n\\r\\f]*(?:checked|disabled|ismap|multiple|readonly|selected|value)'); - } - - return pattern.length ? - new global.RegExp(pattern.join('|')) : - { 'test': function() { return false; } }; - - })() : - true, - - // matches class selectors - RE_CLASS = new global.RegExp('(?:\\[[\\x20\\t\\n\\r\\f]*class\\b|\\.' + identifier + ')'), - - // matches simple id, tag & class selectors - RE_SIMPLE_SELECTOR = new global.RegExp( - BUGGY_GEBTN && BUGGY_GEBCN || OPERA ? - '^#?-?[_a-zA-Z]{1}' + encoding + '*$' : BUGGY_GEBTN ? - '^[.#]?-?[_a-zA-Z]{1}' + encoding + '*$' : BUGGY_GEBCN ? - '^(?:\\*|#-?[_a-zA-Z]{1}' + encoding + '*)$' : - '^(?:\\*|[.#]?-?[_a-zA-Z]{1}' + encoding + '*)$'), - - /*----------------------------- LOOKUP OBJECTS -----------------------------*/ - - LINK_NODES = new global.Object({ 'a': 1, 'A': 1, 'area': 1, 'AREA': 1, 'link': 1, 'LINK': 1 }), - - // boolean attributes should return attribute name instead of true/false - ATTR_BOOLEAN = new global.Object({ - 'checked': 1, 'disabled': 1, 'ismap': 1, - 'multiple': 1, 'readonly': 1, 'selected': 1 - }), - - // dynamic attributes that needs to be checked against original HTML value - ATTR_DEFAULT = new global.Object({ - 'value': 'defaultValue', - 'checked': 'defaultChecked', - 'selected': 'defaultSelected' - }), - - // attributes referencing URI data values need special treatment in IE - ATTR_URIDATA = new global.Object({ - 'action': 2, 'cite': 2, 'codebase': 2, 'data': 2, 'href': 2, - 'longdesc': 2, 'lowsrc': 2, 'src': 2, 'usemap': 2 - }), - - // HTML 5 draft specifications - // http://www.whatwg.org/specs/web-apps/current-work/#selectors - HTML_TABLE = new global.Object({ - // class attribute must be treated case-insensitive in HTML quirks mode - // initialized by default to Standard Mode (case-sensitive), - // set dynamically by the attribute resolver - 'class': 0, - 'accept': 1, 'accept-charset': 1, 'align': 1, 'alink': 1, 'axis': 1, - 'bgcolor': 1, 'charset': 1, 'checked': 1, 'clear': 1, 'codetype': 1, 'color': 1, - 'compact': 1, 'declare': 1, 'defer': 1, 'dir': 1, 'direction': 1, 'disabled': 1, - 'enctype': 1, 'face': 1, 'frame': 1, 'hreflang': 1, 'http-equiv': 1, 'lang': 1, - 'language': 1, 'link': 1, 'media': 1, 'method': 1, 'multiple': 1, 'nohref': 1, - 'noresize': 1, 'noshade': 1, 'nowrap': 1, 'readonly': 1, 'rel': 1, 'rev': 1, - 'rules': 1, 'scope': 1, 'scrolling': 1, 'selected': 1, 'shape': 1, 'target': 1, - 'text': 1, 'type': 1, 'valign': 1, 'valuetype': 1, 'vlink': 1 - }), - - // the following attributes must be treated case-insensitive in XHTML mode - // Niels Leenheer http://rakaz.nl/item/css_selector_bugs_case_sensitivity - XHTML_TABLE = new global.Object({ - 'accept': 1, 'accept-charset': 1, 'alink': 1, 'axis': 1, - 'bgcolor': 1, 'charset': 1, 'codetype': 1, 'color': 1, - 'enctype': 1, 'face': 1, 'hreflang': 1, 'http-equiv': 1, - 'lang': 1, 'language': 1, 'link': 1, 'media': 1, 'rel': 1, - 'rev': 1, 'target': 1, 'text': 1, 'type': 1, 'vlink': 1 - }), - - /*-------------------------- REGULAR EXPRESSIONS ---------------------------*/ - - // placeholder to add functionalities - Selectors = new global.Object({ - // as a simple example this will check - // for chars not in standard ascii table - // - // 'mySpecialSelector': { - // 'Expression': /\u0080-\uffff/, - // 'Callback': mySelectorCallback - // } - // - // 'mySelectorCallback' will be invoked - // only after passing all other standard - // checks and only if none of them worked - }), - - // attribute operators - Operators = new global.Object({ - '=': "n=='%m'", - '^=': "n.indexOf('%m')==0", - '*=': "n.indexOf('%m')>-1", - '|=': "(n+'-').indexOf('%m-')==0", - '~=': "(' '+n+' ').indexOf(' %m ')>-1", - '$=': "n.substr(n.length-'%m'.length)=='%m'" - }), - - // optimization expressions - Optimize = new global.Object({ - ID: new global.RegExp('^\\*?#(' + encoding + '+)|' + skipgroup), - TAG: new global.RegExp('^(' + encoding + '+)|' + skipgroup), - CLASS: new global.RegExp('^\\*?\\.(' + encoding + '+$)|' + skipgroup) - }), - - // precompiled Regular Expressions - Patterns = new global.Object({ - // structural pseudo-classes and child selectors - spseudos: /^\:(root|empty|(?:first|last|only)(?:-child|-of-type)|nth(?:-last)?(?:-child|-of-type)\(\s*(even|odd|(?:[-+]{0,1}\d*n\s*)?[-+]{0,1}\s*\d*)\s*\))?(.*)/i, - // uistates + dynamic + negation pseudo-classes - dpseudos: /^\:(link|visited|target|active|focus|hover|checked|disabled|enabled|selected|lang\(([-\w]{2,})\)|not\(([^()]*|.*)\))?(.*)/i, - // element attribute matcher - attribute: new global.RegExp('^\\[' + attrmatcher + '\\](.*)'), - // E > F - children: /^[\x20\t\n\r\f]*\>[\x20\t\n\r\f]*(.*)/, - // E + F - adjacent: /^[\x20\t\n\r\f]*\+[\x20\t\n\r\f]*(.*)/, - // E ~ F - relative: /^[\x20\t\n\r\f]*\~[\x20\t\n\r\f]*(.*)/, - // E F - ancestor: /^[\x20\t\n\r\f]+(.*)/, - // all - universal: /^\*(.*)/, - // id - id: new global.RegExp('^#(' + encoding + '+)(.*)'), - // tag - tagName: new global.RegExp('^(' + encoding + '+)(.*)'), - // class - className: new global.RegExp('^\\.(' + encoding + '+)(.*)') - }), - - /*------------------------------ UTIL METHODS ------------------------------*/ - - // concat elements to data - concatList = - function(data, elements) { - var i = -1, element; - if (!data.length && global.Array.slice) - return global.Array.slice(elements); - while ((element = elements[++i])) - data[data.length] = element; - return data; - }, - - // concat elements to data and callback - concatCall = - function(data, elements, callback) { - var i = -1, element; - while ((element = elements[++i])) { - if (false === callback(data[data.length] = element)) { break; } - } - return data; - }, - - // change context specific variables - switchContext = - function(from, force) { - var div, oldDoc = doc; - // save passed context - lastContext = from; - // set new context document - doc = from.ownerDocument || from; - if (force || oldDoc !== doc) { - // set document root - root = doc.documentElement; - // set host environment flags - XML_DOCUMENT = doc.createElement('DiV').nodeName == 'DiV'; - - // In quirks mode css class names are case insensitive. - // In standards mode they are case sensitive. See docs: - // https://developer.mozilla.org/en/Mozilla_Quirks_Mode_Behavior - // http://www.whatwg.org/specs/web-apps/current-work/#selectors - QUIRKS_MODE = !XML_DOCUMENT && - typeof doc.compatMode == 'string' ? - doc.compatMode.indexOf('CSS') < 0 : - (function() { - var style = doc.createElement('div').style; - return style && (style.width = 1) && style.width == '1px'; - })(); - - div = doc.createElement('div'); - div.appendChild(doc.createElement('p')).setAttribute('class', 'xXx'); - div.appendChild(doc.createElement('p')).setAttribute('class', 'xxx'); - - // GEBCN buggy in quirks mode, match count is: - // Firefox 3.0+ [xxx = 1, xXx = 1] - // Opera 10.63+ [xxx = 0, xXx = 2] - BUGGY_QUIRKS_GEBCN = - !XML_DOCUMENT && NATIVE_GEBCN && QUIRKS_MODE && - (div.getElementsByClassName('xxx').length != 2 || - div.getElementsByClassName('xXx').length != 2); - - // QSAPI buggy in quirks mode, match count is: - // At least Chrome 4+, Firefox 3.5+, Opera 10.x+, Safari 4+ [xxx = 1, xXx = 2] - // Safari 3.2 QSA doesn't work with mixedcase in quirksmode [xxx = 1, xXx = 0] - // https://bugs.webkit.org/show_bug.cgi?id=19047 - // must test the attribute selector '[class~=xxx]' - // before '.xXx' or the bug may not present itself - BUGGY_QUIRKS_QSAPI = - !XML_DOCUMENT && NATIVE_QSAPI && QUIRKS_MODE && - (div.querySelectorAll('[class~=xxx]').length != 2 || - div.querySelectorAll('.xXx').length != 2); - - Config.CACHING && Dom.setCache(true, doc); - } - }, - - // convert a CSS string or identifier containing escape sequence to a - // javascript string with javascript escape sequences - convertEscapes = - function(str) { - return str.replace(/\\([0-9a-fA-F]{1,6}\x20?|.)|([\x22\x27])/g, function(substring, p1, p2) { - var codePoint, highHex, highSurrogate, lowHex, lowSurrogate; - - if (p2) { - // unescaped " or ' - return '\\' + p2; - } - - if (/^[0-9a-fA-F]/.test(p1)) { - // \1f23 - codePoint = parseInt(p1, 16); - - if (codePoint < 0 || codePoint > 0x10ffff) { - // the replacement character - return '\\ufffd'; - } - - // javascript strings are in UTF-16 - if (codePoint <= 0xffff) { - // Basic - lowHex = '000' + codePoint.toString(16); - return '\\u' + lowHex.substr(lowHex.length - 4); - } - - // Supplementary - codePoint -= 0x10000; - highSurrogate = (codePoint >> 10) + 0xd800; - lowSurrogate = (codePoint % 0x400) + 0xdc00; - highHex = '000' + highSurrogate.toString(16); - lowHex = '000' + lowSurrogate.toString(16); - - return '\\u' + highHex.substr(highHex.length - 4) + - '\\u' + lowHex.substr(lowHex.length - 4); - } - - if (/^[\\\x22\x27]/.test(p1)) { - // \' \" - return substring; - } - - // \g \h \. \# etc - return p1; - }); - }, - - /*------------------------------ DOM METHODS -------------------------------*/ - - // element by id (raw) - // @return reference or null - byIdRaw = - function(id, elements) { - var i = -1, element = null; - while ((element = elements[++i])) { - if (element.getAttribute('id') == id) { - break; - } - } - return element; - }, - - // element by id - // @return reference or null - _byId = !BUGGY_GEBID ? - function(id, from) { - id = id.replace(/\\([^\\]{1})/g, '$1'); - return from.getElementById && from.getElementById(id) || - byIdRaw(id, from.getElementsByTagName('*')); - } : - function(id, from) { - var element = null; - id = id.replace(/\\([^\\]{1})/g, '$1'); - if (XML_DOCUMENT || from.nodeType != 9) { - return byIdRaw(id, from.getElementsByTagName('*')); - } - if ((element = from.getElementById(id)) && - element.name == id && from.getElementsByName) { - return byIdRaw(id, from.getElementsByName(id)); - } - return element; - }, - - // publicly exposed byId - // @return reference or null - byId = - function(id, from) { - from || (from = doc); - if (lastContext !== from) { switchContext(from); } - return _byId(id, from); - }, - - // elements by tag (raw) - // @return array - byTagRaw = - function(tag, from) { - var any = tag == '*', element = from, elements = new global.Array(), next = element.firstChild; - any || (tag = tag.toUpperCase()); - while ((element = next)) { - if (element.tagName > '@' && (any || element.tagName.toUpperCase() == tag)) { - elements[elements.length] = element; - } - if ((next = element.firstChild || element.nextSibling)) continue; - while (!next && (element = element.parentNode) && element !== from) { - next = element.nextSibling; - } - } - return elements; - }, - - // elements by tag - // @return array - _byTag = !BUGGY_GEBTN && NATIVE_SLICE_PROTO ? - function(tag, from) { - return XML_DOCUMENT || from.nodeType == 11 ? byTagRaw(tag, from) : - slice.call(from.getElementsByTagName(tag), 0); - } : - function(tag, from) { - var i = -1, j = i, data = new global.Array(), - element, elements = from.getElementsByTagName(tag); - if (tag == '*') { - while ((element = elements[++i])) { - if (element.nodeName > '@') - data[++j] = element; - } - } else { - while ((element = elements[++i])) { - data[i] = element; - } - } - return data; - }, - - // publicly exposed byTag - // @return array - byTag = - function(tag, from) { - from || (from = doc); - if (lastContext !== from) { switchContext(from); } - return _byTag(tag, from); - }, - - // publicly exposed byName - // @return array - byName = - function(name, from) { - return select('[name="' + name.replace(/\\([^\\]{1})/g, '$1') + '"]', from); - }, - - // elements by class (raw) - // @return array - byClassRaw = - function(name, from) { - var i = -1, j = i, data = new global.Array(), element, elements = _byTag('*', from), n; - name = ' ' + (QUIRKS_MODE ? name.toLowerCase() : name).replace(/\\([^\\]{1})/g, '$1') + ' '; - while ((element = elements[++i])) { - n = XML_DOCUMENT ? element.getAttribute('class') : element.className; - if (n && n.length && (' ' + (QUIRKS_MODE ? n.toLowerCase() : n). - replace(reWhiteSpace, ' ') + ' ').indexOf(name) > -1) { - data[++j] = element; - } - } - return data; - }, - - // elements by class - // @return array - _byClass = - function(name, from) { - return (BUGGY_GEBCN || BUGGY_QUIRKS_GEBCN || XML_DOCUMENT || !from.getElementsByClassName) ? - byClassRaw(name, from) : slice.call(from.getElementsByClassName(name.replace(/\\([^\\]{1})/g, '$1')), 0); - }, - - // publicly exposed byClass - // @return array - byClass = - function(name, from) { - from || (from = doc); - if (lastContext !== from) { switchContext(from); } - return _byClass(name, from); - }, - - // check element is descendant of container - // @return boolean - contains = 'compareDocumentPosition' in root ? - function(container, element) { - return (container.compareDocumentPosition(element) & 16) == 16; - } : 'contains' in root ? - function(container, element) { - return container !== element && container.contains(element); - } : - function(container, element) { - while ((element = element.parentNode)) { - if (element === container) return true; - } - return false; - }, - - // attribute value - // @return string - getAttribute = !BUGGY_GET_ATTRIBUTE ? - function(node, attribute) { - return node.getAttribute(attribute); - } : - function(node, attribute) { - attribute = attribute.toLowerCase(); - if (typeof node[attribute] == 'object') { - return node.attributes[attribute] && - node.attributes[attribute].value; - } - return ( - // 'type' can only be read by using native getAttribute - attribute == 'type' ? node.getAttribute(attribute) : - // specific URI data attributes (parameter 2 to fix IE bug) - ATTR_URIDATA[attribute] ? node.getAttribute(attribute, 2) : - // boolean attributes should return name instead of true/false - ATTR_BOOLEAN[attribute] ? node.getAttribute(attribute) ? attribute : 'false' : - (node = node.getAttributeNode(attribute)) && node.value); - }, - - // attribute presence - // @return boolean - hasAttribute = !BUGGY_HAS_ATTRIBUTE ? - function(node, attribute) { - return XML_DOCUMENT ? - !!node.getAttribute(attribute) : - node.hasAttribute(attribute); - } : - function(node, attribute) { - // read the node attribute object - var obj = node.getAttributeNode(attribute = attribute.toLowerCase()); - return ATTR_DEFAULT[attribute] && attribute != 'value' ? - node[ATTR_DEFAULT[attribute]] : obj && obj.specified; - }, - - // check node emptyness - // @return boolean - isEmpty = - function(node) { - node = node.firstChild; - while (node) { - if (node.nodeType == 3 || node.nodeName > '@') return false; - node = node.nextSibling; - } - return true; - }, - - // check if element matches the :link pseudo - // @return boolean - isLink = - function(element) { - return hasAttribute(element,'href') && LINK_NODES[element.nodeName]; - }, - - // child position by nodeType - // @return number - nthElement = - function(element, last) { - var count = 1, succ = last ? 'nextSibling' : 'previousSibling'; - while ((element = element[succ])) { - if (element.nodeName > '@') ++count; - } - return count; - }, - - // child position by nodeName - // @return number - nthOfType = - function(element, last) { - var count = 1, succ = last ? 'nextSibling' : 'previousSibling', type = element.nodeName; - while ((element = element[succ])) { - if (element.nodeName == type) ++count; - } - return count; - }, - - /*------------------------------- DEBUGGING --------------------------------*/ - - // get/set (string/object) working modes - configure = - function(option) { - if (typeof option == 'string') { return Config[option] || Config; } - if (typeof option != 'object') { return false; } - for (var i in option) { - Config[i] = !!option[i]; - if (i == 'SIMPLENOT') { - matchContexts = new global.Object(); - matchResolvers = new global.Object(); - selectContexts = new global.Object(); - selectResolvers = new global.Object(); - if (!Config[i]) { Config['USE_QSAPI'] = false; } - } else if (i == 'USE_QSAPI') { - Config[i] = !!option[i] && NATIVE_QSAPI; - } - } - reValidator = new global.RegExp(Config.SIMPLENOT ? - standardValidator : extendedValidator, 'g'); - return true; - }, - - // control user notifications - emit = - function(message) { - if (Config.VERBOSITY) { throw new global.Error(message); } - if (global.console && global.console.log) { - global.console.log(message); - } - }, - - Config = new global.Object({ - - // used to enable/disable caching of result sets - CACHING: false, - - // by default do not add missing left/right context - // to selector string shortcuts like "+div" or "ul>" - // callable Dom.shortcuts method has to be available - SHORTCUTS: false, - - // by default disable complex selectors nested in - // ':not()' pseudo-classes, as for specifications - SIMPLENOT: true, - - // strict QSA match all non-unique IDs (false) - // speed & libs compat match unique ID (true) - UNIQUE_ID: true, - - // HTML5 handling for the ":checked" pseudo-class - USE_HTML5: true, - - // controls enabling the Query Selector API branch - USE_QSAPI: NATIVE_QSAPI, - - // controls the engine error/warning notifications - VERBOSITY: true - - }), - - /*---------------------------- COMPILER METHODS ----------------------------*/ - - // code string reused to build compiled functions - ACCEPT_NODE = 'r[r.length]=c[k];if(f&&false===f(c[k]))break main;else continue main;', - - // compile a comma separated group of selector - // @mode boolean true for select, false for match - // return a compiled function - compile = - function(selector, source, mode) { - - var parts = typeof selector == 'string' ? selector.match(reSplitGroup) : selector; - - // ensures that source is a string - typeof source == 'string' || (source = ''); - - if (parts.length == 1) { - source += compileSelector(parts[0], mode ? ACCEPT_NODE : 'f&&f(k);return true;', mode); - } else { - // for each selector in the group - var i = -1, seen = new global.Object(), token; - while ((token = parts[++i])) { - token = token.replace(reTrimSpaces, ''); - // avoid repeating the same token - // in comma separated group (p, p) - if (!seen[token] && (seen[token] = true)) { - source += compileSelector(token, mode ? ACCEPT_NODE : 'f&&f(k);return true;', mode); - } - } - } - - if (mode) { - // for select method - return new global.Function('c,s,r,d,h,g,f,v', - 'var N,n,x=0,k=-1,e;main:while((e=c[++k])){' + source + '}return r;'); - } else { - // for match method - return new global.Function('e,s,r,d,h,g,f,v', - 'var N,n,x=0,k=e;' + source + 'return false;'); - } - }, - - // allows to cache already visited nodes - FILTER = - 'var z=v[@]||(v[@]=[]),l=z.length-1;' + - 'while(l>=0&&z[l]!==e)--l;' + - 'if(l!==-1){break;}' + - 'z[z.length]=e;', - - // compile a CSS3 string selector into ad-hoc javascript matching function - // @return string (to be compiled) - compileSelector = - function(selector, source, mode) { - - var a, b, n, k = 0, expr, match, result, status, test, type; - - while (selector) { - - k++; - - // *** Universal selector - // * match all (empty block, do not remove) - if ((match = selector.match(Patterns.universal))) { - // do nothing, handled in the compiler where - // BUGGY_GEBTN return comment nodes (ex: IE) - expr = ''; - } - - // *** ID selector - // #Foo Id case sensitive - else if ((match = selector.match(Patterns.id))) { - // document can contain conflicting elements (id/name) - // prototype selector unit need this method to recover bad HTML forms - source = 'if(' + (XML_DOCUMENT ? - 's.getAttribute(e,"id")' : - '(e.submit?s.getAttribute(e,"id"):e.id)') + - '=="' + match[1] + '"' + - '){' + source + '}'; - } - - // *** Type selector - // Foo Tag (case insensitive) - else if ((match = selector.match(Patterns.tagName))) { - // both tagName and nodeName properties may be upper/lower case - // depending on their creation NAMESPACE in createElementNS() - source = 'if(e.nodeName' + (XML_DOCUMENT ? - '=="' + match[1] + '"' : '.toUpperCase()' + - '=="' + match[1].toUpperCase() + '"') + - '){' + source + '}'; - } - - // *** Class selector - // .Foo Class (case sensitive) - else if ((match = selector.match(Patterns.className))) { - // W3C CSS3 specs: element whose "class" attribute has been assigned a - // list of whitespace-separated values, see section 6.4 Class selectors - // and notes at the bottom; explicitly non-normative in this specification. - source = 'if((n=' + (XML_DOCUMENT ? - 's.getAttribute(e,"class")' : 'e.className') + - ')&&n.length&&(" "+' + (QUIRKS_MODE ? 'n.toLowerCase()' : 'n') + - '.replace(' + reWhiteSpace + '," ")+" ").indexOf(" ' + - (QUIRKS_MODE ? match[1].toLowerCase() : match[1]) + ' ")>-1' + - '){' + source + '}'; - } - - // *** Attribute selector - // [attr] [attr=value] [attr="value"] [attr='value'] and !=, *=, ~=, |=, ^=, $= - // case sensitivity is treated differently depending on the document type (see map) - else if ((match = selector.match(Patterns.attribute))) { - - // xml namespaced attribute ? - expr = match[1].split(':'); - expr = expr.length == 2 ? expr[1] : expr[0] + ''; - - if (match[2] && !Operators[match[2]]) { - emit('Unsupported operator in attribute selectors "' + selector + '"'); - return ''; - } - - test = 'false'; - - // replace Operators parameter if needed - if (match[2] && match[4] && (test = Operators[match[2]])) { - match[4] = convertEscapes(match[4]); - // case treatment depends on document - HTML_TABLE['class'] = QUIRKS_MODE ? 1 : 0; - type = (XML_DOCUMENT ? XHTML_TABLE : HTML_TABLE)[expr.toLowerCase()]; - test = test.replace(/\%m/g, type ? match[4].toLowerCase() : match[4]); - } else if (match[2] == '!=' || match[2] == '=') { - test = 'n' + match[2] + '=""'; - } - - source = 'if(n=s.hasAttribute(e,"' + match[1] + '")){' + - (match[2] ? 'n=s.getAttribute(e,"' + match[1] + '")' : '') + - (type && match[2] ? '.toLowerCase();' : ';') + - 'if(' + (match[2] ? test : 'n') + '){' + source + '}}'; - - } - - // *** Adjacent sibling combinator - // E + F (F adiacent sibling of E) - else if ((match = selector.match(Patterns.adjacent))) { - source = (mode ? '' : FILTER.replace(/@/g, k)) + source; - source = NATIVE_TRAVERSAL_API ? - 'var N' + k + '=e;while(e&&(e=e.previousElementSibling)){' + source + 'break;}e=N' + k + ';' : - 'var N' + k + '=e;while(e&&(e=e.previousSibling)){if(e.nodeName>"@"){' + source + 'break;}}e=N' + k + ';'; - } - - // *** General sibling combinator - // E ~ F (F relative sibling of E) - else if ((match = selector.match(Patterns.relative))) { - source = (mode ? '' : FILTER.replace(/@/g, k)) + source; - source = NATIVE_TRAVERSAL_API ? - ('var N' + k + '=e;e=e.parentNode.firstElementChild;' + - 'while(e&&e!==N' + k + '){' + source + 'e=e.nextElementSibling;}e=N' + k + ';') : - ('var N' + k + '=e;e=e.parentNode.firstChild;' + - 'while(e&&e!==N' + k + '){if(e.nodeName>"@"){' + source + '}e=e.nextSibling;}e=N' + k + ';'); - } - - // *** Child combinator - // E > F (F children of E) - else if ((match = selector.match(Patterns.children))) { - source = (mode ? '' : FILTER.replace(/@/g, k)) + source; - source = 'var N' + k + '=e;while(e&&e!==h&&e!==g&&(e=e.parentNode)){' + source + 'break;}e=N' + k + ';'; - } - - // *** Descendant combinator - // E F (E ancestor of F) - else if ((match = selector.match(Patterns.ancestor))) { - source = (mode ? '' : FILTER.replace(/@/g, k)) + source; - source = 'var N' + k + '=e;while(e&&e!==h&&e!==g&&(e=e.parentNode)){' + source + '}e=N' + k + ';'; - } - - // *** Structural pseudo-classes - // :root, :empty, - // :first-child, :last-child, :only-child, - // :first-of-type, :last-of-type, :only-of-type, - // :nth-child(), :nth-last-child(), :nth-of-type(), :nth-last-of-type() - else if ((match = selector.match(Patterns.spseudos)) && match[1]) { - - switch (match[1]) { - case 'root': - // element root of the document - if (match[3]) { - source = 'if(e===h||s.contains(h,e)){' + source + '}'; - } else { - source = 'if(e===h){' + source + '}'; - } - break; - - case 'empty': - // element that has no children - source = 'if(s.isEmpty(e)){' + source + '}'; - break; - - default: - if (match[1] && match[2]) { - if (match[2] == 'n') { - source = 'if(e!==h){' + source + '}'; - break; - } else if (match[2] == 'even') { - a = 2; - b = 0; - } else if (match[2] == 'odd') { - a = 2; - b = 1; - } else { - // assumes correct "an+b" format, "b" before "a" to keep "n" values - b = ((n = match[2].match(/(-?\d+)$/)) ? global.parseInt(n[1], 10) : 0); - a = ((n = match[2].match(/(-?\d*)n/i)) ? global.parseInt(n[1], 10) : 0); - if (n && n[1] == '-') a = -1; - } - - // build test expression out of structural pseudo (an+b) parameters - // see here: http://www.w3.org/TR/css3-selectors/#nth-child-pseudo - test = a > 1 ? - (/last/i.test(match[1])) ? '(n-(' + b + '))%' + a + '==0' : - 'n>=' + b + '&&(n-(' + b + '))%' + a + '==0' : a < -1 ? - (/last/i.test(match[1])) ? '(n-(' + b + '))%' + a + '==0' : - 'n<=' + b + '&&(n-(' + b + '))%' + a + '==0' : a === 0 ? - 'n==' + b : a == -1 ? 'n<=' + b : 'n>=' + b; - - // 4 cases: 1 (nth) x 4 (child, of-type, last-child, last-of-type) - source = - 'if(e!==h){' + - 'n=s[' + (/-of-type/i.test(match[1]) ? '"nthOfType"' : '"nthElement"') + ']' + - '(e,' + (/last/i.test(match[1]) ? 'true' : 'false') + ');' + - 'if(' + test + '){' + source + '}' + - '}'; - - } else { - // 6 cases: 3 (first, last, only) x 1 (child) x 2 (-of-type) - a = /first/i.test(match[1]) ? 'previous' : 'next'; - n = /only/i.test(match[1]) ? 'previous' : 'next'; - b = /first|last/i.test(match[1]); - - type = /-of-type/i.test(match[1]) ? '&&n.nodeName!=e.nodeName' : '&&n.nodeName<"@"'; - - source = 'if(e!==h){' + - ( 'n=e;while((n=n.' + a + 'Sibling)' + type + ');if(!n){' + (b ? source : - 'n=e;while((n=n.' + n + 'Sibling)' + type + ');if(!n){' + source + '}') + '}' ) + '}'; - } - break; - } - - } - - // *** negation, user action and target pseudo-classes - // *** UI element states and dynamic pseudo-classes - // CSS3 :not, :checked, :enabled, :disabled, :target - // CSS3 :active, :hover, :focus - // CSS3 :link, :visited - else if ((match = selector.match(Patterns.dpseudos)) && match[1]) { - - switch (match[1].match(/^\w+/)[0]) { - // CSS3 negation pseudo-class - case 'not': - // compile nested selectors, DO NOT pass the callback parameter - // SIMPLENOT allow disabling complex selectors nested - // in ':not()' pseudo-classes, breaks some test units - expr = match[3].replace(reTrimSpaces, ''); - - if (Config.SIMPLENOT && !reSimpleNot.test(expr)) { - // see above, log error but continue execution - emit('Negation pseudo-class only accepts simple selectors "' + selector + '"'); - return ''; - } else { - if ('compatMode' in doc) { - source = 'if(!' + compile(expr, '', false) + '(e,s,r,d,h,g)){' + source + '}'; - } else { - source = 'if(!s.match(e, "' + expr.replace(/\x22/g, '\\"') + '",g)){' + source +'}'; - } - } - break; - - // CSS3 UI element states - case 'checked': - // for radio buttons checkboxes (HTML4) and options (HTML5) - source = 'if((typeof e.form!=="undefined"&&(/^(?:radio|checkbox)$/i).test(e.type)&&e.checked)' + - (Config.USE_HTML5 ? '||(/^option$/i.test(e.nodeName)&&(e.selected||e.checked))' : '') + - '){' + source + '}'; - break; - case 'disabled': - // does not consider hidden input fields - source = 'if(((typeof e.form!=="undefined"' + - (Config.USE_HTML5 ? '' : '&&!(/^hidden$/i).test(e.type)') + - ')||s.isLink(e))&&e.disabled===true){' + source + '}'; - break; - case 'enabled': - // does not consider hidden input fields - source = 'if(((typeof e.form!=="undefined"' + - (Config.USE_HTML5 ? '' : '&&!(/^hidden$/i).test(e.type)') + - ')||s.isLink(e))&&e.disabled===false){' + source + '}'; - break; - - // CSS3 lang pseudo-class - case 'lang': - test = ''; - if (match[2]) test = match[2].substr(0, 2) + '-'; - source = 'do{(n=e.lang||"").toLowerCase();' + - 'if((n==""&&h.lang=="' + match[2].toLowerCase() + '")||' + - '(n&&(n=="' + match[2].toLowerCase() + - '"||n.substr(0,3)=="' + test.toLowerCase() + '")))' + - '{' + source + 'break;}}while((e=e.parentNode)&&e!==g);'; - break; - - // CSS3 target pseudo-class - case 'target': - source = 'if(e.id==d.location.hash.slice(1)){' + source + '}'; - break; - - // CSS3 dynamic pseudo-classes - case 'link': - source = 'if(s.isLink(e)&&!e.visited){' + source + '}'; - break; - case 'visited': - source = 'if(s.isLink(e)&&e.visited){' + source + '}'; - break; - - // CSS3 user action pseudo-classes IE & FF3 have native support - // these capabilities may be emulated by some event managers - case 'active': - if (XML_DOCUMENT) break; - source = 'if(e===d.activeElement){' + source + '}'; - break; - case 'hover': - if (XML_DOCUMENT) break; - source = 'if(e===d.hoverElement){' + source + '}'; - break; - case 'focus': - if (XML_DOCUMENT) break; - source = NATIVE_FOCUS ? - 'if(e===d.activeElement&&d.hasFocus()&&(e.type||e.href||typeof e.tabIndex=="number")){' + source + '}' : - 'if(e===d.activeElement&&(e.type||e.href)){' + source + '}'; - break; - - // CSS2 selected pseudo-classes, not part of current CSS3 drafts - // the 'selected' property is only available for option elements - case 'selected': - // fix Safari selectedIndex property bug - expr = BUGGY_SELECTED ? '||(n=e.parentNode)&&n.options[n.selectedIndex]===e' : ''; - source = 'if(/^option$/i.test(e.nodeName)&&(e.selected||e.checked' + expr + ')){' + source + '}'; - break; - - default: - break; - } - - } - - else { - - // this is where external extensions are - // invoked if expressions match selectors - expr = false; - status = false; - for (expr in Selectors) { - if ((match = selector.match(Selectors[expr].Expression)) && match[1]) { - result = Selectors[expr].Callback(match, source); - source = result.source; - status = result.status; - if (status) { break; } - } - } - - // if an extension fails to parse the selector - // it must return a false boolean in "status" - if (!status) { - // log error but continue execution, don't throw real exceptions - // because blocking following processes maybe is not a good idea - emit('Unknown pseudo-class selector "' + selector + '"'); - return ''; - } - - if (!expr) { - // see above, log error but continue execution - emit('Unknown token in selector "' + selector + '"'); - return ''; - } - - } - - // error if no matches found by the pattern scan - if (!match) { - emit('Invalid syntax in selector "' + selector + '"'); - return ''; - } - - // ensure "match" is not null or empty since - // we do not throw real DOMExceptions above - selector = match && match[match.length - 1]; - } - - return source; - }, - - /*----------------------------- QUERY METHODS ------------------------------*/ - - // match element with selector - // @return boolean - match = - function(element, selector, from, callback) { - - var parts; - - if (!(element && element.nodeType == 1)) { - emit('Invalid element argument'); - return false; - } else if (typeof selector != 'string') { - emit('Invalid selector argument'); - return false; - } else if (from && from.nodeType == 1 && !contains(from, element)) { - return false; - } else if (lastContext !== from) { - // reset context data when it changes - // and ensure context is set to a default - switchContext(from || (from = element.ownerDocument)); - } - - selector = selector.replace(reTrimSpaces, ''); - - Config.SHORTCUTS && (selector = Dom.shortcuts(selector, element, from)); - - if (lastMatcher != selector) { - // process valid selector strings - if ((parts = selector.match(reValidator)) && parts[0] == selector) { - isSingleMatch = (parts = selector.match(reSplitGroup)).length < 2; - // save passed selector - lastMatcher = selector; - lastPartsMatch = parts; - } else { - emit('The string "' + selector + '", is not a valid CSS selector'); - return false; - } - } else parts = lastPartsMatch; - - // compile matcher resolvers if necessary - if (!matchResolvers[selector] || matchContexts[selector] !== from) { - matchResolvers[selector] = compile(isSingleMatch ? [selector] : parts, '', false); - matchContexts[selector] = from; - } - - return matchResolvers[selector](element, Snapshot, [ ], doc, root, from, callback, new global.Object()); - }, - - // select only the first element - // matching selector (document ordered) - first = - function(selector, from) { - return select(selector, from, function() { return false; })[0] || null; - }, - - // select elements matching selector - // using new Query Selector API - // or cross-browser client API - // @return array - select = - function(selector, from, callback) { - - var i, changed, element, elements, parts, token, original = selector; - - if (arguments.length === 0) { - emit('Not enough arguments'); - return [ ]; - } else if (typeof selector != 'string') { - return [ ]; - } else if (from && !(/1|9|11/).test(from.nodeType)) { - emit('Invalid or illegal context element'); - return [ ]; - } else if (lastContext !== from) { - // reset context data when it changes - // and ensure context is set to a default - switchContext(from || (from = doc)); - } - - if (Config.CACHING && (elements = Dom.loadResults(original, from, doc, root))) { - return callback ? concatCall([ ], elements, callback) : elements; - } - - if (!OPERA_QSAPI && RE_SIMPLE_SELECTOR.test(selector)) { - switch (selector.charAt(0)) { - case '#': - if (Config.UNIQUE_ID) { - elements = (element = _byId(selector.slice(1), from)) ? [ element ] : [ ]; - } - break; - case '.': - elements = _byClass(selector.slice(1), from); - break; - default: - elements = _byTag(selector, from); - break; - } - } - - else if (!XML_DOCUMENT && Config.USE_QSAPI && - !(BUGGY_QUIRKS_QSAPI && RE_CLASS.test(selector)) && - !RE_BUGGY_QSAPI.test(selector)) { - try { - elements = from.querySelectorAll(selector); - } catch(e) { } - } - - if (elements) { - elements = callback ? concatCall([ ], elements, callback) : - NATIVE_SLICE_PROTO ? slice.call(elements) : concatList([ ], elements); - Config.CACHING && Dom.saveResults(original, from, doc, elements); - return elements; - } - - selector = selector.replace(reTrimSpaces, ''); - - Config.SHORTCUTS && (selector = Dom.shortcuts(selector, from)); - - if ((changed = lastSelector != selector)) { - // process valid selector strings - if ((parts = selector.match(reValidator)) && parts[0] == selector) { - isSingleSelect = (parts = selector.match(reSplitGroup)).length < 2; - // save passed selector - lastSelector = selector; - lastPartsSelect = parts; - } else { - emit('The string "' + selector + '", is not a valid CSS selector'); - return [ ]; - } - } else parts = lastPartsSelect; - - // commas separators are treated sequentially to maintain order - if (from.nodeType == 11) { - - elements = byTagRaw('*', from); - - } else if (!XML_DOCUMENT && isSingleSelect) { - - if (changed) { - // get right most selector token - parts = selector.match(reSplitToken); - token = parts[parts.length - 1]; - - // only last slice before :not rules - lastSlice = token.split(':not')[0]; - - // position where token was found - lastPosition = selector.length - token.length; - } - - // ID optimization RTL, to reduce number of elements to visit - if (Config.UNIQUE_ID && (parts = lastSlice.match(Optimize.ID)) && (token = parts[1])) { - if ((element = _byId(token, from))) { - if (match(element, selector)) { - callback && callback(element); - elements = new global.Array(element); - } else elements = new global.Array(); - } - } - - // ID optimization LTR, to reduce selection context searches - else if (Config.UNIQUE_ID && (parts = selector.match(Optimize.ID)) && (token = parts[1])) { - if ((element = _byId(token, doc))) { - if ('#' + token == selector) { - callback && callback(element); - elements = new global.Array(element); - } else if (/[>+~]/.test(selector)) { - from = element.parentNode; - } else { - from = element; - } - } else elements = new global.Array(); - } - - if (elements) { - Config.CACHING && Dom.saveResults(original, from, doc, elements); - return elements; - } - - if (!NATIVE_GEBCN && (parts = lastSlice.match(Optimize.TAG)) && (token = parts[1])) { - if ((elements = _byTag(token, from)).length === 0) { return [ ]; } - selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace(token, '*'); - } - - else if ((parts = lastSlice.match(Optimize.CLASS)) && (token = parts[1])) { - if ((elements = _byClass(token, from)).length === 0) { return [ ]; } - if (reOptimizeSelector.test(selector.charAt(selector.indexOf(token) - 1))) { - selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, ''); - } else { - selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, '*'); - } - } - - else if ((parts = selector.match(Optimize.CLASS)) && (token = parts[1])) { - if ((elements = _byClass(token, from)).length === 0) { return [ ]; } - for (i = 0, els = new global.Array(); elements.length > i; ++i) { - els = concatList(els, elements[i].getElementsByTagName('*')); - } - elements = els; - if (reOptimizeSelector.test(selector.charAt(selector.indexOf(token) - 1))) { - selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, ''); - } else { - selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, '*'); - } - } - - else if (NATIVE_GEBCN && (parts = lastSlice.match(Optimize.TAG)) && (token = parts[1])) { - if ((elements = _byTag(token, from)).length === 0) { return [ ]; } - selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace(token, '*'); - } - - } - - if (!elements) { - elements = /^(?:applet|object)$/i.test(from.nodeName) ? from.childNodes : _byTag('*', from); - } - // end of prefiltering pass - - // compile selector resolver if necessary - if (!selectResolvers[selector] || selectContexts[selector] !== from) { - selectResolvers[selector] = compile(isSingleSelect ? [selector] : parts, '', true); - selectContexts[selector] = from; - } - - elements = selectResolvers[selector](elements, Snapshot, [ ], doc, root, from, callback, new global.Object()); - - Config.CACHING && Dom.saveResults(original, from, doc, elements); - - return elements; - }, - - /*-------------------------------- STORAGE ---------------------------------*/ - - // empty function handler - FN = function(x) { return x; }, - - // compiled match functions returning booleans - matchContexts = new global.Object(), - matchResolvers = new global.Object(), - - // compiled select functions returning collections - selectContexts = new global.Object(), - selectResolvers = new global.Object(), - - // used to pass methods to compiled functions - Snapshot = new global.Object({ - - // element indexing methods - nthElement: nthElement, - nthOfType: nthOfType, - - // element inspection methods - getAttribute: getAttribute, - hasAttribute: hasAttribute, - - // element selection methods - byClass: _byClass, - byName: byName, - byTag: _byTag, - byId: _byId, - - // helper/check methods - contains: contains, - isEmpty: isEmpty, - isLink: isLink, - - // selection/matching - select: select, - match: match - }), - - Tokens = new global.Object({ - prefixes: prefixes, - encoding: encoding, - operators: operators, - whitespace: whitespace, - identifier: identifier, - attributes: attributes, - combinators: combinators, - pseudoclass: pseudoclass, - pseudoparms: pseudoparms, - quotedvalue: quotedvalue - }); - - /*------------------------------- PUBLIC API -------------------------------*/ - - // code referenced by extensions - Dom.ACCEPT_NODE = ACCEPT_NODE; - - // retrieve element by id attr - Dom.byId = byId; - - // retrieve elements by tag name - Dom.byTag = byTag; - - // retrieve elements by name attr - Dom.byName = byName; - - // retrieve elements by class name - Dom.byClass = byClass; - - // read the value of the attribute - // as was in the original HTML code - Dom.getAttribute = getAttribute; - - // check for the attribute presence - // as was in the original HTML code - Dom.hasAttribute = hasAttribute; - - // element match selector, return boolean true/false - Dom.match = match; - - // first element match only, return element or null - Dom.first = first; - - // elements matching selector, starting from element - Dom.select = select; - - // compile selector into ad-hoc javascript resolver - Dom.compile = compile; - - // check that two elements are ancestor/descendant - Dom.contains = contains; - - // handle selector engine configuration settings - Dom.configure = configure; - - // initialize caching for each document - Dom.setCache = FN; - - // load previously collected result set - Dom.loadResults = FN; - - // save previously collected result set - Dom.saveResults = FN; - - // handle missing context in selector strings - Dom.shortcuts = FN; - - // log resolvers errors/warnings - Dom.emit = emit; - - // options enabing specific engine functionality - Dom.Config = Config; - - // pass methods references to compiled resolvers - Dom.Snapshot = Snapshot; - - // operators descriptor - // for attribute operators extensions - Dom.Operators = Operators; - - // selectors descriptor - // for pseudo-class selectors extensions - Dom.Selectors = Selectors; - - // export string patterns - Dom.Tokens = Tokens; - - // export version string - Dom.Version = version; - - // add or overwrite user defined operators - Dom.registerOperator = - function(symbol, resolver) { - Operators[symbol] || (Operators[symbol] = resolver); - }; - - // add selector patterns for user defined callbacks - Dom.registerSelector = - function(name, rexp, func) { - Selectors[name] || (Selectors[name] = new global.Object({ - Expression: rexp, - Callback: func - })); - }; - - /*---------------------------------- INIT ----------------------------------*/ - - // init context specific variables - switchContext(doc, true); - -}); - -/* - selectivizr.com - - Notes about this source - ----------------------- - * The #DEBUG_START and #DEBUG_END comments are used to mark blocks of code - that will be removed prior to building a final release version (using a - pre-compression script) - - References: - ----------- - * CSS Syntax : https://www.w3.org/TR/2003/WD-css3-syntax-20030813/#style - * Selectors : https://www.w3.org/TR/css3-selectors/#selectors - * IE Compatability : https://msdn.microsoft.com/en-us/library/cc351024%28VS.85%29.aspx - * W3C Selector Tests : https://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/ -*/ - -(function(win) { - - // Determine IE version and stop execution if browser isn't IE. This - // handles the script being loaded by non IE browsers because the - // developer didn't use conditional comments. - var ieUserAgent = navigator.userAgent.match(/MSIE (\d+)/); - if (!ieUserAgent) { - return false; - } - - // =========================== Init Objects ============================ - - var doc = document; - var root = doc.documentElement; - var xhr = getXHRObject(); - var ieVersion = ieUserAgent[1]; - - // If were not in standards mode, IE is too old / new or we can't create - // an XMLHttpRequest object then we should get out now. - if (doc.compatMode != 'CSS1Compat' || ieVersion<6 || ieVersion>8 || !xhr) { - return; - } - - // ========================= Common Objects ============================ - - // Compatible selector engines in order of CSS3 support. Note: '*' is - // a placeholder for the object key name. (basically, crude compression) - var selectorEngines = { - "NW" : "*.Dom.select", - "MooTools" : "$$", - "DOMAssistant" : "*.$", - "Prototype" : "$$", - "YAHOO" : "*.util.Selector.query", - "Sizzle" : "*", - "jQuery" : "*", - "dojo" : "*.query" - }; - - var selectorMethod; - var enabledWatchers = []; // array of :enabled/:disabled elements to poll - var domPatches = []; - var ie6PatchID = 0; // used to solve ie6's multiple class bug - var patchIE6MultipleClasses = true; // if true adds class bloat to ie6 - var namespace = "slvzr"; - - // Stylesheet parsing regexp's - var RE_COMMENT = /(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)\s*?/g; - var RE_IMPORT = /@import\s*(?:(?:(?:url\(\s*(['"]?)([^;]*)\1)\s*\))|(?:(['"])([^;]*)\3))\s*([^;]*);/g; - var RE_ASSET_URL = /(behavior\s*?:\s*)?\burl\(\s*(["']?)(?!data:)([^"')]+)\2\s*\)/g; - var RE_PSEUDO_STRUCTURAL = /^:(empty|(first|last|only|nth(-last)?)-(child|of-type))$/; - var RE_PSEUDO_ELEMENTS = /:(:first-(?:line|letter))/g; - var RE_SELECTOR_GROUP = /((?:^|(?:\s*})+)(?:\s*@media[^{]+{)?)\s*([^\{]*?[\[:][^{]+)/g; - var RE_SELECTOR_PARSE = /([ +~>])|(:[a-z-]+(?:\(.*?\)+)?)|(\[.*?\])/g; - var RE_LIBRARY_INCOMPATIBLE_PSEUDOS = /(:not\()?:(hover|enabled|disabled|focus|checked|target|active|visited|first-line|first-letter)\)?/g; - var RE_PATCH_CLASS_NAME_REPLACE = /[^\w-]/g; - - // HTML UI element regexp's - var RE_INPUT_ELEMENTS = /^(INPUT|SELECT|TEXTAREA|BUTTON)$/; - var RE_INPUT_CHECKABLE_TYPES = /^(checkbox|radio)$/; - - // Broken attribute selector implementations (IE7/8 native [^=""], [$=""] and [*=""]) - var BROKEN_ATTR_IMPLEMENTATIONS = ieVersion>6 ? /[\$\^*]=(['"])\1/ : null; - - // Whitespace normalization regexp's - var RE_TIDY_TRAILING_WHITESPACE = /([(\[+~])\s+/g; - var RE_TIDY_LEADING_WHITESPACE = /\s+([)\]+~])/g; - var RE_TIDY_CONSECUTIVE_WHITESPACE = /\s+/g; - var RE_TIDY_TRIM_WHITESPACE = /^\s*((?:[\S\s]*\S)?)\s*$/; - - // String constants - var EMPTY_STRING = ""; - var SPACE_STRING = " "; - var PLACEHOLDER_STRING = "$1"; - - // =========================== Patching ================================ - - // --[ patchStyleSheet() ]---------------------------------------------- - // Scans the passed cssText for selectors that require emulation and - // creates one or more patches for each matched selector. - function patchStyleSheet( cssText ) { - return cssText.replace(RE_PSEUDO_ELEMENTS, PLACEHOLDER_STRING). - replace(RE_SELECTOR_GROUP, function(m, prefix, selectorText) { - var selectorGroups = selectorText.split(","); - function comboBreaker (match, combinator, pseudo, attribute, index) { - if (combinator) { - if (patches.length>0) { - domPatches.push( { selector: selector.substring(0, index), patches: patches } ); - patches = []; - } - return combinator; - } - else { - var patch = (pseudo) ? patchPseudoClass( pseudo ) : patchAttribute( attribute ); - if (patch) { - patches.push(patch); - return "." + patch.className; - } - return match; - } - } - for (var c = 0, cs = selectorGroups.length; c < cs; c++) { - var selector = normalizeSelectorWhitespace(selectorGroups[c]) + SPACE_STRING; - var patches = []; - selectorGroups[c] = selector.replace(RE_SELECTOR_PARSE, comboBreaker); - } - return prefix + selectorGroups.join(","); - }); - } - - // --[ patchAttribute() ]----------------------------------------------- - // returns a patch for an attribute selector. - function patchAttribute( attr ) { - return (!BROKEN_ATTR_IMPLEMENTATIONS || BROKEN_ATTR_IMPLEMENTATIONS.test(attr)) ? - { className: createClassName(attr), applyClass: true } : null; - } - - // --[ patchPseudoClass() ]--------------------------------------------- - // returns a patch for a pseudo-class - function patchPseudoClass( pseudo ) { - - var applyClass = true; - var className = createClassName(pseudo.slice(1)); - var isNegated = pseudo.substring(0, 5) == ":not("; - var activateEventName; - var deactivateEventName; - - // if negated, remove :not() - if (isNegated) { - pseudo = pseudo.slice(5, -1); - } - - // bracket contents are irrelevant - remove them - var bracketIndex = pseudo.indexOf("("); - if (bracketIndex > -1) { - pseudo = pseudo.substring(0, bracketIndex); - } - - // check we're still dealing with a pseudo-class - if (pseudo.charAt(0) == ":") { - switch (pseudo.slice(1)) { - - case "root": - applyClass = function(e) { - return isNegated ? e != root : e == root; - }; - break; - - case "target": - // :target is only supported in IE8 - if (ieVersion == 8) { - applyClass = function(e) { - var handler = function() { - var hash = location.hash; - var hashID = hash.slice(1); - return isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID); - }; - addEvent( win, "hashchange", function() { - toggleElementClass(e, className, handler()); - }); - return handler(); - }; - break; - } - return false; - - case "checked": - applyClass = function(e) { - if (RE_INPUT_CHECKABLE_TYPES.test(e.type)) { - addEvent( e, "propertychange", function() { - if (event.propertyName == "checked") { - toggleElementClass( e, className, e.checked !== isNegated ); - } - }); - } - return e.checked !== isNegated; - }; - break; - - case "disabled": - isNegated = !isNegated; - break; - - case "enabled": - applyClass = function(e) { - if (RE_INPUT_ELEMENTS.test(e.tagName)) { - addEvent( e, "propertychange", function() { - if (event.propertyName == "$disabled") { - toggleElementClass( e, className, e.$disabled === isNegated ); - } - }); - enabledWatchers.push(e); - e.$disabled = e.disabled; - return e.disabled === isNegated; - } - return pseudo == ":enabled" ? isNegated : !isNegated; - }; - break; - - case "focus": - activateEventName = "focus"; - deactivateEventName = "blur"; - break; - - case "hover": - if (!activateEventName) { - activateEventName = "mouseenter"; - deactivateEventName = "mouseleave"; - } - applyClass = function(e) { - addEvent( e, isNegated ? deactivateEventName : activateEventName, function() { - toggleElementClass( e, className, true ); - }); - addEvent( e, isNegated ? activateEventName : deactivateEventName, function() { - toggleElementClass( e, className, false ); - }); - return isNegated; - }; - break; - - // everything else - default: - // If we don't support this pseudo-class don't create - // a patch for it - if (!RE_PSEUDO_STRUCTURAL.test(pseudo)) { - return false; - } - break; - } - } - return { className: className, applyClass: applyClass }; - } - - // --[ applyPatches() ]------------------------------------------------- - function applyPatches() { - var elms, selectorText, patches, domSelectorText; - - for (var c=0; c 0) { - setInterval( function() { - for (var c = 0, cl = enabledWatchers.length; c < cl; c++) { - var e = enabledWatchers[c]; - if (e.disabled !== e.$disabled) { - if (e.disabled) { - e.disabled = false; - e.$disabled = true; - e.disabled = true; - } - else { - e.$disabled = e.disabled; - } - } - } - }, 250); - } - } - - // Determine the baseUrl and download the stylesheets - var baseTags = doc.getElementsByTagName("BASE"); - var baseUrl = (baseTags.length > 0) ? baseTags[0].href : doc.location.href; - getStyleSheets(); - - // Bind selectivizr to the ContentLoaded event. - ContentLoaded(win, function() { - // Determine the "best fit" selector engine - for (var engine in selectorEngines) { - var members, member, context = win; - if (win[engine]) { - members = selectorEngines[engine].replace("*", engine).split("."); - while ((member = members.shift()) && (context = context[member])) {} - if (typeof context == "function") { - selectorMethod = context; - init(); - return; - } - } - } - }); - - /*! - * ContentLoaded.js by Diego Perini, modified for IE<9 only (to save space) - * - * Author: Diego Perini (diego.perini at gmail.com) - * Summary: cross-browser wrapper for DOMContentLoaded - * Updated: 20101020 - * License: MIT - * Version: 1.2 - * - * URL: - * http://javascript.nwbox.com/ContentLoaded/ - * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE - * - */ - - // @w window reference - // @f function reference - function ContentLoaded(win, fn) { - - var done = false, top = true, - init = function(e) { - if (e.type == "readystatechange" && doc.readyState != "complete") return; - (e.type == "load" ? win : doc).detachEvent("on" + e.type, init, false); - if (!done && (done = true)) fn.call(win, e.type || e); - }, - poll = function() { - try { root.doScroll("left"); } catch(e) { setTimeout(poll, 50); return; } - init('poll'); - }; - - if (doc.readyState == "complete") fn.call(win, EMPTY_STRING); - else { - if (doc.createEventObject && root.doScroll) { - try { top = !win.frameElement; } catch(e) { } - if (top) poll(); - } - addEvent(doc,"readystatechange", init); - addEvent(win,"load", init); - } - } -})(this); - -/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ -/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ -(function(w) { - "use strict"; - w.matchMedia = w.matchMedia || function(doc, undefined) { - var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement("body"), div = doc.createElement("div"); - div.id = "mq-test-1"; - div.style.cssText = "position:absolute;top:-100em"; - fakeBody.style.background = "none"; - fakeBody.appendChild(div); - return function(q) { - div.innerHTML = '­'; - docElem.insertBefore(fakeBody, refNode); - bool = div.offsetWidth === 42; - docElem.removeChild(fakeBody); - return { - matches: bool, - media: q - }; - }; - }(w.document); -})(this); - -/*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ -(function(w) { - "use strict"; - var respond = {}; - w.respond = respond; - respond.update = function() {}; - var requestQueue = [], xmlHttp = function() { - var xmlhttpmethod = false; - try { - xmlhttpmethod = new w.XMLHttpRequest(); - } catch (e) { - xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP"); - } - return function() { - return xmlhttpmethod; - }; - }(), ajax = function(url, callback) { - var req = xmlHttp(); - if (!req) { - return; - } - req.open("GET", url, true); - req.onreadystatechange = function() { - if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) { - return; - } - callback(req.responseText); - }; - if (req.readyState === 4) { - return; - } - req.send(null); - }; - respond.ajax = ajax; - respond.queue = requestQueue; - respond.regex = { - media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, - keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, - urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, - findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, - only: /(only\s+)?([a-zA-Z]+)\s?/, - minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/, - maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ - }; - respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches; - if (respond.mediaQueriesSupported) { - return; - } - var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName("head")[0] || docElem, base = doc.getElementsByTagName("base")[0], links = head.getElementsByTagName("link"), lastCall, resizeDefer, eminpx, getEmValue = function() { - var ret, div = doc.createElement("div"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false; - div.style.cssText = "position:absolute;font-size:1em;width:1em"; - if (!body) { - body = fakeUsed = doc.createElement("body"); - body.style.background = "none"; - } - docElem.style.fontSize = "100%"; - body.style.fontSize = "100%"; - body.appendChild(div); - if (fakeUsed) { - docElem.insertBefore(body, docElem.firstChild); - } - ret = div.offsetWidth; - if (fakeUsed) { - docElem.removeChild(body); - } else { - body.removeChild(div); - } - docElem.style.fontSize = originalHTMLFontSize; - if (originalBodyFontSize) { - body.style.fontSize = originalBodyFontSize; - } - ret = eminpx = parseFloat(ret); - return ret; - }, applyMedia = function(fromResize) { - var name = "clientWidth", docElemProp = docElem[name], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime(); - if (fromResize && lastCall && now - lastCall < resizeThrottle) { - w.clearTimeout(resizeDefer); - resizeDefer = w.setTimeout(applyMedia, resizeThrottle); - return; - } else { - lastCall = now; - } - for (var i in mediastyles) { - if (mediastyles.hasOwnProperty(i)) { - var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; - if (!!min) { - min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1); - } - if (!!max) { - max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1); - } - if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) { - if (!styleBlocks[thisstyle.media]) { - styleBlocks[thisstyle.media] = []; - } - styleBlocks[thisstyle.media].push(rules[thisstyle.rules]); - } - } - } - for (var j in appendedEls) { - if (appendedEls.hasOwnProperty(j)) { - if (appendedEls[j] && appendedEls[j].parentNode === head) { - head.removeChild(appendedEls[j]); - } - } - } - appendedEls.length = 0; - for (var k in styleBlocks) { - if (styleBlocks.hasOwnProperty(k)) { - var ss = doc.createElement("style"), css = styleBlocks[k].join("\n"); - ss.type = "text/css"; - ss.media = k; - head.insertBefore(ss, lastLink.nextSibling); - if (ss.styleSheet) { - ss.styleSheet.cssText = css; - } else { - ss.appendChild(doc.createTextNode(css)); - } - appendedEls.push(ss); - } - } - }, translate = function(styles, href, media) { - var qs = styles.replace(respond.regex.keyframes, "").match(respond.regex.media), ql = qs && qs.length || 0; - href = href.substring(0, href.lastIndexOf("/")); - var repUrls = function(css) { - return css.replace(respond.regex.urls, "$1" + href + "$2$3"); - }, useMedia = !ql && media; - if (href.length) { - href += "/"; - } - if (useMedia) { - ql = 1; - } - for (var i = 0; i < ql; i++) { - var fullq, thisq, eachq, eql; - if (useMedia) { - fullq = media; - rules.push(repUrls(styles)); - } else { - fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1; - rules.push(RegExp.$2 && repUrls(RegExp.$2)); - } - eachq = fullq.split(","); - eql = eachq.length; - for (var j = 0; j < eql; j++) { - thisq = eachq[j]; - mediastyles.push({ - media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all", - rules: rules.length - 1, - hasquery: thisq.indexOf("(") > -1, - minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), - maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "") - }); - } - } - applyMedia(); - }, makeRequests = function() { - if (requestQueue.length) { - var thisRequest = requestQueue.shift(); - ajax(thisRequest.href, function(styles) { - translate(styles, thisRequest.href, thisRequest.media); - parsedSheets[thisRequest.href] = true; - w.setTimeout(function() { - makeRequests(); - }, 0); - }); - } - }, ripCSS = function() { - for (var i = 0; i < links.length; i++) { - var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; - if (!!href && isCSS && !parsedSheets[href]) { - if (sheet.styleSheet && sheet.styleSheet.rawCssText) { - translate(sheet.styleSheet.rawCssText, href, media); - parsedSheets[href] = true; - } else { - if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || href.replace(RegExp.$1, "").split("/")[0] === w.location.host) { - if (href.substring(0, 2) === "//") { - href = w.location.protocol + href; - } - requestQueue.push({ - href: href, - media: media - }); - } - } - } - } - makeRequests(); - }; - ripCSS(); - respond.update = ripCSS; - respond.getEmValue = getEmValue; - function callMedia() { - applyMedia(true); - } - if (w.addEventListener) { - w.addEventListener("resize", callMedia, false); - } else if (w.attachEvent) { - w.attachEvent("onresize", callMedia); - } -})(this); -// addEventListener -// removeEventListener -// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility - -(function() { - if (!Element.prototype.addEventListener) { - var eventListeners=[]; - - var addEventListener=function(type,listener /*, useCapture (will be ignored) */) { - var self=this; - var wrapper=function(e) { - e.target=e.srcElement; - e.currentTarget=self; - if (typeof listener.handleEvent != 'undefined') { - listener.handleEvent(e); - } else { - listener.call(self,e); - } - }; - if (type=="DOMContentLoaded") { - var wrapper2=function(e) { - if (document.readyState=="complete") { - wrapper(e); - } - }; - document.attachEvent("onreadystatechange",wrapper2); - eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper2}); - - if (document.readyState=="complete") { - var e=new Event(); - e.srcElement=window; - wrapper2(e); - } - } else { - this.attachEvent("on"+type,wrapper); - eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper}); - } - }; - var removeEventListener=function(type,listener /*, useCapture (will be ignored) */) { - var counter=0; - while (counter= 0; --i) { - if(n = nodes[i], 1 === n.nodeType) { return n; } - } - return null; - } - }); - } -})(); -// Element.nextElementSibling - -(function () { - "use strict"; - - if (!("nextElementSibling" in document.documentElement)) { - Object.defineProperty(Element.prototype, "nextElementSibling", { - get: function(){ - var e = this.nextSibling; - while(e && 1 !== e.nodeType) { - e = e.nextSibling; - } - return e; - } - }); - } -})(); -// event.pageX / event.pageY - -(function () { - "use strict"; - - if(!window.MouseEvent && !("pageX" in Event.prototype)){ - Object.defineProperty(Event.prototype, "pageX", { - get: function(){ - return this.clientX + window.pageXOffset; - } - }); - Object.defineProperty(Event.prototype, "pageY", { - get: function(){ - return this.clientY + window.pageYOffset; - } - }); - } -})(); -// window.pageXOffset / window.pageYOffset / window.scrollX / window.scrollY - -(function () { - "use strict"; - - if(!("pageXOffset" in window)) { - var x = function(){ return (document.documentElement || document.body.parentNode || document.body).scrollLeft; }, - y = function(){ return (document.documentElement || document.body.parentNode || document.body).scrollTop; }; - - Object.defineProperty(window, "pageXOffset", {get: x}); - Object.defineProperty(window, "pageYOffset", {get: y}); - Object.defineProperty(window, "scrollX", {get: x}); - Object.defineProperty(window, "scrollY", {get: y}); - } -})(); - -// IE8 preventDefault -// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility - -(function() { - if (!Event.prototype.preventDefault) { - Event.prototype.preventDefault=function() { - this.returnValue=false; - }; - } -})(); -// Element.previousElementSibling - -(function () { - "use strict"; - - if (!("previousElementSibling" in document.documentElement)) { - Object.defineProperty(Element.prototype, "previousElementSibling", { - get: function(){ - var e = this.previousSibling; - while(e && 1 !== e.nodeType) { - e = e.previousSibling; - } - return e; - } - }); - } -})(); -// IE8 stopPropagation -// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility - -(function() { - if (!Event.prototype.stopPropagation) { - Event.prototype.stopPropagation=function() { - this.cancelBubble=true; - }; - } -})(); -// textContent - -(function(){ - "use strict"; - - if(!("textContent" in Element.prototype)){ - var interfaces = "Element Text HTMLDocument HTMLCommentElement".split(" "); - var haveText = {3:1, 8:1, 4:1, 7:1}; - var haveNull = {9:1, 10:1, 12:1}; - var srcTags = {SCRIPT:1, STYLE:1}; - for(var I, i = 0; i < 4; ++i){ - I = window[interfaces[i]]; - I && Object.defineProperty(I.prototype, "textContent", { - get: function(){ return getText(this); }, - set: function(input){ - var type = this.nodeType; - - /** Text nodes: set nodeValue */ - if(haveText[type]) { - this.nodeValue = input; - } else if(!haveNull[type]){ - /** For everything that isn't a document, DOCTYPE or notation */ - var name = this.nodeName; - - /** IE8 throws a runtime error trying to set the innerHTML of a ',docElem.insertBefore(fakeBody,refNode),bool=42===div.offsetWidth,docElem.removeChild(fakeBody),{"matches":bool,"media":q}}}(w.document)}(this),function(w){"use strict";function callMedia(){applyMedia(!0)}var respond={};w.respond=respond,respond.update=function(){};var requestQueue=[],xmlHttp=function(){var xmlhttpmethod=!1;try{xmlhttpmethod=new w.XMLHttpRequest}catch(e){xmlhttpmethod=new w.ActiveXObject("Microsoft.XMLHTTP")}return function(){return xmlhttpmethod}}(),ajax=function(url,callback){var req=xmlHttp();req&&(req.open("GET",url,!0),req.onreadystatechange=function(){4!==req.readyState||200!==req.status&&304!==req.status||callback(req.responseText)},4!==req.readyState&&req.send(null))};if(respond.ajax=ajax,respond.queue=requestQueue,respond.regex={"media":/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,"keyframes":/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,"urls":/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"findStyles":/@media *([^\{]+)\{([\S\s]+?)$/,"only":/(only\s+)?([a-zA-Z]+)\s?/,"minw":/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,"maxw":/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},respond.mediaQueriesSupported=w.matchMedia&&null!==w.matchMedia("only all")&&w.matchMedia("only all").matches,!respond.mediaQueriesSupported){var lastCall,resizeDefer,eminpx,doc=w.document,docElem=doc.documentElement,mediastyles=[],rules=[],appendedEls=[],parsedSheets={},resizeThrottle=30,head=doc.getElementsByTagName("head")[0]||docElem,base=doc.getElementsByTagName("base")[0],links=head.getElementsByTagName("link"),getEmValue=function(){var ret,div=doc.createElement("div"),body=doc.body,originalHTMLFontSize=docElem.style.fontSize,originalBodyFontSize=body&&body.style.fontSize,fakeUsed=!1;return div.style.cssText="position:absolute;font-size:1em;width:1em",body||(body=fakeUsed=doc.createElement("body"),body.style.background="none"),docElem.style.fontSize="100%",body.style.fontSize="100%",body.appendChild(div),fakeUsed&&docElem.insertBefore(body,docElem.firstChild),ret=div.offsetWidth,fakeUsed?docElem.removeChild(body):body.removeChild(div),docElem.style.fontSize=originalHTMLFontSize,originalBodyFontSize&&(body.style.fontSize=originalBodyFontSize),ret=eminpx=parseFloat(ret)},applyMedia=function(fromResize){var name="clientWidth",docElemProp=docElem[name],currWidth="CSS1Compat"===doc.compatMode&&docElemProp||doc.body[name]||docElemProp,styleBlocks={},lastLink=links[links.length-1],now=(new Date).getTime();if(fromResize&&lastCall&&now-lastCall-1?eminpx||getEmValue():1)),max&&(max=parseFloat(max)*(max.indexOf(em)>-1?eminpx||getEmValue():1)),thisstyle.hasquery&&(minnull&&maxnull||!(minnull||currWidth>=min)||!(maxnull||currWidth<=max))||(styleBlocks[thisstyle.media]||(styleBlocks[thisstyle.media]=[]),styleBlocks[thisstyle.media].push(rules[thisstyle.rules]))}for(var j in appendedEls)appendedEls.hasOwnProperty(j)&&appendedEls[j]&&appendedEls[j].parentNode===head&&head.removeChild(appendedEls[j]);appendedEls.length=0;for(var k in styleBlocks)if(styleBlocks.hasOwnProperty(k)){var ss=doc.createElement("style"),css=styleBlocks[k].join("\n");ss.type="text/css",ss.media=k,head.insertBefore(ss,lastLink.nextSibling),ss.styleSheet?ss.styleSheet.cssText=css:ss.appendChild(doc.createTextNode(css)),appendedEls.push(ss)}},translate=function(styles,href,media){var qs=styles.replace(respond.regex.keyframes,"").match(respond.regex.media),ql=qs&&qs.length||0;href=href.substring(0,href.lastIndexOf("/"));var repUrls=function(css){return css.replace(respond.regex.urls,"$1"+href+"$2$3")},useMedia=!ql&&media;href.length&&(href+="/"),useMedia&&(ql=1);for(var i=0;i-1,"minw":thisq.match(respond.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),"maxw":thisq.match(respond.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}applyMedia()},makeRequests=function(){if(requestQueue.length){var thisRequest=requestQueue.shift();ajax(thisRequest.href,function(styles){translate(styles,thisRequest.href,thisRequest.media),parsedSheets[thisRequest.href]=!0,w.setTimeout(function(){makeRequests()},0)})}},ripCSS=function(){for(var i=0;i=0;--i)if(n=nodes[i],1===n.nodeType)return n;return null}})}(),function(){"use strict";"nextElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"nextElementSibling",{"get":function(){for(var e=this.nextSibling;e&&1!==e.nodeType;)e=e.nextSibling;return e}})}(),function(){"use strict";window.MouseEvent||"pageX"in Event.prototype||(Object.defineProperty(Event.prototype,"pageX",{"get":function(){return this.clientX+window.pageXOffset}}),Object.defineProperty(Event.prototype,"pageY",{"get":function(){return this.clientY+window.pageYOffset}}))}(),function(){"use strict";if(!("pageXOffset"in window)){var x=function(){return(document.documentElement||document.body.parentNode||document.body).scrollLeft},y=function(){return(document.documentElement||document.body.parentNode||document.body).scrollTop};Object.defineProperty(window,"pageXOffset",{"get":x}),Object.defineProperty(window,"pageYOffset",{"get":y}),Object.defineProperty(window,"scrollX",{"get":x}),Object.defineProperty(window,"scrollY",{"get":y})}}(),function(){Event.prototype.preventDefault||(Event.prototype.preventDefault=function(){this.returnValue=!1})}(),function(){"use strict";"previousElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"previousElementSibling",{"get":function(){for(var e=this.previousSibling;e&&1!==e.nodeType;)e=e.previousSibling;return e}})}(),function(){Event.prototype.stopPropagation||(Event.prototype.stopPropagation=function(){this.cancelBubble=!0})}(),function(){"use strict";function getText(node){var type=node.nodeType;if(haveText[type])return node.nodeValue;if(haveNull[type])return null;var name=node.nodeName;if(name&&srcTags[name])return node.innerHTML;for(var result="",children=node.childNodes,i=0,l=children.length;i*/ - - /** Munge the hell out of our string literals. Saves a tonne of space after compression. */ - SPACE = " ", - ELEMENT = "Element", - CREATE_ELEMENT = "create"+ELEMENT, - DOM_TOKEN_LIST = "DOMTokenList", - DEFINE_GETTER = "__defineGetter__", - DEFINE_PROPERTY = "defineProperty", - CLASS_ = "class", - LIST = "List", - CLASS_LIST = CLASS_+LIST, - REL = "rel", - REL_LIST = REL+LIST, - DIV = "div", - LENGTH = "length", - CONTAINS = "contains", - APPLY = "apply", - HTML_ = "HTML", - METHODS = ("item "+CONTAINS+" add remove toggle toString toLocaleString").split(SPACE), - ADD = METHODS[2], - REMOVE = METHODS[3], - TOGGLE = METHODS[4], - PROTOTYPE = "prototype", - - - - /** Ascertain browser support for Object.defineProperty */ - dpSupport = DEFINE_PROPERTY in OBJ || DEFINE_GETTER in OBJ[ PROTOTYPE ] || NULL, - - - /** Wrapper for Object.defineProperty that falls back to using the legacy __defineGetter__ method if available. */ - defineGetter = function(object, name, fn, configurable){ - if(OBJ[ DEFINE_PROPERTY ]) - OBJ[ DEFINE_PROPERTY ](object, name, { - configurable: FALSE === dpSupport ? TRUE : !!configurable, - get: fn - }); - - else object[ DEFINE_GETTER ](name, fn); - }, - - - - - /** DOMTokenList interface replacement */ - DOMTokenList = function(el, prop){ - var THIS = this, - - /** Private variables */ - tokens = [], - tokenMap = {}, - length = 0, - maxLength = 0, - - - reindex = function(){ - - /** Define getter functions for array-like access to the tokenList's contents. */ - if(length >= maxLength) - for(; maxLength < length; ++maxLength) (function(i){ - - defineGetter(THIS, i, function(){ - preop(); - return tokens[i]; - }, FALSE); - - })(maxLength); - }, - - - - /** Helper function called at the start of each class method. Internal use only. */ - preop = function(){ - var error, i, - args = arguments, - rSpace = /\s+/; - - /** Validate the token/s passed to an instance method, if any. */ - if(args[ LENGTH ]) - for(i = 0; i < args[ LENGTH ]; ++i) - if(rSpace.test(args[i])){ - error = new SyntaxError('String "' + args[i] + '" ' + CONTAINS + ' an invalid character'); - error.code = 5; - error.name = "InvalidCharacterError"; - throw error; - } - - - /** Split the new value apart by whitespace*/ - tokens = ("" + el[prop]).replace(/^\s+|\s+$/g, "").split(rSpace); - - /** Avoid treating blank strings as single-item token lists */ - if("" === tokens[0]) tokens = []; - - /** Repopulate the internal token lists */ - tokenMap = {}; - for(i = 0; i < tokens[ LENGTH ]; ++i) - tokenMap[tokens[i]] = TRUE; - length = tokens[ LENGTH ]; - reindex(); - }; - - - - /** Populate our internal token list if the targeted attribute of the subject element isn't empty. */ - preop(); - - - - /** Return the number of tokens in the underlying string. Read-only. */ - defineGetter(THIS, LENGTH, function(){ - preop(); - return length; - }); - - - /** Override the default toString/toLocaleString methods to return a space-delimited list of tokens when typecast. */ - THIS[ METHODS[6] /** toLocaleString */ ] = - THIS[ METHODS[5] /** toString */ ] = function(){ - preop(); - return tokens.join(SPACE); - }; - - - - /** Return an item in the list by its index (or undefined if the number is greater than or equal to the length of the list) */ - THIS.item = function(idx){ - preop(); - return tokens[idx]; - }; - - - /** Return TRUE if the underlying string contains `token`; otherwise, FALSE. */ - THIS[ CONTAINS ] = function(token){ - preop(); - return !!tokenMap[token]; - }; - - - - /** Add one or more tokens to the underlying string. */ - THIS[ADD] = function(){ - preop[APPLY](THIS, args = arguments); - - for(var args, token, i = 0, l = args[ LENGTH ]; i < l; ++i){ - token = args[i]; - if(!tokenMap[token]){ - tokens.push(token); - tokenMap[token] = TRUE; - } - } - - /** Update the targeted attribute of the attached element if the token list's changed. */ - if(length !== tokens[ LENGTH ]){ - length = tokens[ LENGTH ] >>> 0; - el[prop] = tokens.join(SPACE); - reindex(); - } - }; - - - - /** Remove one or more tokens from the underlying string. */ - THIS[ REMOVE ] = function(){ - preop[APPLY](THIS, args = arguments); - - /** Build a hash of token names to compare against when recollecting our token list. */ - for(var args, ignore = {}, i = 0, t = []; i < args[ LENGTH ]; ++i){ - ignore[args[i]] = TRUE; - delete tokenMap[args[i]]; - } - - /** Run through our tokens list and reassign only those that aren't defined in the hash declared above. */ - for(i = 0; i < tokens[ LENGTH ]; ++i) - if(!ignore[tokens[i]]) t.push(tokens[i]); - - tokens = t; - length = t[ LENGTH ] >>> 0; - - /** Update the targeted attribute of the attached element. */ - el[prop] = tokens.join(SPACE); - reindex(); - }; - - - - /** Add or remove a token depending on whether it's already contained within the token list. */ - THIS[TOGGLE] = function(token, force){ - preop[APPLY](THIS, [token]); - - /** Token state's being forced. */ - if(UNDEF !== force){ - if(force) { THIS[ADD](token); return TRUE; } - else { THIS[REMOVE](token); return FALSE; } - } - - /** Token already exists in tokenList. Remove it, and return FALSE. */ - if(tokenMap[token]){ - THIS[ REMOVE ](token); - return FALSE; - } - - /** Otherwise, add the token and return TRUE. */ - THIS[ADD](token); - return TRUE; - }; - - - /** Mark our newly-assigned methods as non-enumerable. */ - (function(o, defineProperty){ - if(defineProperty) - for(var i = 0; i < 7; ++i) - defineProperty(o, METHODS[i], {enumerable: FALSE}); - }(THIS, OBJ[ DEFINE_PROPERTY ])); - - return THIS; - }, - - - - /** Polyfills a property with a DOMTokenList */ - addProp = function(o, name, attr){ - - defineGetter(o[PROTOTYPE], name, function(){ - var tokenList, - THIS = this, - - /** Prevent this from firing twice for some reason. What the hell, IE. */ - gibberishProperty = DEFINE_GETTER + DEFINE_PROPERTY + name; - if(THIS[gibberishProperty]) return tokenList; - THIS[gibberishProperty] = TRUE; - - - /** - * IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead. - * - * What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror") - * that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML - * element instead, this would conflict with element types which use indexed properties (such as forms and - * select lists). - */ - if(FALSE === dpSupport){ - - var visage, - mirror = addProp.mirror = addProp.mirror || DOC[ CREATE_ELEMENT ](DIV), - reflections = mirror.childNodes, - - /** Iterator variables */ - l = reflections[ LENGTH ], - i = 0; - - for(; i < l; ++i) - if(reflections[i]._R === THIS){ - visage = reflections[i]; - break; - } - - /** Couldn't find an element's reflection inside the mirror. Materialise one. */ - visage || (visage = mirror.appendChild(DOC[ CREATE_ELEMENT ](DIV))); - - tokenList = DOMTokenList.call(visage, THIS, attr); - } - - else tokenList = new DOMTokenList(THIS, attr); - - - defineGetter(THIS, name, function(){ return tokenList; }); - delete THIS[gibberishProperty]; - - return tokenList; - }, TRUE); - }, - - /** Variables used for patching native methods that're partially implemented (IE doesn't support adding/removing multiple tokens, for instance). */ - testList, - nativeAdd, - nativeRemove; - - - - - /** No discernible DOMTokenList support whatsoever. Time to remedy that. */ - if(!WIN[ DOM_TOKEN_LIST ]){ - - /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */ - if(dpSupport) - try{ defineGetter({}, "support"); } - catch(e){ dpSupport = FALSE; } - - - DOMTokenList.polyfill = TRUE; - WIN[ DOM_TOKEN_LIST ] = DOMTokenList; - - addProp( WIN[ ELEMENT ], CLASS_LIST, CLASS_ + "Name"); /* Element.classList */ - addProp( WIN[ HTML_+ "Link" + ELEMENT ], REL_LIST, REL); /* HTMLLinkElement.relList */ - addProp( WIN[ HTML_+ "Anchor" + ELEMENT ], REL_LIST, REL); /* HTMLAnchorElement.relList */ - addProp( WIN[ HTML_+ "Area" + ELEMENT ], REL_LIST, REL); /* HTMLAreaElement.relList */ - } - - - /** - * Possible support, but let's check for bugs. - * - * Where arbitrary values are needed for performing a test, previous variables - * are recycled to save space in the minified file. - */ - else{ - testList = DOC[ CREATE_ELEMENT ](DIV)[CLASS_LIST]; - - /** We'll replace a "string constant" to hold a reference to DOMTokenList.prototype (filesize optimisation, yaddah-yaddah...) */ - PROTOTYPE = WIN[DOM_TOKEN_LIST][PROTOTYPE]; - - - /** Check if we can pass multiple arguments to add/remove. To save space, we'll just recycle a previous array of strings. */ - testList[ADD][APPLY](testList, METHODS); - if(2 > testList[LENGTH]){ - nativeAdd = PROTOTYPE[ADD]; - nativeRemove = PROTOTYPE[REMOVE]; - - PROTOTYPE[ADD] = function(){ - for(var i = 0, args = arguments; i < args[LENGTH]; ++i) - nativeAdd.call(this, args[i]); - }; - - PROTOTYPE[REMOVE] = function(){ - for(var i = 0, args = arguments; i < args[LENGTH]; ++i) - nativeRemove.call(this, args[i]); - }; - } - - - /** Check if the "force" option of .toggle is supported. */ - if(testList[TOGGLE](LIST, FALSE)) - PROTOTYPE[TOGGLE] = function(token, force){ - var THIS = this; - THIS[(force = UNDEF === force ? !THIS[CONTAINS](token) : force) ? ADD : REMOVE](token); - return !!force; - }; - } -}()); - -// ChildNode.remove -(function () { - "use strict"; - - if(!("remove" in Element.prototype)){ - Element.prototype.remove = function(){ - if(this.parentNode) { - this.parentNode.removeChild(this); - } - }; - } -})(); - -// Number.isNaN -Number.isNaN = Number.isNaN || function(val){ return val !== val; }; - -// String.prototype.repeat -String.prototype.repeat = String.prototype.repeat || function(num) { - return Array(num + 1).join(this); -}; -// *** gn *** // -var gn = (function (g) { - - // return gn - return g; -})(window.gn || {}); -// isNodeList -// @require "/src/gn/base.js" - -gn.isNodeList = function (el) { +var isNodeList = function (el) { // Only NodeList has the "item()" function - return typeof el.item !== 'undefined'; + return typeof el.item !== "undefined"; }; -// DOM ready -// @require "/src/gn/base.js" - -gn.ready = function ( fn ) { - - // Sanity check - if ( typeof fn !== 'function' ) { return; } - - // If document is already loaded, run method - if ( document.readyState === 'complete' ) { - return fn(); - } - - // Otherwise, wait until document is loaded - document.addEventListener( 'DOMContentLoaded', fn, false ); -}; -// append -// @require "/src/gn/base.js" -// @require "/src/gn/isNodeList.js" - -gn.append = function(els, data) { +var append = function(els, data) { var els_new = (gn.isNodeList(els)) ? els : [els], i; if (typeof data.nodeType !== "undefined" && data.nodeType === 1) { @@ -597,7 +15,7 @@ gn.append = function(els, data) { } } else if (typeof data === "string") { for (i = els_new.length; i--;) { - els_new[i].insertAdjacentHTML('beforeend', data); + els_new[i].insertAdjacentHTML("beforeend", data); } } else if (gn.isNodeList(data)) { var fragment = document.createDocumentFragment(); @@ -610,11 +28,7 @@ gn.append = function(els, data) { } }; - -// createElement -// @require "/src/gn/base.js" - -gn.createElement = function(obj) { +var createElement = function(obj) { if (!obj || !obj.tagName) { throw { message : "Invalid argument" }; } @@ -647,21 +61,33 @@ gn.createElement = function(obj) { }; // var el = gn.createElement({ -// tagName: 'div', -// id: 'foo', -// className: 'foo', +// tagName: "div", +// id: "foo", +// className: "foo", // children: [{ -// tagName: 'div', -// html: 'Hello, creatElement', +// tagName: "div", +// html: "Hello, creatElement", // attributes: { -// 'am-button': 'primary' +// "am-button": "primary" // } // }] // }); -// extend -// @require "/src/gn/base.js" -gn.extend = function () { +var ready = function ( fn ) { + + // Sanity check + if ( typeof fn !== "function" ) { return; } + + // If document is already loaded, run method + if ( document.readyState === "complete" ) { + return fn(); + } + + // Otherwise, wait until document is loaded + document.addEventListener( "DOMContentLoaded", fn, false ); +}; + +var extend = function () { var obj, name, copy, target = arguments[0] || {}, i = 1, @@ -682,11 +108,8 @@ gn.extend = function () { } return target; }; -// getClosest -// @require "/src/gn/base.js" -// @require "./bower_components/domtokenlist/src/token-list.js" -gn.getClosest = function (elem, selector) { +var getClosest = function (elem, selector) { var firstChar = selector.charAt(0); @@ -694,21 +117,21 @@ gn.getClosest = function (elem, selector) { for ( ; elem && elem !== document; elem = elem.parentNode ) { // If selector is a class - if ( firstChar === '.' ) { + if ( firstChar === "." ) { if ( elem.classList.contains( selector.substr(1) ) ) { return elem; } } // If selector is an ID - if ( firstChar === '#' ) { + if ( firstChar === "#" ) { if ( elem.id === selector.substr(1) ) { return elem; } } // If selector is a data attribute - if ( firstChar === '[' ) { + if ( firstChar === "[" ) { if ( elem.hasAttribute( selector.substr(1, selector.length - 2) ) ) { return elem; } @@ -725,57 +148,188 @@ gn.getClosest = function (elem, selector) { }; -// var elem = document.querySelector('#some-element'); -// var closest = getClosest(elem, '.some-class'); -// var closestLink = getClosest(elem, 'a'); -// var closestExcludingElement = getClosest(elem.parentNode, '.some-class'); +// var elem = document.querySelector("#some-element"); +// var closest = getClosest(elem, ".some-class"); +// var closestLink = getClosest(elem, "a"); +// var closestExcludingElement = getClosest(elem.parentNode, ".some-class"); -// getHeight -// @require "/src/gn/base.js" -// @require "/bower_components/Units/Length.js" -// 1. outer size: content + padding + border + margin // +// create a test element +var testElem = document.createElement('test'); +var docElement = document.documentElement; +var defaultView = document.defaultView; +var getComputedStyle$1 = defaultView && defaultView.getComputedStyle; +var computedValueBug; +var runit = /^(-?[\d+\.\-]+)([a-z]+|%)$/i; +var convert = {}; +var conversions = [1 / 25.4, 1 / 2.54, 1 / 72, 1 / 6]; +var units = ['mm', 'cm', 'pt', 'pc', 'in', 'mozmm']; +var i = 6; // units.length -// 2. offset size: content + padding + border // -// el.offsetWidth -// el.offsetHeight +// add the test element to the dom +docElement.appendChild(testElem); -// 3. client size: content + padding -// el.clientWidth -// el.clientHeight +// test for the WebKit getComputedStyle bug +// @see http://bugs.jquery.com/ticket/10639 +if (getComputedStyle$1) { + // add a percentage margin and measure it + testElem.style.marginTop = '1%'; + computedValueBug = getComputedStyle$1(testElem).marginTop === '1%'; +} -// 4. size: content +// pre-calculate absolute unit conversions +while (i--) { + convert[units[i] + "toPx"] = conversions[i] ? conversions[i] * convert.inToPx : toPx(testElem, '1' + units[i]); +} + +// remove the test element from the DOM and delete it +docElement.removeChild(testElem); +testElem = undefined; + +// convert a value to pixels +function toPx(elem, value, prop, force) { + // use width as the default property, or specify your own + prop = prop || 'width'; + + var style, + inlineValue, + ret, + unit = (value.match(runit) || [])[2], + conversion = unit === 'px' ? 1 : convert[unit + 'toPx'], + rem = /r?em/i; + + if (conversion || rem.test(unit) && !force) { + // calculate known conversions immediately + // find the correct element for absolute units or rem or fontSize + em or em + elem = conversion ? elem : unit === 'rem' ? docElement : prop === 'fontSize' ? elem.parentNode || elem : elem; + + // use the pre-calculated conversion or fontSize of the element for rem and em + conversion = conversion || parseFloat(curCSS(elem, 'fontSize')); + + // multiply the value by the conversion + ret = parseFloat(value) * conversion; + } else { + // begin "the awesome hack by Dean Edwards" + // @see http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // remember the current style + style = elem.style; + inlineValue = style[prop]; + + // set the style on the target element + try { + style[prop] = value; + } catch (e) { + // IE 8 and below throw an exception when setting unsupported units + return 0; + } + + // read the computed value + // if style is nothing we probably set an unsupported unit + ret = !style[prop] ? 0 : parseFloat(curCSS(elem, prop)); -gn.getHeight = function (el) { + // reset the style back to what it was or blank it out + style[prop] = inlineValue !== undefined ? inlineValue : null; + } + + // return a number + return ret; +} + +// return the computed value of a CSS property +function curCSS(elem, prop) { + var value, + pixel, + unit, + rvpos = /^top|bottom/, + outerProp = ["paddingTop", "paddingBottom", "borderTop", "borderBottom"], + innerHeight, + parent, + i = 4; // outerProp.length + + if (getComputedStyle$1) { + // FireFox, Chrome/Safari, Opera and IE9+ + value = getComputedStyle$1(elem)[prop]; + } else if (pixel = elem.style['pixel' + prop.charAt(0).toUpperCase() + prop.slice(1)]) { + // IE and Opera support pixel shortcuts for top, bottom, left, right, height, width + // WebKit supports pixel shortcuts only when an absolute unit is used + value = pixel + 'px'; + } else if (prop === 'fontSize') { + // correct IE issues with font-size + // @see http://bugs.jquery.com/ticket/760 + value = toPx(elem, '1em', 'left', 1) + 'px'; + } else { + // IE 8 and below return the specified style + value = elem.currentStyle[prop]; + } + + // check the unit + unit = (value.match(runit) || [])[2]; + if (unit === '%' && computedValueBug) { + // WebKit won't convert percentages for top, bottom, left, right, margin and text-indent + if (rvpos.test(prop)) { + // Top and bottom require measuring the innerHeight of the parent. + innerHeight = (parent = elem.parentNode || elem).offsetHeight; + while (i--) { + innerHeight -= parseFloat(curCSS(parent, outerProp[i])); + } + value = parseFloat(value) / 100 * innerHeight + 'px'; + } else { + // This fixes margin, left, right and text-indent + // @see https://bugs.webkit.org/show_bug.cgi?id=29084 + // @see http://bugs.jquery.com/ticket/10639 + value = toPx(elem, value); + } + } else if ((value === 'auto' || (unit && unit !== 'px')) && getComputedStyle$1) { + // WebKit and Opera will return auto in some cases + // Firefox will pass back an unaltered value when it can't be set, like top on a static element + value = 0; + } else if (unit && unit !== 'px' && !getComputedStyle$1) { + // IE 8 and below won't convert units for us + // try to convert using a prop that will return pixels + // this will be accurate for everything (except font-size and some percentages) + value = toPx(elem, value) + 'px'; + } + return value; +} + +// expose the conversion function to the window object +var Length = { + toPx: toPx +}; + +var getHeight = function (el) { var pattern = /\d/, // check if value contains digital number height = el.clientHeight, style = el.currentStyle || getComputedStyle(el), - paddingTop = (pattern.exec(style.paddingTop) === null) ? '0px' : style.paddingTop, - paddingBottom = (pattern.exec(style.paddingBottom) === null) ? '0px' : style.paddingBottom; + paddingTop = (pattern.exec(style.paddingTop) === null) ? "0px" : style.paddingTop, + paddingBottom = (pattern.exec(style.paddingBottom) === null) ? "0px" : style.paddingBottom; height -= (parseInt(Length.toPx(el, paddingTop)) + parseInt(Length.toPx(el, paddingBottom))); return height; }; -// getOffsetLeft -// @require "/src/gn/base.js" -gn.getOffsetLeft = function (el) { +// 1. outer size: content + padding + border + margin // +// 2. offset size: content + padding + border // +// el.offsetWidth +// el.offsetHeight +// 3. client size: content + padding +// el.clientWidth +// el.clientHeight +// 4. size: content + +var getOffsetLeft = function (el) { var rect = el.getBoundingClientRect(), left = rect.left + document.body.scrollLeft; return Math.round(left); }; -// getOffsetTop -// @require "/src/gn/base.js" -gn.getOffsetTop = function (el) { +var getOffsetTop = function (el) { var rect = el.getBoundingClientRect(), top = rect.top + document.body.scrollTop; return Math.round(top); }; -// getOuterHeight -// @require "/src/gn/base.js" -// @require "/bower_components/Units/Length.js" -gn.getOuterHeight = function (el) { +var getOuterHeight = function (el) { var pattern = /\d/, // check if value contains digital number height = el.offsetHeight, style = el.currentStyle || getComputedStyle(el), @@ -786,6 +340,7 @@ gn.getOuterHeight = function (el) { return height; }; +// 1. outer size: content + padding + border + margin // // 2. offset size: content + padding + border // // el.offsetWidth // el.offsetHeight @@ -793,12 +348,8 @@ gn.getOuterHeight = function (el) { // 3. client size: content + padding // el.clientWidth // el.clientHeight -// getOuterWidth -// @require "/src/gn/base.js" -// @require "/bower_components/Units/Length.js" -// 1. outer size: content + padding + border + margin // -gn.getOuterWidth = function (el) { +var getOuterWidth = function (el) { var pattern = /\d/, // check if value contains digital number width = el.offsetWidth, style = el.currentStyle || getComputedStyle(el), @@ -809,18 +360,15 @@ gn.getOuterWidth = function (el) { return width; }; +// 1. outer size: content + padding + border + margin // // 2. offset size: content + padding + border // // el.offsetWidth // el.offsetHeight - // 3. client size: content + padding // el.clientWidth // el.clientHeight -// getParents -// @require "/src/gn/base.js" -// @require "./bower_components/domtokenlist/src/token-list.js" -gn.getParents = function (elem, selector) { +var getParents = function (elem, selector) { var parents = []; if ( selector ) { @@ -876,11 +424,7 @@ gn.getParents = function (elem, selector) { // var parents = getParents(elem, '.some-class'); // var allParents = getParents(elem.parentNode); -// getParentsUntil -// @require "/src/gn/base.js" -// @require "./bower_components/domtokenlist/src/token-list.js" - -gn.getParentsUntil = function (elem, parent, selector) { +var getParentsUntil = function (elem, parent, selector) { var parents = []; if ( parent ) { @@ -974,11 +518,7 @@ gn.getParentsUntil = function (elem, parent, selector) { // var allParentsUntil = getParentsUntil(elem); // var allParentsExcludingElem = getParentsUntil(elem.parentNode); - -// getSiblings -// @require "/src/gn/base.js" - -gn.getSiblings = function (elem) { +var getSiblings = function (elem) { var siblings = []; var sibling = elem.parentNode.firstChild; for ( ; sibling; sibling = sibling.nextSibling ) { @@ -992,12 +532,7 @@ gn.getSiblings = function (elem) { // var elem = document.querySelector('#some-element'); // var siblings = getSiblings(elem); - - -// get supported property -// @require "/src/gn/base.js" - -gn.getSupportedProp = function (proparray){ +var getSupportedProp = function (proparray){ var root = document.documentElement; for (var i=0; i 0 && @@ -1054,13 +581,90 @@ gn.isInViewport = function ( elem ) { rect.left < document.documentElement.clientWidth ); }; -// optimizedResize + +// forEach + +if (!Array.prototype.forEach) { + Array.prototype.forEach = function(block, thisObject) { + var len = this.length >>> 0; + for (var i = 0; i < len; i++) { + if (i in this) { + block.call(thisObject, this[i], i, this); + } + } + }; +} + +// addEventListener +// removeEventListener +// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility + +(function() { + if (!Element.prototype.addEventListener) { + var eventListeners=[]; + + var addEventListener=function(type,listener /*, useCapture (will be ignored) */) { + var self=this; + var wrapper=function(e) { + e.target=e.srcElement; + e.currentTarget=self; + if (typeof listener.handleEvent != 'undefined') { + listener.handleEvent(e); + } else { + listener.call(self,e); + } + }; + if (type=="DOMContentLoaded") { + var wrapper2=function(e) { + if (document.readyState=="complete") { + wrapper(e); + } + }; + document.attachEvent("onreadystatechange",wrapper2); + eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper2}); + + if (document.readyState=="complete") { + var e=new Event(); + e.srcElement=window; + wrapper2(e); + } + } else { + this.attachEvent("on"+type,wrapper); + eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper}); + } + }; + var removeEventListener=function(type,listener /*, useCapture (will be ignored) */) { + var counter=0; + while (counterHello, creatElement\",\n// attributes: {\n// \"am-button\": \"primary\"\n// }\n// }]\n// });","export var ready = function ( fn ) {\n\n // Sanity check\n if ( typeof fn !== \"function\" ) { return; }\n\n // If document is already loaded, run method\n if ( document.readyState === \"complete\" ) {\n return fn();\n }\n\n // Otherwise, wait until document is loaded\n document.addEventListener( \"DOMContentLoaded\", fn, false );\n};","export var extend = function () {\n var obj, name, copy,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length;\n\n for (; i < length; i++) {\n if ((obj = arguments[i]) !== null) {\n for (name in obj) {\n copy = obj[name];\n\n if (target === copy) {\n continue;\n } else if (copy !== undefined) {\n target[name] = copy;\n }\n }\n }\n }\n return target;\n};","import { token_list } from \"../vendors/token-list.js\";\n\nexport var getClosest = function (elem, selector) {\n\n var firstChar = selector.charAt(0);\n\n // Get closest match\n for ( ; elem && elem !== document; elem = elem.parentNode ) {\n\n // If selector is a class\n if ( firstChar === \".\" ) {\n if ( elem.classList.contains( selector.substr(1) ) ) {\n return elem;\n }\n }\n\n // If selector is an ID\n if ( firstChar === \"#\" ) {\n if ( elem.id === selector.substr(1) ) {\n return elem;\n }\n } \n\n // If selector is a data attribute\n if ( firstChar === \"[\" ) {\n if ( elem.hasAttribute( selector.substr(1, selector.length - 2) ) ) {\n return elem;\n }\n }\n\n // If selector is a tag\n if ( elem.tagName.toLowerCase() === selector ) {\n return elem;\n }\n\n }\n\n return false;\n\n};\n\n// var elem = document.querySelector(\"#some-element\");\n// var closest = getClosest(elem, \".some-class\");\n// var closestLink = getClosest(elem, \"a\");\n// var closestExcludingElement = getClosest(elem.parentNode, \".some-class\");\n","// create a test element\nvar testElem = document.createElement('test'),\n docElement = document.documentElement,\n defaultView = document.defaultView,\n getComputedStyle = defaultView && defaultView.getComputedStyle,\n computedValueBug,\n runit = /^(-?[\\d+\\.\\-]+)([a-z]+|%)$/i,\n convert = {},\n conversions = [1 / 25.4, 1 / 2.54, 1 / 72, 1 / 6],\n units = ['mm', 'cm', 'pt', 'pc', 'in', 'mozmm'],\n i = 6; // units.length\n\n// add the test element to the dom\ndocElement.appendChild(testElem);\n\n// test for the WebKit getComputedStyle bug\n// @see http://bugs.jquery.com/ticket/10639\nif (getComputedStyle) {\n // add a percentage margin and measure it\n testElem.style.marginTop = '1%';\n computedValueBug = getComputedStyle(testElem).marginTop === '1%';\n}\n\n// pre-calculate absolute unit conversions\nwhile (i--) {\n convert[units[i] + \"toPx\"] = conversions[i] ? conversions[i] * convert.inToPx : toPx(testElem, '1' + units[i]);\n}\n\n// remove the test element from the DOM and delete it\ndocElement.removeChild(testElem);\ntestElem = undefined;\n\n// convert a value to pixels\nfunction toPx(elem, value, prop, force) {\n // use width as the default property, or specify your own\n prop = prop || 'width';\n\n var style,\n inlineValue,\n ret,\n unit = (value.match(runit) || [])[2],\n conversion = unit === 'px' ? 1 : convert[unit + 'toPx'],\n rem = /r?em/i;\n\n if (conversion || rem.test(unit) && !force) {\n // calculate known conversions immediately\n // find the correct element for absolute units or rem or fontSize + em or em\n elem = conversion ? elem : unit === 'rem' ? docElement : prop === 'fontSize' ? elem.parentNode || elem : elem;\n\n // use the pre-calculated conversion or fontSize of the element for rem and em\n conversion = conversion || parseFloat(curCSS(elem, 'fontSize'));\n\n // multiply the value by the conversion\n ret = parseFloat(value) * conversion;\n } else {\n // begin \"the awesome hack by Dean Edwards\"\n // @see http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n\n // remember the current style\n style = elem.style;\n inlineValue = style[prop];\n\n // set the style on the target element\n try {\n style[prop] = value;\n } catch (e) {\n // IE 8 and below throw an exception when setting unsupported units\n return 0;\n }\n\n // read the computed value\n // if style is nothing we probably set an unsupported unit\n ret = !style[prop] ? 0 : parseFloat(curCSS(elem, prop));\n\n // reset the style back to what it was or blank it out\n style[prop] = inlineValue !== undefined ? inlineValue : null;\n }\n\n // return a number\n return ret;\n}\n\n// return the computed value of a CSS property\nfunction curCSS(elem, prop) {\n var value,\n pixel,\n unit,\n rvpos = /^top|bottom/,\n outerProp = [\"paddingTop\", \"paddingBottom\", \"borderTop\", \"borderBottom\"],\n innerHeight,\n parent,\n i = 4; // outerProp.length\n\n if (getComputedStyle) {\n // FireFox, Chrome/Safari, Opera and IE9+\n value = getComputedStyle(elem)[prop];\n } else if (pixel = elem.style['pixel' + prop.charAt(0).toUpperCase() + prop.slice(1)]) {\n // IE and Opera support pixel shortcuts for top, bottom, left, right, height, width\n // WebKit supports pixel shortcuts only when an absolute unit is used\n value = pixel + 'px';\n } else if (prop === 'fontSize') {\n // correct IE issues with font-size\n // @see http://bugs.jquery.com/ticket/760\n value = toPx(elem, '1em', 'left', 1) + 'px';\n } else {\n // IE 8 and below return the specified style\n value = elem.currentStyle[prop];\n }\n\n // check the unit\n unit = (value.match(runit) || [])[2];\n if (unit === '%' && computedValueBug) {\n // WebKit won't convert percentages for top, bottom, left, right, margin and text-indent\n if (rvpos.test(prop)) {\n // Top and bottom require measuring the innerHeight of the parent.\n innerHeight = (parent = elem.parentNode || elem).offsetHeight;\n while (i--) {\n innerHeight -= parseFloat(curCSS(parent, outerProp[i]));\n }\n value = parseFloat(value) / 100 * innerHeight + 'px';\n } else {\n // This fixes margin, left, right and text-indent\n // @see https://bugs.webkit.org/show_bug.cgi?id=29084\n // @see http://bugs.jquery.com/ticket/10639\n value = toPx(elem, value);\n }\n } else if ((value === 'auto' || (unit && unit !== 'px')) && getComputedStyle) {\n // WebKit and Opera will return auto in some cases\n // Firefox will pass back an unaltered value when it can't be set, like top on a static element\n value = 0;\n } else if (unit && unit !== 'px' && !getComputedStyle) {\n // IE 8 and below won't convert units for us\n // try to convert using a prop that will return pixels\n // this will be accurate for everything (except font-size and some percentages)\n value = toPx(elem, value) + 'px';\n }\n return value;\n}\n\n// expose the conversion function to the window object\nexport var Length = {\n toPx: toPx\n};","import { Length } from \"../vendors/Length.js\";\n\nexport var getHeight = function (el) {\n var pattern = /\\d/, // check if value contains digital number\n height = el.clientHeight,\n style = el.currentStyle || getComputedStyle(el),\n paddingTop = (pattern.exec(style.paddingTop) === null) ? \"0px\" : style.paddingTop,\n paddingBottom = (pattern.exec(style.paddingBottom) === null) ? \"0px\" : style.paddingBottom;\n\n height -= (parseInt(Length.toPx(el, paddingTop)) + parseInt(Length.toPx(el, paddingBottom)));\n return height;\n};\n\n// 1. outer size: content + padding + border + margin //\n// 2. offset size: content + padding + border //\n// el.offsetWidth \n// el.offsetHeight\n// 3. client size: content + padding\n// el.clientWidth \n// el.clientHeight\n// 4. size: content","export var getOffsetLeft = function (el) {\n var rect = el.getBoundingClientRect(),\n left = rect.left + document.body.scrollLeft;\n return Math.round(left);\n};","export var getOffsetTop = function (el) {\n var rect = el.getBoundingClientRect(),\n top = rect.top + document.body.scrollTop;\n return Math.round(top);\n};","import { Length } from \"../vendors/Length.js\";\n\nexport var getOuterHeight = function (el) {\n var pattern = /\\d/, // check if value contains digital number\n height = el.offsetHeight,\n style = el.currentStyle || getComputedStyle(el),\n marginTop = (pattern.exec(style.marginTop) === null) ? '0px' : style.marginTop,\n marginBottom = (pattern.exec(style.marginBottom) === null) ? '0px' : style.marginBottom;\n\n height += parseInt(Length.toPx(el, marginTop)) + parseInt(Length.toPx(el, marginBottom));\n return height;\n};\n\n// 1. outer size: content + padding + border + margin //\n// 2. offset size: content + padding + border //\n// el.offsetWidth \n// el.offsetHeight\n\n// 3. client size: content + padding\n// el.clientWidth \n// el.clientHeight","import { Length } from \"../vendors/Length.js\";\n\nexport var getOuterWidth = function (el) {\n var pattern = /\\d/, // check if value contains digital number\n width = el.offsetWidth,\n style = el.currentStyle || getComputedStyle(el),\n marginLeft = (pattern.exec(style.marginLeft) === null) ? '0px' : style.marginLeft,\n marginRight = (pattern.exec(style.marginRight) === null) ? '0px' : style.marginRight;\n\n width += parseInt(Length.toPx(el, marginLeft)) + parseInt(Length.toPx(el, marginRight));\n return width;\n};\n\n// 1. outer size: content + padding + border + margin //\n// 2. offset size: content + padding + border //\n// el.offsetWidth \n// el.offsetHeight\n// 3. client size: content + padding\n// el.clientWidth \n// el.clientHeight","import { token_list } from \"../vendors/token-list.js\";\n\nexport var getParents = function (elem, selector) {\n\n var parents = [];\n if ( selector ) {\n var firstChar = selector.charAt(0);\n }\n\n // Get matches\n for ( ; elem && elem !== document; elem = elem.parentNode ) {\n if ( selector ) {\n\n // If selector is a class\n if ( firstChar === '.' ) {\n if ( elem.classList.contains( selector.substr(1) ) ) {\n parents.push( elem );\n }\n }\n\n // If selector is an ID\n if ( firstChar === '#' ) {\n if ( elem.id === selector.substr(1) ) {\n parents.push( elem );\n }\n }\n\n // If selector is a data attribute\n if ( firstChar === '[' ) {\n if ( elem.hasAttribute( selector.substr(1, selector.length - 1) ) ) {\n parents.push( elem );\n }\n }\n\n // If selector is a tag\n if ( elem.tagName.toLowerCase() === selector ) {\n parents.push( elem );\n }\n\n } else {\n parents.push( elem );\n }\n\n }\n\n // Return parents if any exist\n if ( parents.length === 0 ) {\n return null;\n } else {\n return parents;\n }\n\n};\n\n// var elem = document.querySelector('#some-element');\n// var parents = getParents(elem, '.some-class');\n// var allParents = getParents(elem.parentNode);\n","import { token_list } from \"../vendors/token-list.js\";\n\nexport var getParentsUntil = function (elem, parent, selector) {\n\n var parents = [];\n if ( parent ) {\n var parentType = parent.charAt(0);\n }\n if ( selector ) {\n var selectorType = selector.charAt(0);\n }\n\n // Get matches\n for ( ; elem && elem !== document; elem = elem.parentNode ) {\n\n // Check if parent has been reached\n if ( parent ) {\n\n // If parent is a class\n if ( parentType === '.' ) {\n if ( elem.classList.contains( parent.substr(1) ) ) {\n break;\n }\n }\n\n // If parent is an ID\n if ( parentType === '#' ) {\n if ( elem.id === parent.substr(1) ) {\n break;\n }\n }\n\n // If parent is a data attribute\n if ( parentType === '[' ) {\n if ( elem.hasAttribute( parent.substr(1, parent.length - 1) ) ) {\n break;\n }\n }\n\n // If parent is a tag\n if ( elem.tagName.toLowerCase() === parent ) {\n break;\n }\n\n }\n\n if ( selector ) {\n\n // If selector is a class\n if ( selectorType === '.' ) {\n if ( elem.classList.contains( selector.substr(1) ) ) {\n parents.push( elem );\n }\n }\n\n // If selector is an ID\n if ( selectorType === '#' ) {\n if ( elem.id === selector.substr(1) ) {\n parents.push( elem );\n }\n }\n\n // If selector is a data attribute\n if ( selectorType === '[' ) {\n if ( elem.hasAttribute( selector.substr(1, selector.length - 1) ) ) {\n parents.push( elem );\n }\n }\n\n // If selector is a tag\n if ( elem.tagName.toLowerCase() === selector ) {\n parents.push( elem );\n }\n\n } else {\n parents.push( elem );\n }\n\n }\n\n // Return parents if any exist\n if ( parents.length === 0 ) {\n return null;\n } else {\n return parents;\n }\n\n};\n\n// Examples\n// var elem = document.querySelector('#some-element');\n// var parentsUntil = getParentsUntil(elem, '.some-class');\n// var parentsUntilByFilter = getParentsUntil(elem, '.some-class', '[data-something]');\n// var allParentsUntil = getParentsUntil(elem);\n// var allParentsExcludingElem = getParentsUntil(elem.parentNode);\n\n","export var getSiblings = function (elem) {\n var siblings = [];\n var sibling = elem.parentNode.firstChild;\n for ( ; sibling; sibling = sibling.nextSibling ) {\n if ( sibling.nodeType === 1 && sibling !== elem ) {\n siblings.push( sibling );\n }\n }\n return siblings;\n};\n\n// var elem = document.querySelector('#some-element');\n// var siblings = getSiblings(elem);","export var getSupportedProp = function (proparray){\n var root = document.documentElement;\n for (var i=0; i 0 &&\n rect.right > 0 &&\n rect.top < document.documentElement.clientHeight &&\n rect.left < document.documentElement.clientWidth\n );\n};","// forEach\n\nif (!Array.prototype.forEach) {\n Array.prototype.forEach = function(block, thisObject) {\n var len = this.length >>> 0;\n for (var i = 0; i < len; i++) {\n if (i in this) {\n block.call(thisObject, this[i], i, this);\n }\n }\n };\n}\n","// addEventListener\n// removeEventListener\n// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility\n\n(function() {\n if (!Element.prototype.addEventListener) {\n var eventListeners=[];\n \n var addEventListener=function(type,listener /*, useCapture (will be ignored) */) {\n var self=this;\n var wrapper=function(e) {\n e.target=e.srcElement;\n e.currentTarget=self;\n if (typeof listener.handleEvent != 'undefined') {\n listener.handleEvent(e);\n } else {\n listener.call(self,e);\n }\n };\n if (type==\"DOMContentLoaded\") {\n var wrapper2=function(e) {\n if (document.readyState==\"complete\") {\n wrapper(e);\n }\n };\n document.attachEvent(\"onreadystatechange\",wrapper2);\n eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper2});\n \n if (document.readyState==\"complete\") {\n var e=new Event();\n e.srcElement=window;\n wrapper2(e);\n }\n } else {\n this.attachEvent(\"on\"+type,wrapper);\n eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper});\n }\n };\n var removeEventListener=function(type,listener /*, useCapture (will be ignored) */) {\n var counter=0;\n while (counter 0) ? obj.cloneNode(true) : obj,\n el = elsNew[i];\n\n // Cache the current parent and sibling.\n var parent = el.parentNode,\n sibling = el.nextSibling;\n\n // Wrap the element (is automatically removed from its current parent).\n wrapper.appendChild(el);\n\n // If the element had a sibling, insert the wrapper before\n // the sibling to maintain the HTML structure; otherwise, just\n // append it to the parent.\n if (sibling) {\n parent.insertBefore(wrapper, sibling);\n } else {\n parent.appendChild(wrapper);\n }\n }\n};","export var wrapAll = function (els, wrapper) {\n // Cache the current parent and sibling of the first element.\n var el = els.length ? els[0] : els,\n parent = el.parentNode,\n sibling = el.nextSibling;\n\n // Wrap all elements (if applicable). Each element is\n // automatically removed from its current parent and from the elms\n // array.\n for (var i = 0; i < els.length; i++) {\n wrapper.appendChild(els[i]);\n }\n \n // If the first element had a sibling, insert the wrapper before the\n // sibling to maintain the HTML structure; otherwise, just append it\n // to the parent.\n if (sibling !== els[1]) {\n parent.insertBefore(wrapper, sibling);\n } else {\n parent.appendChild(wrapper);\n }\n};","import { isNodeList } from \"./gn/isNodeList\";\nimport { append } from \"./gn/append\";\nimport { createElement } from \"./gn/createElement\";\nimport { ready } from \"./gn/dom.ready\";\nimport { extend } from \"./gn/extend\";\nimport { getClosest } from \"./gn/getClosest\";\nimport { getHeight } from \"./gn/getHeight\";\nimport { getOffsetLeft } from \"./gn/getOffsetLeft\";\nimport { getOffsetTop } from \"./gn/getOffsetTop\";\nimport { getOuterHeight } from \"./gn/getOuterHeight\";\nimport { getOuterWidth } from \"./gn/getOuterWidth\";\nimport { getParents } from \"./gn/getParents\";\nimport { getParentsUntil } from \"./gn/getParentsUntil\";\nimport { getSiblings } from \"./gn/getSiblings\";\nimport { getSupportedProp } from \"./gn/getSupportedProp\";\nimport { getWidth } from \"./gn/getWidth\";\nimport { indexOf } from \"./gn/indexOf\";\nimport { isInViewport } from \"./gn/isInViewport\";\nimport { optimizedResize } from \"./gn/optimizedResize\";\nimport { prepend } from \"./gn/prepend\";\nimport { unwrap } from \"./gn/unwrap\";\nimport { wrap } from \"./gn/wrap\";\nimport { wrapAll } from \"./gn/wrapAll\";\n\nexport var gn = (function (g) {\n g.isNodeList = isNodeList;\n g.append = append;\n g.createElement = createElement;\n g.ready = ready;\n g.extend = extend;\n g.getClosest = getClosest;\n g.getHeight = getHeight;\n g.getOffsetLeft = getOffsetLeft;\n g.getOffsetTop = getOffsetTop;\n g.getOuterHeight = getOuterHeight;\n g.getOuterWidth = getOuterWidth;\n g.getParents = getParents;\n g.getParentsUntil = getParentsUntil;\n g.getSiblings = getSiblings;\n g.getSupportedProp = getSupportedProp;\n g.getWidth = getWidth;\n g.indexOf = indexOf;\n g.isInViewport = isInViewport;\n g.optimizedResize = optimizedResize;\n g.prepend = prepend;\n g.unwrap = unwrap;\n g.wrap = wrap;\n g.wrapAll = wrapAll;\n\n return g;\n})(window.gn || {});"],"names":["getComputedStyle","gn"],"mappings":";;;AAAO,IAAI,UAAU,GAAG,UAAU,EAAE,EAAE;;EAEpC,OAAO,OAAO,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC;CACvC;;ACHM,IAAI,MAAM,GAAG,SAAS,GAAG,EAAE,IAAI,EAAE;EACtC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;EAEpD,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,WAAW,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;IAC/D,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG;MAC7B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AC,KAAK,GAAG,KAAK,CAAC;EAChB,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;EAClB,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;EAC1B,CAAC,CAAC,SAAS,GAAG,SAAS,CAAC;EACxB,CAAC,CAAC,aAAa,GAAG,aAAa,CAAC;EAChC,CAAC,CAAC,YAAY,GAAG,YAAY,CAAC;EAC9B,CAAC,CAAC,cAAc,GAAG,cAAc,CAAC;EAClC,CAAC,CAAC,aAAa,GAAG,aAAa,CAAC;EAChC,CAAC,CAAC,UAAU,GAAG,UAAU,CAAC;EAC1B,CAAC,CAAC,eAAe,GAAG,eAAe,CAAC;EACpC,CAAC,CAAC,WAAW,GAAG,WAAW,CAAC;EAC5B,CAAC,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;EACtC,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC;EACtB,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;EACpB,CAAC,CAAC,YAAY,GAAG,YAAY,CAAC;EAC9B,CAAC,CAAC,eAAe,GAAG,eAAe,CAAC;EACpC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;EACpB,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;EAClB,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC;EACd,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC;;EAEpB,OAAO,CAAC,CAAC;CACV,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,;;,;;"} \ No newline at end of file diff --git a/dist/go-native.min.js b/dist/go-native.min.js deleted file mode 100644 index 2757281..0000000 --- a/dist/go-native.min.js +++ /dev/null @@ -1,2 +0,0 @@ -Date.now||(Date.now=function(){return(new Date).getTime()}),function(){"use strict";for(var e=["webkit","moz"],t=0;t=l)for(;l>>0,t[n]=i.join(d),c())},r[F]=function(){p[N](r,e=arguments);for(var e,a={},f=0,l=[];f>>0,t[n]=i.join(d),c()},r[P]=function(t,n){return p[N](r,[t]),e!==n?n?(r[T](t),s):(r[F](t),f):o[t]?(r[F](t),f):(r[T](t),s)},function(e,t){if(t)for(var n=0;n<7;++n)t(e,S[n],{enumerable:f})}(r,a[m]),r},H=function(e,t,n){I(e[B],t,function(){var e,r=this,i=g+m+t;if(r[i])return e;if(r[i]=s,f===E){for(var a,u=H.mirror=H.mirror||o[c](b),d=u.childNodes,l=d[L],p=0;pt[L]&&(n=B[T],r=B[F],B[T]=function(){for(var e=0,t=arguments;e0&&t.right>0&&t.top0?t.cloneNode(!0):t,o=n[r],a=o.parentNode,u=o.nextSibling;i.appendChild(o),u?a.insertBefore(i,u):a.appendChild(i)}},gn.wrapAll=function(e,t){for(var n=e.length?e[0]:e,r=n.parentNode,i=n.nextSibling,o=0;o\n * Version: 1.3.6\n * Created: 20070722\n * Release: 20150710\n *\n * License:\n * http://javascript.nwbox.com/NWMatcher/MIT-LICENSE\n * Download:\n * http://javascript.nwbox.com/NWMatcher/nwmatcher.js\n */\n\n(function(global, factory) {\n\n if (typeof module == 'object' && typeof exports == 'object') {\n // in a Node.js environment, the nwmatcher functions will operate on\n // the passed \"browserGlobal\" and will be returned in an object\n module.exports = function (browserGlobal) {\n // passed global does not contain\n // references to native objects\n browserGlobal.console = console;\n browserGlobal.parseInt = parseInt;\n browserGlobal.Function = Function;\n browserGlobal.Boolean = Boolean;\n browserGlobal.Number = Number;\n browserGlobal.RegExp = RegExp;\n browserGlobal.String = String;\n browserGlobal.Object = Object;\n browserGlobal.Array = Array;\n browserGlobal.Error = Error;\n browserGlobal.Date = Date;\n browserGlobal.Math = Math;\n var exports = browserGlobal.Object();\n factory(browserGlobal, exports);\n return exports;\n };\n module.factory = factory;\n } else {\n // in a browser environment, the nwmatcher functions will operate on\n // the \"global\" loading them and be attached to \"global.NW.Dom\"\n factory(global,\n (global.NW || (global.NW = global.Object())) &&\n (global.NW.Dom || (global.NW.Dom = global.Object())));\n global.NW.Dom.factory = factory;\n }\n\n})(this, function(global, exports) {\n\n var version = 'nwmatcher-1.3.6',\n\n Dom = exports,\n\n // processing context & root element\n doc = global.document,\n root = doc.documentElement,\n\n // save utility methods references\n slice = global.Array.prototype.slice,\n string = global.Object.prototype.toString,\n\n // persist previous parsed data\n isSingleMatch,\n isSingleSelect,\n\n lastSlice,\n lastContext,\n lastPosition,\n\n lastMatcher,\n lastSelector,\n\n lastPartsMatch,\n lastPartsSelect,\n\n // accepted prefix identifiers\n // (id, class & pseudo-class)\n prefixes = '[#.:]?',\n\n // accepted attribute operators\n operators = '([~*^$|!]?={1})',\n\n // accepted whitespace characters\n whitespace = '[\\\\x20\\\\t\\\\n\\\\r\\\\f]*',\n\n // 4 combinators F E, F>E, F+E, F~E\n combinators = '[\\\\x20]|[>+~][^>+~]',\n\n // an+b format params for pseudo-classes\n pseudoparms = '(?:[-+]?\\\\d*n)?[-+]?\\\\d*',\n\n // CSS quoted string values\n quotedvalue = '\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*\"' + \"|'[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*'\",\n\n // skip round brackets groups\n skipround = '\\\\([^()]+\\\\)|\\\\(.*\\\\)',\n // skip curly brackets groups\n skipcurly = '\\\\{[^{}]+\\\\}|\\\\{.*\\\\}',\n // skip square brackets groups\n skipsquare = '\\\\[[^[\\\\]]*\\\\]|\\\\[.*\\\\]',\n\n // skip [ ], ( ), { } brackets groups\n skipgroup = '\\\\[.*\\\\]|\\\\(.*\\\\)|\\\\{.*\\\\}',\n\n // http://www.w3.org/TR/css3-syntax/#characters\n // unicode/ISO 10646 characters 161 and higher\n // NOTE: Safari 2.0.x crashes with escaped (\\\\)\n // Unicode ranges in regular expressions so we\n // use a negated character range class instead\n encoding = '(?:[-\\\\w]|[^\\\\x00-\\\\xa0]|\\\\\\\\.)',\n\n // CSS identifier syntax\n identifier = '(?:-?[_a-zA-Z]{1}[-\\\\w]*|[^\\\\x00-\\\\xa0]+|\\\\\\\\.+)+',\n\n // build attribute string\n attrcheck = '(' + quotedvalue + '|' + identifier + ')',\n attributes = whitespace + '(' + encoding + '*:?' + encoding + '+)' +\n whitespace + '(?:' + operators + whitespace + attrcheck + ')?' + whitespace,\n attrmatcher = attributes.replace(attrcheck, '([\\\\x22\\\\x27]*)((?:\\\\\\\\?.)*?)\\\\3'),\n\n // build pseudoclass string\n pseudoclass = '((?:' +\n // an+b parameters or quoted string\n pseudoparms + '|' + quotedvalue + '|' +\n // id, class, pseudo-class selector\n prefixes + '|' + encoding + '+|' +\n // nested HTML attribute selector\n '\\\\[' + attributes + '\\\\]|' +\n // nested pseudo-class selector\n '\\\\(.+\\\\)|' + whitespace + '|' +\n // nested pseudos/separators\n ',)+)',\n\n // placeholder for extensions\n extensions = '.+',\n\n // CSS3: syntax scanner and\n // one pass validation only\n // using regular expression\n standardValidator =\n // discard start\n '(?=[\\\\x20\\\\t\\\\n\\\\r\\\\f]*[^>+~(){}<>])' +\n // open match group\n '(' +\n //universal selector\n '\\\\*' +\n // id/class/tag/pseudo-class identifier\n '|(?:' + prefixes + identifier + ')' +\n // combinator selector\n '|' + combinators +\n // HTML attribute selector\n '|\\\\[' + attributes + '\\\\]' +\n // pseudo-classes parameters\n '|\\\\(' + pseudoclass + '\\\\)' +\n // dom properties selector (extension)\n '|\\\\{' + extensions + '\\\\}' +\n // selector group separator (comma)\n '|(?:,|' + whitespace + ')' +\n // close match group\n ')+',\n\n // validator for complex selectors in ':not()' pseudo-classes\n extendedValidator = standardValidator.replace(pseudoclass, '.*'),\n\n // validator for standard selectors as default\n reValidator = new global.RegExp(standardValidator, 'g'),\n\n // whitespace is any combination of these 5 character [\\x20\\t\\n\\r\\f]\n // http://www.w3.org/TR/css3-selectors/#selector-syntax\n reTrimSpaces = new global.RegExp('^' +\n whitespace + '|' + whitespace + '$', 'g'),\n\n // only allow simple selectors nested in ':not()' pseudo-classes\n reSimpleNot = new global.RegExp('^(' +\n '(?!:not)' +\n '(' + prefixes +\n '|' + identifier +\n '|\\\\([^()]*\\\\))+' +\n '|\\\\[' + attributes + '\\\\]' +\n ')$'),\n\n // split comma groups, exclude commas from\n // quotes '' \"\" and from brackets () [] {}\n reSplitGroup = new global.RegExp('(' +\n '[^,\\\\\\\\()[\\\\]]+' +\n '|' + skipsquare +\n '|' + skipround +\n '|' + skipcurly +\n '|\\\\\\\\.' +\n ')+', 'g'),\n\n // split last, right most, selector group token\n reSplitToken = new global.RegExp('(' +\n '\\\\[' + attributes + '\\\\]|' +\n '\\\\(' + pseudoclass + '\\\\)|' +\n '\\\\\\\\.|[^\\\\x20\\\\t\\\\r\\\\n\\\\f>+~])+', 'g'),\n\n // for in excess whitespace removal\n reWhiteSpace = /[\\x20\\t\\n\\r\\f]+/g,\n\n reOptimizeSelector = new global.RegExp(identifier + '|^$'),\n\n /*----------------------------- FEATURE TESTING ----------------------------*/\n\n // detect native methods\n isNative = (function() {\n var re = / \\w+\\(/,\n isnative = String(Object.prototype.toString).replace(re, ' (');\n return function(method) {\n return method && typeof method != 'string' &&\n isnative == String(method).replace(re, ' (');\n };\n })(),\n\n // NATIVE_XXXXX true if method exist and is callable\n // detect if DOM methods are native in browsers\n NATIVE_FOCUS = isNative(doc.hasFocus),\n NATIVE_QSAPI = isNative(doc.querySelector),\n NATIVE_GEBID = isNative(doc.getElementById),\n NATIVE_GEBTN = isNative(root.getElementsByTagName),\n NATIVE_GEBCN = isNative(root.getElementsByClassName),\n\n // detect native getAttribute/hasAttribute methods,\n // frameworks extend these to elements, but it seems\n // this does not work for XML namespaced attributes,\n // used to check both getAttribute/hasAttribute in IE\n NATIVE_GET_ATTRIBUTE = isNative(root.getAttribute),\n NATIVE_HAS_ATTRIBUTE = isNative(root.hasAttribute),\n\n // check if slice() can convert nodelist to array\n // see http://yura.thinkweb2.com/cft/\n NATIVE_SLICE_PROTO =\n (function() {\n var isBuggy = false;\n try {\n isBuggy = !!slice.call(doc.childNodes, 0)[0];\n } catch(e) { }\n return isBuggy;\n })(),\n\n // supports the new traversal API\n NATIVE_TRAVERSAL_API =\n 'nextElementSibling' in root && 'previousElementSibling' in root,\n\n // BUGGY_XXXXX true if method is feature tested and has known bugs\n // detect buggy gEBID\n BUGGY_GEBID = NATIVE_GEBID ?\n (function() {\n var isBuggy = true, x = 'x' + global.String(+new global.Date),\n a = doc.createElementNS ? 'a' : '
';\n (a = doc.createElement(a)).name = x;\n root.insertBefore(a, root.firstChild);\n isBuggy = !!doc.getElementById(x);\n root.removeChild(a);\n return isBuggy;\n })() :\n true,\n\n // detect IE gEBTN comment nodes bug\n BUGGY_GEBTN = NATIVE_GEBTN ?\n (function() {\n var div = doc.createElement('div');\n div.appendChild(doc.createComment(''));\n return !!div.getElementsByTagName('*')[0];\n })() :\n true,\n\n // detect Opera gEBCN second class and/or UTF8 bugs as well as Safari 3.2\n // caching class name results and not detecting when changed,\n // tests are based on the jQuery selector test suite\n BUGGY_GEBCN = NATIVE_GEBCN ?\n (function() {\n var isBuggy, div = doc.createElement('div'), test = '\\u53f0\\u5317';\n\n // Opera tests\n div.appendChild(doc.createElement('span')).\n setAttribute('class', test + 'abc ' + test);\n div.appendChild(doc.createElement('span')).\n setAttribute('class', 'x');\n\n isBuggy = !div.getElementsByClassName(test)[0];\n\n // Safari test\n div.lastChild.className = test;\n return isBuggy || div.getElementsByClassName(test).length != 2;\n })() :\n true,\n\n // detect IE bug with dynamic attributes\n BUGGY_GET_ATTRIBUTE = NATIVE_GET_ATTRIBUTE ?\n (function() {\n var input = doc.createElement('input');\n input.setAttribute('value', 5);\n return input.defaultValue != 5;\n })() :\n true,\n\n // detect IE bug with non-standard boolean attributes\n BUGGY_HAS_ATTRIBUTE = NATIVE_HAS_ATTRIBUTE ?\n (function() {\n var option = doc.createElement('option');\n option.setAttribute('selected', 'selected');\n return !option.hasAttribute('selected');\n })() :\n true,\n\n // detect Safari bug with selected option elements\n BUGGY_SELECTED =\n (function() {\n var select = doc.createElement('select');\n select.appendChild(doc.createElement('option'));\n return !select.firstChild.selected;\n })(),\n\n // initialized with the loading context\n // and reset for each different context\n BUGGY_QUIRKS_GEBCN,\n BUGGY_QUIRKS_QSAPI,\n\n QUIRKS_MODE,\n XML_DOCUMENT,\n\n // detect Opera browser\n OPERA = /opera/i.test(string.call(global.opera)),\n\n // skip simple selector optimizations for Opera >= 11\n OPERA_QSAPI = OPERA && global.parseFloat(global.opera.version()) >= 11,\n\n // check Selector API implementations\n RE_BUGGY_QSAPI = NATIVE_QSAPI ?\n (function() {\n var pattern = new global.Array(), context, element,\n\n expect = function(selector, element, n) {\n var result = false;\n context.appendChild(element);\n try { result = context.querySelectorAll(selector).length == n; } catch(e) { }\n while (context.firstChild) { context.removeChild(context.firstChild); }\n return result;\n };\n\n // certain bugs can only be detected in standard documents\n // to avoid writing a live loading document create a fake one\n if (doc.implementation && doc.implementation.createDocument) {\n // use a shadow document body as context\n context = doc.implementation.createDocument('', '', null).\n appendChild(doc.createElement('html')).\n appendChild(doc.createElement('head')).parentNode.\n appendChild(doc.createElement('body'));\n } else {\n // use an unattached div node as context\n context = doc.createElement('div');\n }\n\n // fix for Safari 8.x and other engines that\n // fail querying filtered sibling combinators\n element = doc.createElement('div');\n element.innerHTML = '


';\n expect('p#a+*', element, 0) &&\n pattern.push('\\\\w+#\\\\w+.*[+~]');\n\n // ^= $= *= operators bugs with empty values (Opera 10 / IE8)\n element = doc.createElement('p');\n element.setAttribute('class', '');\n expect('[class^=\"\"]', element, 1) &&\n pattern.push('[*^$]=[\\\\x20\\\\t\\\\n\\\\r\\\\f]*(?:\"\"|' + \"'')\");\n\n // :checked bug with option elements (Firefox 3.6.x)\n // it wrongly includes 'selected' options elements\n // HTML5 rules says selected options also match\n element = doc.createElement('option');\n element.setAttribute('selected', 'selected');\n expect(':checked', element, 0) &&\n pattern.push(':checked');\n\n // :enabled :disabled bugs with hidden fields (Firefox 3.5)\n // http://www.w3.org/TR/html5/links.html#selector-enabled\n // http://www.w3.org/TR/css3-selectors/#enableddisabled\n // not supported by IE8 Query Selector\n element = doc.createElement('input');\n element.setAttribute('type', 'hidden');\n expect(':enabled', element, 0) &&\n pattern.push(':enabled', ':disabled');\n\n // :link bugs with hyperlinks matching (Firefox/Safari)\n element = doc.createElement('link');\n element.setAttribute('href', 'x');\n expect(':link', element, 1) ||\n pattern.push(':link');\n\n // avoid attribute selectors for IE QSA\n if (BUGGY_HAS_ATTRIBUTE) {\n // IE fails in reading:\n // - original values for input/textarea\n // - original boolean values for controls\n pattern.push('\\\\[[\\\\x20\\\\t\\\\n\\\\r\\\\f]*(?:checked|disabled|ismap|multiple|readonly|selected|value)');\n }\n\n return pattern.length ?\n new global.RegExp(pattern.join('|')) :\n { 'test': function() { return false; } };\n\n })() :\n true,\n\n // matches class selectors\n RE_CLASS = new global.RegExp('(?:\\\\[[\\\\x20\\\\t\\\\n\\\\r\\\\f]*class\\\\b|\\\\.' + identifier + ')'),\n\n // matches simple id, tag & class selectors\n RE_SIMPLE_SELECTOR = new global.RegExp(\n BUGGY_GEBTN && BUGGY_GEBCN || OPERA ?\n '^#?-?[_a-zA-Z]{1}' + encoding + '*$' : BUGGY_GEBTN ?\n '^[.#]?-?[_a-zA-Z]{1}' + encoding + '*$' : BUGGY_GEBCN ?\n '^(?:\\\\*|#-?[_a-zA-Z]{1}' + encoding + '*)$' :\n '^(?:\\\\*|[.#]?-?[_a-zA-Z]{1}' + encoding + '*)$'),\n\n /*----------------------------- LOOKUP OBJECTS -----------------------------*/\n\n LINK_NODES = new global.Object({ 'a': 1, 'A': 1, 'area': 1, 'AREA': 1, 'link': 1, 'LINK': 1 }),\n\n // boolean attributes should return attribute name instead of true/false\n ATTR_BOOLEAN = new global.Object({\n 'checked': 1, 'disabled': 1, 'ismap': 1,\n 'multiple': 1, 'readonly': 1, 'selected': 1\n }),\n\n // dynamic attributes that needs to be checked against original HTML value\n ATTR_DEFAULT = new global.Object({\n 'value': 'defaultValue',\n 'checked': 'defaultChecked',\n 'selected': 'defaultSelected'\n }),\n\n // attributes referencing URI data values need special treatment in IE\n ATTR_URIDATA = new global.Object({\n 'action': 2, 'cite': 2, 'codebase': 2, 'data': 2, 'href': 2,\n 'longdesc': 2, 'lowsrc': 2, 'src': 2, 'usemap': 2\n }),\n\n // HTML 5 draft specifications\n // http://www.whatwg.org/specs/web-apps/current-work/#selectors\n HTML_TABLE = new global.Object({\n // class attribute must be treated case-insensitive in HTML quirks mode\n // initialized by default to Standard Mode (case-sensitive),\n // set dynamically by the attribute resolver\n 'class': 0,\n 'accept': 1, 'accept-charset': 1, 'align': 1, 'alink': 1, 'axis': 1,\n 'bgcolor': 1, 'charset': 1, 'checked': 1, 'clear': 1, 'codetype': 1, 'color': 1,\n 'compact': 1, 'declare': 1, 'defer': 1, 'dir': 1, 'direction': 1, 'disabled': 1,\n 'enctype': 1, 'face': 1, 'frame': 1, 'hreflang': 1, 'http-equiv': 1, 'lang': 1,\n 'language': 1, 'link': 1, 'media': 1, 'method': 1, 'multiple': 1, 'nohref': 1,\n 'noresize': 1, 'noshade': 1, 'nowrap': 1, 'readonly': 1, 'rel': 1, 'rev': 1,\n 'rules': 1, 'scope': 1, 'scrolling': 1, 'selected': 1, 'shape': 1, 'target': 1,\n 'text': 1, 'type': 1, 'valign': 1, 'valuetype': 1, 'vlink': 1\n }),\n\n // the following attributes must be treated case-insensitive in XHTML mode\n // Niels Leenheer http://rakaz.nl/item/css_selector_bugs_case_sensitivity\n XHTML_TABLE = new global.Object({\n 'accept': 1, 'accept-charset': 1, 'alink': 1, 'axis': 1,\n 'bgcolor': 1, 'charset': 1, 'codetype': 1, 'color': 1,\n 'enctype': 1, 'face': 1, 'hreflang': 1, 'http-equiv': 1,\n 'lang': 1, 'language': 1, 'link': 1, 'media': 1, 'rel': 1,\n 'rev': 1, 'target': 1, 'text': 1, 'type': 1, 'vlink': 1\n }),\n\n /*-------------------------- REGULAR EXPRESSIONS ---------------------------*/\n\n // placeholder to add functionalities\n Selectors = new global.Object({\n // as a simple example this will check\n // for chars not in standard ascii table\n //\n // 'mySpecialSelector': {\n // 'Expression': /\\u0080-\\uffff/,\n // 'Callback': mySelectorCallback\n // }\n //\n // 'mySelectorCallback' will be invoked\n // only after passing all other standard\n // checks and only if none of them worked\n }),\n\n // attribute operators\n Operators = new global.Object({\n '=': \"n=='%m'\",\n '^=': \"n.indexOf('%m')==0\",\n '*=': \"n.indexOf('%m')>-1\",\n '|=': \"(n+'-').indexOf('%m-')==0\",\n '~=': \"(' '+n+' ').indexOf(' %m ')>-1\",\n '$=': \"n.substr(n.length-'%m'.length)=='%m'\"\n }),\n\n // optimization expressions\n Optimize = new global.Object({\n ID: new global.RegExp('^\\\\*?#(' + encoding + '+)|' + skipgroup),\n TAG: new global.RegExp('^(' + encoding + '+)|' + skipgroup),\n CLASS: new global.RegExp('^\\\\*?\\\\.(' + encoding + '+$)|' + skipgroup)\n }),\n\n // precompiled Regular Expressions\n Patterns = new global.Object({\n // structural pseudo-classes and child selectors\n spseudos: /^\\:(root|empty|(?:first|last|only)(?:-child|-of-type)|nth(?:-last)?(?:-child|-of-type)\\(\\s*(even|odd|(?:[-+]{0,1}\\d*n\\s*)?[-+]{0,1}\\s*\\d*)\\s*\\))?(.*)/i,\n // uistates + dynamic + negation pseudo-classes\n dpseudos: /^\\:(link|visited|target|active|focus|hover|checked|disabled|enabled|selected|lang\\(([-\\w]{2,})\\)|not\\(([^()]*|.*)\\))?(.*)/i,\n // element attribute matcher\n attribute: new global.RegExp('^\\\\[' + attrmatcher + '\\\\](.*)'),\n // E > F\n children: /^[\\x20\\t\\n\\r\\f]*\\>[\\x20\\t\\n\\r\\f]*(.*)/,\n // E + F\n adjacent: /^[\\x20\\t\\n\\r\\f]*\\+[\\x20\\t\\n\\r\\f]*(.*)/,\n // E ~ F\n relative: /^[\\x20\\t\\n\\r\\f]*\\~[\\x20\\t\\n\\r\\f]*(.*)/,\n // E F\n ancestor: /^[\\x20\\t\\n\\r\\f]+(.*)/,\n // all\n universal: /^\\*(.*)/,\n // id\n id: new global.RegExp('^#(' + encoding + '+)(.*)'),\n // tag\n tagName: new global.RegExp('^(' + encoding + '+)(.*)'),\n // class\n className: new global.RegExp('^\\\\.(' + encoding + '+)(.*)')\n }),\n\n /*------------------------------ UTIL METHODS ------------------------------*/\n\n // concat elements to data\n concatList =\n function(data, elements) {\n var i = -1, element;\n if (!data.length && global.Array.slice)\n return global.Array.slice(elements);\n while ((element = elements[++i]))\n data[data.length] = element;\n return data;\n },\n\n // concat elements to data and callback\n concatCall =\n function(data, elements, callback) {\n var i = -1, element;\n while ((element = elements[++i])) {\n if (false === callback(data[data.length] = element)) { break; }\n }\n return data;\n },\n\n // change context specific variables\n switchContext =\n function(from, force) {\n var div, oldDoc = doc;\n // save passed context\n lastContext = from;\n // set new context document\n doc = from.ownerDocument || from;\n if (force || oldDoc !== doc) {\n // set document root\n root = doc.documentElement;\n // set host environment flags\n XML_DOCUMENT = doc.createElement('DiV').nodeName == 'DiV';\n\n // In quirks mode css class names are case insensitive.\n // In standards mode they are case sensitive. See docs:\n // https://developer.mozilla.org/en/Mozilla_Quirks_Mode_Behavior\n // http://www.whatwg.org/specs/web-apps/current-work/#selectors\n QUIRKS_MODE = !XML_DOCUMENT &&\n typeof doc.compatMode == 'string' ?\n doc.compatMode.indexOf('CSS') < 0 :\n (function() {\n var style = doc.createElement('div').style;\n return style && (style.width = 1) && style.width == '1px';\n })();\n\n div = doc.createElement('div');\n div.appendChild(doc.createElement('p')).setAttribute('class', 'xXx');\n div.appendChild(doc.createElement('p')).setAttribute('class', 'xxx');\n\n // GEBCN buggy in quirks mode, match count is:\n // Firefox 3.0+ [xxx = 1, xXx = 1]\n // Opera 10.63+ [xxx = 0, xXx = 2]\n BUGGY_QUIRKS_GEBCN =\n !XML_DOCUMENT && NATIVE_GEBCN && QUIRKS_MODE &&\n (div.getElementsByClassName('xxx').length != 2 ||\n div.getElementsByClassName('xXx').length != 2);\n\n // QSAPI buggy in quirks mode, match count is:\n // At least Chrome 4+, Firefox 3.5+, Opera 10.x+, Safari 4+ [xxx = 1, xXx = 2]\n // Safari 3.2 QSA doesn't work with mixedcase in quirksmode [xxx = 1, xXx = 0]\n // https://bugs.webkit.org/show_bug.cgi?id=19047\n // must test the attribute selector '[class~=xxx]'\n // before '.xXx' or the bug may not present itself\n BUGGY_QUIRKS_QSAPI =\n !XML_DOCUMENT && NATIVE_QSAPI && QUIRKS_MODE &&\n (div.querySelectorAll('[class~=xxx]').length != 2 ||\n div.querySelectorAll('.xXx').length != 2);\n\n Config.CACHING && Dom.setCache(true, doc);\n }\n },\n\n // convert a CSS string or identifier containing escape sequence to a\n // javascript string with javascript escape sequences\n convertEscapes =\n function(str) {\n return str.replace(/\\\\([0-9a-fA-F]{1,6}\\x20?|.)|([\\x22\\x27])/g, function(substring, p1, p2) {\n var codePoint, highHex, highSurrogate, lowHex, lowSurrogate;\n\n if (p2) {\n // unescaped \" or '\n return '\\\\' + p2;\n }\n\n if (/^[0-9a-fA-F]/.test(p1)) {\n // \\1f23\n codePoint = parseInt(p1, 16);\n\n if (codePoint < 0 || codePoint > 0x10ffff) {\n // the replacement character\n return '\\\\ufffd';\n }\n\n // javascript strings are in UTF-16\n if (codePoint <= 0xffff) {\n // Basic\n lowHex = '000' + codePoint.toString(16);\n return '\\\\u' + lowHex.substr(lowHex.length - 4);\n }\n\n // Supplementary\n codePoint -= 0x10000;\n highSurrogate = (codePoint >> 10) + 0xd800;\n lowSurrogate = (codePoint % 0x400) + 0xdc00;\n highHex = '000' + highSurrogate.toString(16);\n lowHex = '000' + lowSurrogate.toString(16);\n\n return '\\\\u' + highHex.substr(highHex.length - 4) +\n '\\\\u' + lowHex.substr(lowHex.length - 4);\n }\n\n if (/^[\\\\\\x22\\x27]/.test(p1)) {\n // \\' \\\"\n return substring;\n }\n\n // \\g \\h \\. \\# etc\n return p1;\n });\n },\n\n /*------------------------------ DOM METHODS -------------------------------*/\n\n // element by id (raw)\n // @return reference or null\n byIdRaw =\n function(id, elements) {\n var i = -1, element = null;\n while ((element = elements[++i])) {\n if (element.getAttribute('id') == id) {\n break;\n }\n }\n return element;\n },\n\n // element by id\n // @return reference or null\n _byId = !BUGGY_GEBID ?\n function(id, from) {\n id = id.replace(/\\\\([^\\\\]{1})/g, '$1');\n return from.getElementById && from.getElementById(id) ||\n byIdRaw(id, from.getElementsByTagName('*'));\n } :\n function(id, from) {\n var element = null;\n id = id.replace(/\\\\([^\\\\]{1})/g, '$1');\n if (XML_DOCUMENT || from.nodeType != 9) {\n return byIdRaw(id, from.getElementsByTagName('*'));\n }\n if ((element = from.getElementById(id)) &&\n element.name == id && from.getElementsByName) {\n return byIdRaw(id, from.getElementsByName(id));\n }\n return element;\n },\n\n // publicly exposed byId\n // @return reference or null\n byId =\n function(id, from) {\n from || (from = doc);\n if (lastContext !== from) { switchContext(from); }\n return _byId(id, from);\n },\n\n // elements by tag (raw)\n // @return array\n byTagRaw =\n function(tag, from) {\n var any = tag == '*', element = from, elements = new global.Array(), next = element.firstChild;\n any || (tag = tag.toUpperCase());\n while ((element = next)) {\n if (element.tagName > '@' && (any || element.tagName.toUpperCase() == tag)) {\n elements[elements.length] = element;\n }\n if ((next = element.firstChild || element.nextSibling)) continue;\n while (!next && (element = element.parentNode) && element !== from) {\n next = element.nextSibling;\n }\n }\n return elements;\n },\n\n // elements by tag\n // @return array\n _byTag = !BUGGY_GEBTN && NATIVE_SLICE_PROTO ?\n function(tag, from) {\n return XML_DOCUMENT || from.nodeType == 11 ? byTagRaw(tag, from) :\n slice.call(from.getElementsByTagName(tag), 0);\n } :\n function(tag, from) {\n var i = -1, j = i, data = new global.Array(),\n element, elements = from.getElementsByTagName(tag);\n if (tag == '*') {\n while ((element = elements[++i])) {\n if (element.nodeName > '@')\n data[++j] = element;\n }\n } else {\n while ((element = elements[++i])) {\n data[i] = element;\n }\n }\n return data;\n },\n\n // publicly exposed byTag\n // @return array\n byTag =\n function(tag, from) {\n from || (from = doc);\n if (lastContext !== from) { switchContext(from); }\n return _byTag(tag, from);\n },\n\n // publicly exposed byName\n // @return array\n byName =\n function(name, from) {\n return select('[name=\"' + name.replace(/\\\\([^\\\\]{1})/g, '$1') + '\"]', from);\n },\n\n // elements by class (raw)\n // @return array\n byClassRaw =\n function(name, from) {\n var i = -1, j = i, data = new global.Array(), element, elements = _byTag('*', from), n;\n name = ' ' + (QUIRKS_MODE ? name.toLowerCase() : name).replace(/\\\\([^\\\\]{1})/g, '$1') + ' ';\n while ((element = elements[++i])) {\n n = XML_DOCUMENT ? element.getAttribute('class') : element.className;\n if (n && n.length && (' ' + (QUIRKS_MODE ? n.toLowerCase() : n).\n replace(reWhiteSpace, ' ') + ' ').indexOf(name) > -1) {\n data[++j] = element;\n }\n }\n return data;\n },\n\n // elements by class\n // @return array\n _byClass =\n function(name, from) {\n return (BUGGY_GEBCN || BUGGY_QUIRKS_GEBCN || XML_DOCUMENT || !from.getElementsByClassName) ?\n byClassRaw(name, from) : slice.call(from.getElementsByClassName(name.replace(/\\\\([^\\\\]{1})/g, '$1')), 0);\n },\n\n // publicly exposed byClass\n // @return array\n byClass =\n function(name, from) {\n from || (from = doc);\n if (lastContext !== from) { switchContext(from); }\n return _byClass(name, from);\n },\n\n // check element is descendant of container\n // @return boolean\n contains = 'compareDocumentPosition' in root ?\n function(container, element) {\n return (container.compareDocumentPosition(element) & 16) == 16;\n } : 'contains' in root ?\n function(container, element) {\n return container !== element && container.contains(element);\n } :\n function(container, element) {\n while ((element = element.parentNode)) {\n if (element === container) return true;\n }\n return false;\n },\n\n // attribute value\n // @return string\n getAttribute = !BUGGY_GET_ATTRIBUTE ?\n function(node, attribute) {\n return node.getAttribute(attribute);\n } :\n function(node, attribute) {\n attribute = attribute.toLowerCase();\n if (typeof node[attribute] == 'object') {\n return node.attributes[attribute] &&\n node.attributes[attribute].value;\n }\n return (\n // 'type' can only be read by using native getAttribute\n attribute == 'type' ? node.getAttribute(attribute) :\n // specific URI data attributes (parameter 2 to fix IE bug)\n ATTR_URIDATA[attribute] ? node.getAttribute(attribute, 2) :\n // boolean attributes should return name instead of true/false\n ATTR_BOOLEAN[attribute] ? node.getAttribute(attribute) ? attribute : 'false' :\n (node = node.getAttributeNode(attribute)) && node.value);\n },\n\n // attribute presence\n // @return boolean\n hasAttribute = !BUGGY_HAS_ATTRIBUTE ?\n function(node, attribute) {\n return XML_DOCUMENT ?\n !!node.getAttribute(attribute) :\n node.hasAttribute(attribute);\n } :\n function(node, attribute) {\n // read the node attribute object\n var obj = node.getAttributeNode(attribute = attribute.toLowerCase());\n return ATTR_DEFAULT[attribute] && attribute != 'value' ?\n node[ATTR_DEFAULT[attribute]] : obj && obj.specified;\n },\n\n // check node emptyness\n // @return boolean\n isEmpty =\n function(node) {\n node = node.firstChild;\n while (node) {\n if (node.nodeType == 3 || node.nodeName > '@') return false;\n node = node.nextSibling;\n }\n return true;\n },\n\n // check if element matches the :link pseudo\n // @return boolean\n isLink =\n function(element) {\n return hasAttribute(element,'href') && LINK_NODES[element.nodeName];\n },\n\n // child position by nodeType\n // @return number\n nthElement =\n function(element, last) {\n var count = 1, succ = last ? 'nextSibling' : 'previousSibling';\n while ((element = element[succ])) {\n if (element.nodeName > '@') ++count;\n }\n return count;\n },\n\n // child position by nodeName\n // @return number\n nthOfType =\n function(element, last) {\n var count = 1, succ = last ? 'nextSibling' : 'previousSibling', type = element.nodeName;\n while ((element = element[succ])) {\n if (element.nodeName == type) ++count;\n }\n return count;\n },\n\n /*------------------------------- DEBUGGING --------------------------------*/\n\n // get/set (string/object) working modes\n configure =\n function(option) {\n if (typeof option == 'string') { return Config[option] || Config; }\n if (typeof option != 'object') { return false; }\n for (var i in option) {\n Config[i] = !!option[i];\n if (i == 'SIMPLENOT') {\n matchContexts = new global.Object();\n matchResolvers = new global.Object();\n selectContexts = new global.Object();\n selectResolvers = new global.Object();\n if (!Config[i]) { Config['USE_QSAPI'] = false; }\n } else if (i == 'USE_QSAPI') {\n Config[i] = !!option[i] && NATIVE_QSAPI;\n }\n }\n reValidator = new global.RegExp(Config.SIMPLENOT ?\n standardValidator : extendedValidator, 'g');\n return true;\n },\n\n // control user notifications\n emit =\n function(message) {\n if (Config.VERBOSITY) { throw new global.Error(message); }\n if (global.console && global.console.log) {\n global.console.log(message);\n }\n },\n\n Config = new global.Object({\n\n // used to enable/disable caching of result sets\n CACHING: false,\n\n // by default do not add missing left/right context\n // to selector string shortcuts like \"+div\" or \"ul>\"\n // callable Dom.shortcuts method has to be available\n SHORTCUTS: false,\n\n // by default disable complex selectors nested in\n // ':not()' pseudo-classes, as for specifications\n SIMPLENOT: true,\n\n // strict QSA match all non-unique IDs (false)\n // speed & libs compat match unique ID (true)\n UNIQUE_ID: true,\n\n // HTML5 handling for the \":checked\" pseudo-class\n USE_HTML5: true,\n\n // controls enabling the Query Selector API branch\n USE_QSAPI: NATIVE_QSAPI,\n\n // controls the engine error/warning notifications\n VERBOSITY: true\n\n }),\n\n /*---------------------------- COMPILER METHODS ----------------------------*/\n\n // code string reused to build compiled functions\n ACCEPT_NODE = 'r[r.length]=c[k];if(f&&false===f(c[k]))break main;else continue main;',\n\n // compile a comma separated group of selector\n // @mode boolean true for select, false for match\n // return a compiled function\n compile =\n function(selector, source, mode) {\n\n var parts = typeof selector == 'string' ? selector.match(reSplitGroup) : selector;\n\n // ensures that source is a string\n typeof source == 'string' || (source = '');\n\n if (parts.length == 1) {\n source += compileSelector(parts[0], mode ? ACCEPT_NODE : 'f&&f(k);return true;', mode);\n } else {\n // for each selector in the group\n var i = -1, seen = new global.Object(), token;\n while ((token = parts[++i])) {\n token = token.replace(reTrimSpaces, '');\n // avoid repeating the same token\n // in comma separated group (p, p)\n if (!seen[token] && (seen[token] = true)) {\n source += compileSelector(token, mode ? ACCEPT_NODE : 'f&&f(k);return true;', mode);\n }\n }\n }\n\n if (mode) {\n // for select method\n return new global.Function('c,s,r,d,h,g,f,v',\n 'var N,n,x=0,k=-1,e;main:while((e=c[++k])){' + source + '}return r;');\n } else {\n // for match method\n return new global.Function('e,s,r,d,h,g,f,v',\n 'var N,n,x=0,k=e;' + source + 'return false;');\n }\n },\n\n // allows to cache already visited nodes\n FILTER =\n 'var z=v[@]||(v[@]=[]),l=z.length-1;' +\n 'while(l>=0&&z[l]!==e)--l;' +\n 'if(l!==-1){break;}' +\n 'z[z.length]=e;',\n\n // compile a CSS3 string selector into ad-hoc javascript matching function\n // @return string (to be compiled)\n compileSelector =\n function(selector, source, mode) {\n\n var a, b, n, k = 0, expr, match, result, status, test, type;\n\n while (selector) {\n\n k++;\n\n // *** Universal selector\n // * match all (empty block, do not remove)\n if ((match = selector.match(Patterns.universal))) {\n // do nothing, handled in the compiler where\n // BUGGY_GEBTN return comment nodes (ex: IE)\n expr = '';\n }\n\n // *** ID selector\n // #Foo Id case sensitive\n else if ((match = selector.match(Patterns.id))) {\n // document can contain conflicting elements (id/name)\n // prototype selector unit need this method to recover bad HTML forms\n source = 'if(' + (XML_DOCUMENT ?\n 's.getAttribute(e,\"id\")' :\n '(e.submit?s.getAttribute(e,\"id\"):e.id)') +\n '==\"' + match[1] + '\"' +\n '){' + source + '}';\n }\n\n // *** Type selector\n // Foo Tag (case insensitive)\n else if ((match = selector.match(Patterns.tagName))) {\n // both tagName and nodeName properties may be upper/lower case\n // depending on their creation NAMESPACE in createElementNS()\n source = 'if(e.nodeName' + (XML_DOCUMENT ?\n '==\"' + match[1] + '\"' : '.toUpperCase()' +\n '==\"' + match[1].toUpperCase() + '\"') +\n '){' + source + '}';\n }\n\n // *** Class selector\n // .Foo Class (case sensitive)\n else if ((match = selector.match(Patterns.className))) {\n // W3C CSS3 specs: element whose \"class\" attribute has been assigned a\n // list of whitespace-separated values, see section 6.4 Class selectors\n // and notes at the bottom; explicitly non-normative in this specification.\n source = 'if((n=' + (XML_DOCUMENT ?\n 's.getAttribute(e,\"class\")' : 'e.className') +\n ')&&n.length&&(\" \"+' + (QUIRKS_MODE ? 'n.toLowerCase()' : 'n') +\n '.replace(' + reWhiteSpace + ',\" \")+\" \").indexOf(\" ' +\n (QUIRKS_MODE ? match[1].toLowerCase() : match[1]) + ' \")>-1' +\n '){' + source + '}';\n }\n\n // *** Attribute selector\n // [attr] [attr=value] [attr=\"value\"] [attr='value'] and !=, *=, ~=, |=, ^=, $=\n // case sensitivity is treated differently depending on the document type (see map)\n else if ((match = selector.match(Patterns.attribute))) {\n\n // xml namespaced attribute ?\n expr = match[1].split(':');\n expr = expr.length == 2 ? expr[1] : expr[0] + '';\n\n if (match[2] && !Operators[match[2]]) {\n emit('Unsupported operator in attribute selectors \"' + selector + '\"');\n return '';\n }\n\n test = 'false';\n\n // replace Operators parameter if needed\n if (match[2] && match[4] && (test = Operators[match[2]])) {\n match[4] = convertEscapes(match[4]);\n // case treatment depends on document\n HTML_TABLE['class'] = QUIRKS_MODE ? 1 : 0;\n type = (XML_DOCUMENT ? XHTML_TABLE : HTML_TABLE)[expr.toLowerCase()];\n test = test.replace(/\\%m/g, type ? match[4].toLowerCase() : match[4]);\n } else if (match[2] == '!=' || match[2] == '=') {\n test = 'n' + match[2] + '=\"\"';\n }\n\n source = 'if(n=s.hasAttribute(e,\"' + match[1] + '\")){' +\n (match[2] ? 'n=s.getAttribute(e,\"' + match[1] + '\")' : '') +\n (type && match[2] ? '.toLowerCase();' : ';') +\n 'if(' + (match[2] ? test : 'n') + '){' + source + '}}';\n\n }\n\n // *** Adjacent sibling combinator\n // E + F (F adiacent sibling of E)\n else if ((match = selector.match(Patterns.adjacent))) {\n source = (mode ? '' : FILTER.replace(/@/g, k)) + source;\n source = NATIVE_TRAVERSAL_API ?\n 'var N' + k + '=e;while(e&&(e=e.previousElementSibling)){' + source + 'break;}e=N' + k + ';' :\n 'var N' + k + '=e;while(e&&(e=e.previousSibling)){if(e.nodeName>\"@\"){' + source + 'break;}}e=N' + k + ';';\n }\n\n // *** General sibling combinator\n // E ~ F (F relative sibling of E)\n else if ((match = selector.match(Patterns.relative))) {\n source = (mode ? '' : FILTER.replace(/@/g, k)) + source;\n source = NATIVE_TRAVERSAL_API ?\n ('var N' + k + '=e;e=e.parentNode.firstElementChild;' +\n 'while(e&&e!==N' + k + '){' + source + 'e=e.nextElementSibling;}e=N' + k + ';') :\n ('var N' + k + '=e;e=e.parentNode.firstChild;' +\n 'while(e&&e!==N' + k + '){if(e.nodeName>\"@\"){' + source + '}e=e.nextSibling;}e=N' + k + ';');\n }\n\n // *** Child combinator\n // E > F (F children of E)\n else if ((match = selector.match(Patterns.children))) {\n source = (mode ? '' : FILTER.replace(/@/g, k)) + source;\n source = 'var N' + k + '=e;while(e&&e!==h&&e!==g&&(e=e.parentNode)){' + source + 'break;}e=N' + k + ';';\n }\n\n // *** Descendant combinator\n // E F (E ancestor of F)\n else if ((match = selector.match(Patterns.ancestor))) {\n source = (mode ? '' : FILTER.replace(/@/g, k)) + source;\n source = 'var N' + k + '=e;while(e&&e!==h&&e!==g&&(e=e.parentNode)){' + source + '}e=N' + k + ';';\n }\n\n // *** Structural pseudo-classes\n // :root, :empty,\n // :first-child, :last-child, :only-child,\n // :first-of-type, :last-of-type, :only-of-type,\n // :nth-child(), :nth-last-child(), :nth-of-type(), :nth-last-of-type()\n else if ((match = selector.match(Patterns.spseudos)) && match[1]) {\n\n switch (match[1]) {\n case 'root':\n // element root of the document\n if (match[3]) {\n source = 'if(e===h||s.contains(h,e)){' + source + '}';\n } else {\n source = 'if(e===h){' + source + '}';\n }\n break;\n\n case 'empty':\n // element that has no children\n source = 'if(s.isEmpty(e)){' + source + '}';\n break;\n\n default:\n if (match[1] && match[2]) {\n if (match[2] == 'n') {\n source = 'if(e!==h){' + source + '}';\n break;\n } else if (match[2] == 'even') {\n a = 2;\n b = 0;\n } else if (match[2] == 'odd') {\n a = 2;\n b = 1;\n } else {\n // assumes correct \"an+b\" format, \"b\" before \"a\" to keep \"n\" values\n b = ((n = match[2].match(/(-?\\d+)$/)) ? global.parseInt(n[1], 10) : 0);\n a = ((n = match[2].match(/(-?\\d*)n/i)) ? global.parseInt(n[1], 10) : 0);\n if (n && n[1] == '-') a = -1;\n }\n\n // build test expression out of structural pseudo (an+b) parameters\n // see here: http://www.w3.org/TR/css3-selectors/#nth-child-pseudo\n test = a > 1 ?\n (/last/i.test(match[1])) ? '(n-(' + b + '))%' + a + '==0' :\n 'n>=' + b + '&&(n-(' + b + '))%' + a + '==0' : a < -1 ?\n (/last/i.test(match[1])) ? '(n-(' + b + '))%' + a + '==0' :\n 'n<=' + b + '&&(n-(' + b + '))%' + a + '==0' : a === 0 ?\n 'n==' + b : a == -1 ? 'n<=' + b : 'n>=' + b;\n\n // 4 cases: 1 (nth) x 4 (child, of-type, last-child, last-of-type)\n source =\n 'if(e!==h){' +\n 'n=s[' + (/-of-type/i.test(match[1]) ? '\"nthOfType\"' : '\"nthElement\"') + ']' +\n '(e,' + (/last/i.test(match[1]) ? 'true' : 'false') + ');' +\n 'if(' + test + '){' + source + '}' +\n '}';\n\n } else {\n // 6 cases: 3 (first, last, only) x 1 (child) x 2 (-of-type)\n a = /first/i.test(match[1]) ? 'previous' : 'next';\n n = /only/i.test(match[1]) ? 'previous' : 'next';\n b = /first|last/i.test(match[1]);\n\n type = /-of-type/i.test(match[1]) ? '&&n.nodeName!=e.nodeName' : '&&n.nodeName<\"@\"';\n\n source = 'if(e!==h){' +\n ( 'n=e;while((n=n.' + a + 'Sibling)' + type + ');if(!n){' + (b ? source :\n 'n=e;while((n=n.' + n + 'Sibling)' + type + ');if(!n){' + source + '}') + '}' ) + '}';\n }\n break;\n }\n\n }\n\n // *** negation, user action and target pseudo-classes\n // *** UI element states and dynamic pseudo-classes\n // CSS3 :not, :checked, :enabled, :disabled, :target\n // CSS3 :active, :hover, :focus\n // CSS3 :link, :visited\n else if ((match = selector.match(Patterns.dpseudos)) && match[1]) {\n\n switch (match[1].match(/^\\w+/)[0]) {\n // CSS3 negation pseudo-class\n case 'not':\n // compile nested selectors, DO NOT pass the callback parameter\n // SIMPLENOT allow disabling complex selectors nested\n // in ':not()' pseudo-classes, breaks some test units\n expr = match[3].replace(reTrimSpaces, '');\n\n if (Config.SIMPLENOT && !reSimpleNot.test(expr)) {\n // see above, log error but continue execution\n emit('Negation pseudo-class only accepts simple selectors \"' + selector + '\"');\n return '';\n } else {\n if ('compatMode' in doc) {\n source = 'if(!' + compile(expr, '', false) + '(e,s,r,d,h,g)){' + source + '}';\n } else {\n source = 'if(!s.match(e, \"' + expr.replace(/\\x22/g, '\\\\\"') + '\",g)){' + source +'}';\n }\n }\n break;\n\n // CSS3 UI element states\n case 'checked':\n // for radio buttons checkboxes (HTML4) and options (HTML5)\n source = 'if((typeof e.form!==\"undefined\"&&(/^(?:radio|checkbox)$/i).test(e.type)&&e.checked)' +\n (Config.USE_HTML5 ? '||(/^option$/i.test(e.nodeName)&&(e.selected||e.checked))' : '') +\n '){' + source + '}';\n break;\n case 'disabled':\n // does not consider hidden input fields\n source = 'if(((typeof e.form!==\"undefined\"' +\n (Config.USE_HTML5 ? '' : '&&!(/^hidden$/i).test(e.type)') +\n ')||s.isLink(e))&&e.disabled===true){' + source + '}';\n break;\n case 'enabled':\n // does not consider hidden input fields\n source = 'if(((typeof e.form!==\"undefined\"' +\n (Config.USE_HTML5 ? '' : '&&!(/^hidden$/i).test(e.type)') +\n ')||s.isLink(e))&&e.disabled===false){' + source + '}';\n break;\n\n // CSS3 lang pseudo-class\n case 'lang':\n test = '';\n if (match[2]) test = match[2].substr(0, 2) + '-';\n source = 'do{(n=e.lang||\"\").toLowerCase();' +\n 'if((n==\"\"&&h.lang==\"' + match[2].toLowerCase() + '\")||' +\n '(n&&(n==\"' + match[2].toLowerCase() +\n '\"||n.substr(0,3)==\"' + test.toLowerCase() + '\")))' +\n '{' + source + 'break;}}while((e=e.parentNode)&&e!==g);';\n break;\n\n // CSS3 target pseudo-class\n case 'target':\n source = 'if(e.id==d.location.hash.slice(1)){' + source + '}';\n break;\n\n // CSS3 dynamic pseudo-classes\n case 'link':\n source = 'if(s.isLink(e)&&!e.visited){' + source + '}';\n break;\n case 'visited':\n source = 'if(s.isLink(e)&&e.visited){' + source + '}';\n break;\n\n // CSS3 user action pseudo-classes IE & FF3 have native support\n // these capabilities may be emulated by some event managers\n case 'active':\n if (XML_DOCUMENT) break;\n source = 'if(e===d.activeElement){' + source + '}';\n break;\n case 'hover':\n if (XML_DOCUMENT) break;\n source = 'if(e===d.hoverElement){' + source + '}';\n break;\n case 'focus':\n if (XML_DOCUMENT) break;\n source = NATIVE_FOCUS ?\n 'if(e===d.activeElement&&d.hasFocus()&&(e.type||e.href||typeof e.tabIndex==\"number\")){' + source + '}' :\n 'if(e===d.activeElement&&(e.type||e.href)){' + source + '}';\n break;\n\n // CSS2 selected pseudo-classes, not part of current CSS3 drafts\n // the 'selected' property is only available for option elements\n case 'selected':\n // fix Safari selectedIndex property bug\n expr = BUGGY_SELECTED ? '||(n=e.parentNode)&&n.options[n.selectedIndex]===e' : '';\n source = 'if(/^option$/i.test(e.nodeName)&&(e.selected||e.checked' + expr + ')){' + source + '}';\n break;\n\n default:\n break;\n }\n\n }\n\n else {\n\n // this is where external extensions are\n // invoked if expressions match selectors\n expr = false;\n status = false;\n for (expr in Selectors) {\n if ((match = selector.match(Selectors[expr].Expression)) && match[1]) {\n result = Selectors[expr].Callback(match, source);\n source = result.source;\n status = result.status;\n if (status) { break; }\n }\n }\n\n // if an extension fails to parse the selector\n // it must return a false boolean in \"status\"\n if (!status) {\n // log error but continue execution, don't throw real exceptions\n // because blocking following processes maybe is not a good idea\n emit('Unknown pseudo-class selector \"' + selector + '\"');\n return '';\n }\n\n if (!expr) {\n // see above, log error but continue execution\n emit('Unknown token in selector \"' + selector + '\"');\n return '';\n }\n\n }\n\n // error if no matches found by the pattern scan\n if (!match) {\n emit('Invalid syntax in selector \"' + selector + '\"');\n return '';\n }\n\n // ensure \"match\" is not null or empty since\n // we do not throw real DOMExceptions above\n selector = match && match[match.length - 1];\n }\n\n return source;\n },\n\n /*----------------------------- QUERY METHODS ------------------------------*/\n\n // match element with selector\n // @return boolean\n match =\n function(element, selector, from, callback) {\n\n var parts;\n\n if (!(element && element.nodeType == 1)) {\n emit('Invalid element argument');\n return false;\n } else if (typeof selector != 'string') {\n emit('Invalid selector argument');\n return false;\n } else if (from && from.nodeType == 1 && !contains(from, element)) {\n return false;\n } else if (lastContext !== from) {\n // reset context data when it changes\n // and ensure context is set to a default\n switchContext(from || (from = element.ownerDocument));\n }\n\n selector = selector.replace(reTrimSpaces, '');\n\n Config.SHORTCUTS && (selector = Dom.shortcuts(selector, element, from));\n\n if (lastMatcher != selector) {\n // process valid selector strings\n if ((parts = selector.match(reValidator)) && parts[0] == selector) {\n isSingleMatch = (parts = selector.match(reSplitGroup)).length < 2;\n // save passed selector\n lastMatcher = selector;\n lastPartsMatch = parts;\n } else {\n emit('The string \"' + selector + '\", is not a valid CSS selector');\n return false;\n }\n } else parts = lastPartsMatch;\n\n // compile matcher resolvers if necessary\n if (!matchResolvers[selector] || matchContexts[selector] !== from) {\n matchResolvers[selector] = compile(isSingleMatch ? [selector] : parts, '', false);\n matchContexts[selector] = from;\n }\n\n return matchResolvers[selector](element, Snapshot, [ ], doc, root, from, callback, new global.Object());\n },\n\n // select only the first element\n // matching selector (document ordered)\n first =\n function(selector, from) {\n return select(selector, from, function() { return false; })[0] || null;\n },\n\n // select elements matching selector\n // using new Query Selector API\n // or cross-browser client API\n // @return array\n select =\n function(selector, from, callback) {\n\n var i, changed, element, elements, parts, token, original = selector;\n\n if (arguments.length === 0) {\n emit('Not enough arguments');\n return [ ];\n } else if (typeof selector != 'string') {\n return [ ];\n } else if (from && !(/1|9|11/).test(from.nodeType)) {\n emit('Invalid or illegal context element');\n return [ ];\n } else if (lastContext !== from) {\n // reset context data when it changes\n // and ensure context is set to a default\n switchContext(from || (from = doc));\n }\n\n if (Config.CACHING && (elements = Dom.loadResults(original, from, doc, root))) {\n return callback ? concatCall([ ], elements, callback) : elements;\n }\n\n if (!OPERA_QSAPI && RE_SIMPLE_SELECTOR.test(selector)) {\n switch (selector.charAt(0)) {\n case '#':\n if (Config.UNIQUE_ID) {\n elements = (element = _byId(selector.slice(1), from)) ? [ element ] : [ ];\n }\n break;\n case '.':\n elements = _byClass(selector.slice(1), from);\n break;\n default:\n elements = _byTag(selector, from);\n break;\n }\n }\n\n else if (!XML_DOCUMENT && Config.USE_QSAPI &&\n !(BUGGY_QUIRKS_QSAPI && RE_CLASS.test(selector)) &&\n !RE_BUGGY_QSAPI.test(selector)) {\n try {\n elements = from.querySelectorAll(selector);\n } catch(e) { }\n }\n\n if (elements) {\n elements = callback ? concatCall([ ], elements, callback) :\n NATIVE_SLICE_PROTO ? slice.call(elements) : concatList([ ], elements);\n Config.CACHING && Dom.saveResults(original, from, doc, elements);\n return elements;\n }\n\n selector = selector.replace(reTrimSpaces, '');\n\n Config.SHORTCUTS && (selector = Dom.shortcuts(selector, from));\n\n if ((changed = lastSelector != selector)) {\n // process valid selector strings\n if ((parts = selector.match(reValidator)) && parts[0] == selector) {\n isSingleSelect = (parts = selector.match(reSplitGroup)).length < 2;\n // save passed selector\n lastSelector = selector;\n lastPartsSelect = parts;\n } else {\n emit('The string \"' + selector + '\", is not a valid CSS selector');\n return [ ];\n }\n } else parts = lastPartsSelect;\n\n // commas separators are treated sequentially to maintain order\n if (from.nodeType == 11) {\n\n elements = byTagRaw('*', from);\n\n } else if (!XML_DOCUMENT && isSingleSelect) {\n\n if (changed) {\n // get right most selector token\n parts = selector.match(reSplitToken);\n token = parts[parts.length - 1];\n\n // only last slice before :not rules\n lastSlice = token.split(':not')[0];\n\n // position where token was found\n lastPosition = selector.length - token.length;\n }\n\n // ID optimization RTL, to reduce number of elements to visit\n if (Config.UNIQUE_ID && (parts = lastSlice.match(Optimize.ID)) && (token = parts[1])) {\n if ((element = _byId(token, from))) {\n if (match(element, selector)) {\n callback && callback(element);\n elements = new global.Array(element);\n } else elements = new global.Array();\n }\n }\n\n // ID optimization LTR, to reduce selection context searches\n else if (Config.UNIQUE_ID && (parts = selector.match(Optimize.ID)) && (token = parts[1])) {\n if ((element = _byId(token, doc))) {\n if ('#' + token == selector) {\n callback && callback(element);\n elements = new global.Array(element);\n } else if (/[>+~]/.test(selector)) {\n from = element.parentNode;\n } else {\n from = element;\n }\n } else elements = new global.Array();\n }\n\n if (elements) {\n Config.CACHING && Dom.saveResults(original, from, doc, elements);\n return elements;\n }\n\n if (!NATIVE_GEBCN && (parts = lastSlice.match(Optimize.TAG)) && (token = parts[1])) {\n if ((elements = _byTag(token, from)).length === 0) { return [ ]; }\n selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace(token, '*');\n }\n\n else if ((parts = lastSlice.match(Optimize.CLASS)) && (token = parts[1])) {\n if ((elements = _byClass(token, from)).length === 0) { return [ ]; }\n if (reOptimizeSelector.test(selector.charAt(selector.indexOf(token) - 1))) {\n selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, '');\n } else {\n selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, '*');\n }\n }\n\n else if ((parts = selector.match(Optimize.CLASS)) && (token = parts[1])) {\n if ((elements = _byClass(token, from)).length === 0) { return [ ]; }\n for (i = 0, els = new global.Array(); elements.length > i; ++i) {\n els = concatList(els, elements[i].getElementsByTagName('*'));\n }\n elements = els;\n if (reOptimizeSelector.test(selector.charAt(selector.indexOf(token) - 1))) {\n selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, '');\n } else {\n selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace('.' + token, '*');\n }\n }\n\n else if (NATIVE_GEBCN && (parts = lastSlice.match(Optimize.TAG)) && (token = parts[1])) {\n if ((elements = _byTag(token, from)).length === 0) { return [ ]; }\n selector = selector.slice(0, lastPosition) + selector.slice(lastPosition).replace(token, '*');\n }\n\n }\n\n if (!elements) {\n elements = /^(?:applet|object)$/i.test(from.nodeName) ? from.childNodes : _byTag('*', from);\n }\n // end of prefiltering pass\n\n // compile selector resolver if necessary\n if (!selectResolvers[selector] || selectContexts[selector] !== from) {\n selectResolvers[selector] = compile(isSingleSelect ? [selector] : parts, '', true);\n selectContexts[selector] = from;\n }\n\n elements = selectResolvers[selector](elements, Snapshot, [ ], doc, root, from, callback, new global.Object());\n\n Config.CACHING && Dom.saveResults(original, from, doc, elements);\n\n return elements;\n },\n\n /*-------------------------------- STORAGE ---------------------------------*/\n\n // empty function handler\n FN = function(x) { return x; },\n\n // compiled match functions returning booleans\n matchContexts = new global.Object(),\n matchResolvers = new global.Object(),\n\n // compiled select functions returning collections\n selectContexts = new global.Object(),\n selectResolvers = new global.Object(),\n\n // used to pass methods to compiled functions\n Snapshot = new global.Object({\n\n // element indexing methods\n nthElement: nthElement,\n nthOfType: nthOfType,\n\n // element inspection methods\n getAttribute: getAttribute,\n hasAttribute: hasAttribute,\n\n // element selection methods\n byClass: _byClass,\n byName: byName,\n byTag: _byTag,\n byId: _byId,\n\n // helper/check methods\n contains: contains,\n isEmpty: isEmpty,\n isLink: isLink,\n\n // selection/matching\n select: select,\n match: match\n }),\n\n Tokens = new global.Object({\n prefixes: prefixes,\n encoding: encoding,\n operators: operators,\n whitespace: whitespace,\n identifier: identifier,\n attributes: attributes,\n combinators: combinators,\n pseudoclass: pseudoclass,\n pseudoparms: pseudoparms,\n quotedvalue: quotedvalue\n });\n\n /*------------------------------- PUBLIC API -------------------------------*/\n\n // code referenced by extensions\n Dom.ACCEPT_NODE = ACCEPT_NODE;\n\n // retrieve element by id attr\n Dom.byId = byId;\n\n // retrieve elements by tag name\n Dom.byTag = byTag;\n\n // retrieve elements by name attr\n Dom.byName = byName;\n\n // retrieve elements by class name\n Dom.byClass = byClass;\n\n // read the value of the attribute\n // as was in the original HTML code\n Dom.getAttribute = getAttribute;\n\n // check for the attribute presence\n // as was in the original HTML code\n Dom.hasAttribute = hasAttribute;\n\n // element match selector, return boolean true/false\n Dom.match = match;\n\n // first element match only, return element or null\n Dom.first = first;\n\n // elements matching selector, starting from element\n Dom.select = select;\n\n // compile selector into ad-hoc javascript resolver\n Dom.compile = compile;\n\n // check that two elements are ancestor/descendant\n Dom.contains = contains;\n\n // handle selector engine configuration settings\n Dom.configure = configure;\n\n // initialize caching for each document\n Dom.setCache = FN;\n\n // load previously collected result set\n Dom.loadResults = FN;\n\n // save previously collected result set\n Dom.saveResults = FN;\n\n // handle missing context in selector strings\n Dom.shortcuts = FN;\n\n // log resolvers errors/warnings\n Dom.emit = emit;\n\n // options enabing specific engine functionality\n Dom.Config = Config;\n\n // pass methods references to compiled resolvers\n Dom.Snapshot = Snapshot;\n\n // operators descriptor\n // for attribute operators extensions\n Dom.Operators = Operators;\n\n // selectors descriptor\n // for pseudo-class selectors extensions\n Dom.Selectors = Selectors;\n\n // export string patterns\n Dom.Tokens = Tokens;\n\n // export version string\n Dom.Version = version;\n\n // add or overwrite user defined operators\n Dom.registerOperator =\n function(symbol, resolver) {\n Operators[symbol] || (Operators[symbol] = resolver);\n };\n\n // add selector patterns for user defined callbacks\n Dom.registerSelector =\n function(name, rexp, func) {\n Selectors[name] || (Selectors[name] = new global.Object({\n Expression: rexp,\n Callback: func\n }));\n };\n\n /*---------------------------------- INIT ----------------------------------*/\n\n // init context specific variables\n switchContext(doc, true);\n\n});\n","/*\r\n\tselectivizr.com\r\n\r\n\tNotes about this source\r\n\t-----------------------\r\n * The #DEBUG_START and #DEBUG_END comments are used to mark blocks of code\r\n that will be removed prior to building a final release version (using a\r\n pre-compression script)\r\n\r\n\tReferences:\r\n\t-----------\r\n * CSS Syntax : https://www.w3.org/TR/2003/WD-css3-syntax-20030813/#style\r\n * Selectors : https://www.w3.org/TR/css3-selectors/#selectors\r\n * IE Compatability : https://msdn.microsoft.com/en-us/library/cc351024%28VS.85%29.aspx\r\n * W3C Selector Tests : https://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/\r\n*/\r\n\r\n(function(win) {\r\n\r\n\t// Determine IE version and stop execution if browser isn't IE. This\r\n\t// handles the script being loaded by non IE browsers because the\r\n\t// developer didn't use conditional comments.\r\n\tvar ieUserAgent = navigator.userAgent.match(/MSIE (\\d+)/);\r\n\tif (!ieUserAgent) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// =========================== Init Objects ============================\r\n\r\n\tvar doc = document;\r\n\tvar root = doc.documentElement;\r\n\tvar xhr = getXHRObject();\r\n\tvar ieVersion = ieUserAgent[1];\r\n\r\n\t// If were not in standards mode, IE is too old / new or we can't create\r\n\t// an XMLHttpRequest object then we should get out now.\r\n\tif (doc.compatMode != 'CSS1Compat' || ieVersion<6 || ieVersion>8 || !xhr) {\r\n\t\treturn;\r\n\t}\r\n\r\n\t// ========================= Common Objects ============================\r\n\r\n\t// Compatible selector engines in order of CSS3 support. Note: '*' is\r\n\t// a placeholder for the object key name. (basically, crude compression)\r\n\tvar selectorEngines = {\r\n\t\t\"NW\"\t\t\t\t\t\t\t\t: \"*.Dom.select\",\r\n\t\t\"MooTools\"\t\t\t\t\t\t\t: \"$$\",\r\n\t\t\"DOMAssistant\"\t\t\t\t\t\t: \"*.$\",\r\n\t\t\"Prototype\"\t\t\t\t\t\t\t: \"$$\",\r\n\t\t\"YAHOO\"\t\t\t\t\t\t\t\t: \"*.util.Selector.query\",\r\n\t\t\"Sizzle\"\t\t\t\t\t\t\t: \"*\",\r\n\t\t\"jQuery\"\t\t\t\t\t\t\t: \"*\",\r\n\t\t\"dojo\"\t\t\t\t\t\t\t\t: \"*.query\"\r\n\t};\r\n\r\n\tvar selectorMethod;\r\n\tvar enabledWatchers \t\t\t\t\t= []; // array of :enabled/:disabled elements to poll\r\n\tvar domPatches\t\t\t\t\t\t\t= [];\r\n\tvar ie6PatchID \t\t\t\t\t\t\t= 0; // used to solve ie6's multiple class bug\r\n\tvar patchIE6MultipleClasses\t\t\t\t= true; // if true adds class bloat to ie6\r\n\tvar namespace \t\t\t\t\t\t\t= \"slvzr\";\r\n\r\n\t// Stylesheet parsing regexp's\r\n\tvar RE_COMMENT\t\t\t\t\t\t\t= /(\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/)\\s*?/g;\r\n\tvar RE_IMPORT\t\t\t\t\t\t\t= /@import\\s*(?:(?:(?:url\\(\\s*(['\"]?)([^;]*)\\1)\\s*\\))|(?:(['\"])([^;]*)\\3))\\s*([^;]*);/g;\r\n\tvar RE_ASSET_URL \t\t\t\t\t\t= /(behavior\\s*?:\\s*)?\\burl\\(\\s*([\"']?)(?!data:)([^\"')]+)\\2\\s*\\)/g;\r\n\tvar RE_PSEUDO_STRUCTURAL\t\t\t\t= /^:(empty|(first|last|only|nth(-last)?)-(child|of-type))$/;\r\n\tvar RE_PSEUDO_ELEMENTS\t\t\t\t\t= /:(:first-(?:line|letter))/g;\r\n\tvar RE_SELECTOR_GROUP\t\t\t\t\t= /((?:^|(?:\\s*})+)(?:\\s*@media[^{]+{)?)\\s*([^\\{]*?[\\[:][^{]+)/g;\r\n\tvar RE_SELECTOR_PARSE\t\t\t\t\t= /([ +~>])|(:[a-z-]+(?:\\(.*?\\)+)?)|(\\[.*?\\])/g;\r\n\tvar RE_LIBRARY_INCOMPATIBLE_PSEUDOS\t\t= /(:not\\()?:(hover|enabled|disabled|focus|checked|target|active|visited|first-line|first-letter)\\)?/g;\r\n\tvar RE_PATCH_CLASS_NAME_REPLACE\t\t\t= /[^\\w-]/g;\r\n\r\n\t// HTML UI element regexp's\r\n\tvar RE_INPUT_ELEMENTS\t\t\t\t\t= /^(INPUT|SELECT|TEXTAREA|BUTTON)$/;\r\n\tvar RE_INPUT_CHECKABLE_TYPES\t\t\t= /^(checkbox|radio)$/;\r\n\r\n\t// Broken attribute selector implementations (IE7/8 native [^=\"\"], [$=\"\"] and [*=\"\"])\r\n\tvar BROKEN_ATTR_IMPLEMENTATIONS\t\t\t= ieVersion>6 ? /[\\$\\^*]=(['\"])\\1/ : null;\r\n\r\n\t// Whitespace normalization regexp's\r\n\tvar RE_TIDY_TRAILING_WHITESPACE\t\t\t= /([(\\[+~])\\s+/g;\r\n\tvar RE_TIDY_LEADING_WHITESPACE\t\t\t= /\\s+([)\\]+~])/g;\r\n\tvar RE_TIDY_CONSECUTIVE_WHITESPACE\t\t= /\\s+/g;\r\n\tvar RE_TIDY_TRIM_WHITESPACE\t\t\t\t= /^\\s*((?:[\\S\\s]*\\S)?)\\s*$/;\r\n\r\n\t// String constants\r\n\tvar EMPTY_STRING\t\t\t\t\t\t= \"\";\r\n\tvar SPACE_STRING\t\t\t\t\t\t= \" \";\r\n\tvar PLACEHOLDER_STRING\t\t\t\t\t= \"$1\";\r\n\r\n\t// =========================== Patching ================================\r\n\r\n\t// --[ patchStyleSheet() ]----------------------------------------------\r\n\t// Scans the passed cssText for selectors that require emulation and\r\n\t// creates one or more patches for each matched selector.\r\n\tfunction patchStyleSheet( cssText ) {\r\n\t\treturn cssText.replace(RE_PSEUDO_ELEMENTS, PLACEHOLDER_STRING).\r\n\t\t\treplace(RE_SELECTOR_GROUP, function(m, prefix, selectorText) {\r\n \t\t\tvar selectorGroups = selectorText.split(\",\");\r\n\t\t\t\t\tfunction comboBreaker (match, combinator, pseudo, attribute, index) {\r\n\t\t\t\t\t\tif (combinator) {\r\n\t\t\t\t\t\t\tif (patches.length>0) {\r\n\t\t\t\t\t\t\t\tdomPatches.push( { selector: selector.substring(0, index), patches: patches } );\r\n\t\t\t\t\t\t\t\tpatches = [];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn combinator;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tvar patch = (pseudo) ? patchPseudoClass( pseudo ) : patchAttribute( attribute );\r\n\t\t\t\t\t\t\tif (patch) {\r\n\t\t\t\t\t\t\t\tpatches.push(patch);\r\n\t\t\t\t\t\t\t\treturn \".\" + patch.className;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn match;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n \t\t\tfor (var c = 0, cs = selectorGroups.length; c < cs; c++) {\r\n \t\t\t\tvar selector = normalizeSelectorWhitespace(selectorGroups[c]) + SPACE_STRING;\r\n \t\t\t\tvar patches = [];\r\n \t\t\t\tselectorGroups[c] = selector.replace(RE_SELECTOR_PARSE, comboBreaker);\r\n \t\t\t}\r\n \t\t\treturn prefix + selectorGroups.join(\",\");\r\n \t\t});\r\n\t}\r\n\r\n\t// --[ patchAttribute() ]-----------------------------------------------\r\n\t// returns a patch for an attribute selector.\r\n\tfunction patchAttribute( attr ) {\r\n\t\treturn (!BROKEN_ATTR_IMPLEMENTATIONS || BROKEN_ATTR_IMPLEMENTATIONS.test(attr)) ?\r\n\t\t\t{ className: createClassName(attr), applyClass: true } : null;\r\n\t}\r\n\r\n\t// --[ patchPseudoClass() ]---------------------------------------------\r\n\t// returns a patch for a pseudo-class\r\n\tfunction patchPseudoClass( pseudo ) {\r\n\r\n\t\tvar applyClass = true;\r\n\t\tvar className = createClassName(pseudo.slice(1));\r\n\t\tvar isNegated = pseudo.substring(0, 5) == \":not(\";\r\n\t\tvar activateEventName;\r\n\t\tvar deactivateEventName;\r\n\r\n\t\t// if negated, remove :not()\r\n\t\tif (isNegated) {\r\n\t\t\tpseudo = pseudo.slice(5, -1);\r\n\t\t}\r\n\r\n\t\t// bracket contents are irrelevant - remove them\r\n\t\tvar bracketIndex = pseudo.indexOf(\"(\");\r\n\t\tif (bracketIndex > -1) {\r\n\t\t\tpseudo = pseudo.substring(0, bracketIndex);\r\n\t\t}\r\n\r\n\t\t// check we're still dealing with a pseudo-class\r\n\t\tif (pseudo.charAt(0) == \":\") {\r\n\t\t\tswitch (pseudo.slice(1)) {\r\n\r\n\t\t\t\tcase \"root\":\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\treturn isNegated ? e != root : e == root;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"target\":\r\n\t\t\t\t\t// :target is only supported in IE8\r\n\t\t\t\t\tif (ieVersion == 8) {\r\n\t\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\t\tvar handler = function() {\r\n\t\t\t\t\t\t\t\tvar hash = location.hash;\r\n\t\t\t\t\t\t\t\tvar hashID = hash.slice(1);\r\n\t\t\t\t\t\t\t\treturn isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID);\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\taddEvent( win, \"hashchange\", function() {\r\n\t\t\t\t\t\t\t\ttoggleElementClass(e, className, handler());\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\treturn handler();\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\tcase \"checked\":\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\tif (RE_INPUT_CHECKABLE_TYPES.test(e.type)) {\r\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\r\n\t\t\t\t\t\t\t\tif (event.propertyName == \"checked\") {\r\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.checked !== isNegated );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn e.checked !== isNegated;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"disabled\":\r\n\t\t\t\t\tisNegated = !isNegated;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"enabled\":\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\tif (RE_INPUT_ELEMENTS.test(e.tagName)) {\r\n\t\t\t\t\t\t\taddEvent( e, \"propertychange\", function() {\r\n\t\t\t\t\t\t\t\tif (event.propertyName == \"$disabled\") {\r\n\t\t\t\t\t\t\t\t\ttoggleElementClass( e, className, e.$disabled === isNegated );\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tenabledWatchers.push(e);\r\n\t\t\t\t\t\t\te.$disabled = e.disabled;\r\n\t\t\t\t\t\t\treturn e.disabled === isNegated;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn pseudo == \":enabled\" ? isNegated : !isNegated;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"focus\":\r\n\t\t\t\t\tactivateEventName = \"focus\";\r\n\t\t\t\t\tdeactivateEventName = \"blur\";\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"hover\":\r\n\t\t\t\t\tif (!activateEventName) {\r\n\t\t\t\t\t\tactivateEventName = \"mouseenter\";\r\n\t\t\t\t\t\tdeactivateEventName = \"mouseleave\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tapplyClass = function(e) {\r\n\t\t\t\t\t\taddEvent( e, isNegated ? deactivateEventName : activateEventName, function() {\r\n\t\t\t\t\t\t\ttoggleElementClass( e, className, true );\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\taddEvent( e, isNegated ? activateEventName : deactivateEventName, function() {\r\n\t\t\t\t\t\t\ttoggleElementClass( e, className, false );\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\treturn isNegated;\r\n\t\t\t\t\t};\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t// everything else\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t// If we don't support this pseudo-class don't create\r\n\t\t\t\t\t// a patch for it\r\n\t\t\t\t\tif (!RE_PSEUDO_STRUCTURAL.test(pseudo)) {\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn { className: className, applyClass: applyClass };\r\n\t}\r\n\r\n\t// --[ applyPatches() ]-------------------------------------------------\r\n\tfunction applyPatches() {\r\n\t\tvar elms, selectorText, patches, domSelectorText;\r\n\r\n\t\tfor (var c=0; c 0) {\r\n\t\t\tsetInterval( function() {\r\n\t\t\t\tfor (var c = 0, cl = enabledWatchers.length; c < cl; c++) {\r\n\t\t\t\t\tvar e = enabledWatchers[c];\r\n\t\t\t\t\tif (e.disabled !== e.$disabled) {\r\n\t\t\t\t\t\tif (e.disabled) {\r\n\t\t\t\t\t\t\te.disabled = false;\r\n\t\t\t\t\t\t\te.$disabled = true;\r\n\t\t\t\t\t\t\te.disabled = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\te.$disabled = e.disabled;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}, 250);\r\n\t\t}\r\n\t}\r\n\r\n\t// Determine the baseUrl and download the stylesheets\r\n\tvar baseTags = doc.getElementsByTagName(\"BASE\");\r\n\tvar baseUrl = (baseTags.length > 0) ? baseTags[0].href : doc.location.href;\r\n\tgetStyleSheets();\r\n\r\n\t// Bind selectivizr to the ContentLoaded event.\r\n\tContentLoaded(win, function() {\r\n\t\t// Determine the \"best fit\" selector engine\r\n\t\tfor (var engine in selectorEngines) {\r\n\t\t\tvar members, member, context = win;\r\n\t\t\tif (win[engine]) {\r\n\t\t\t\tmembers = selectorEngines[engine].replace(\"*\", engine).split(\".\");\r\n\t\t\t\twhile ((member = members.shift()) && (context = context[member])) {}\r\n\t\t\t\tif (typeof context == \"function\") {\r\n\t\t\t\t\tselectorMethod = context;\r\n\t\t\t\t\tinit();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t/*!\r\n\t * ContentLoaded.js by Diego Perini, modified for IE<9 only (to save space)\r\n\t *\r\n\t * Author: Diego Perini (diego.perini at gmail.com)\r\n\t * Summary: cross-browser wrapper for DOMContentLoaded\r\n\t * Updated: 20101020\r\n\t * License: MIT\r\n\t * Version: 1.2\r\n\t *\r\n\t * URL:\r\n\t * http://javascript.nwbox.com/ContentLoaded/\r\n\t * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE\r\n\t *\r\n\t */\r\n\r\n\t// @w window reference\r\n\t// @f function reference\r\n\tfunction ContentLoaded(win, fn) {\r\n\r\n\t\tvar done = false, top = true,\r\n\t\tinit = function(e) {\r\n\t\t\tif (e.type == \"readystatechange\" && doc.readyState != \"complete\") return;\r\n\t\t\t(e.type == \"load\" ? win : doc).detachEvent(\"on\" + e.type, init, false);\r\n\t\t\tif (!done && (done = true)) fn.call(win, e.type || e);\r\n\t\t},\r\n\t\tpoll = function() {\r\n\t\t\ttry { root.doScroll(\"left\"); } catch(e) { setTimeout(poll, 50); return; }\r\n\t\t\tinit('poll');\r\n\t\t};\r\n\r\n\t\tif (doc.readyState == \"complete\") fn.call(win, EMPTY_STRING);\r\n\t\telse {\r\n\t\t\tif (doc.createEventObject && root.doScroll) {\r\n\t\t\t\ttry { top = !win.frameElement; } catch(e) { }\r\n\t\t\t\tif (top) poll();\r\n\t\t\t}\r\n\t\t\taddEvent(doc,\"readystatechange\", init);\r\n\t\t\taddEvent(win,\"load\", init);\r\n\t\t}\r\n\t}\r\n})(this);\r\n","/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */\n/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */\n(function(w) {\n \"use strict\";\n w.matchMedia = w.matchMedia || function(doc, undefined) {\n var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, fakeBody = doc.createElement(\"body\"), div = doc.createElement(\"div\");\n div.id = \"mq-test-1\";\n div.style.cssText = \"position:absolute;top:-100em\";\n fakeBody.style.background = \"none\";\n fakeBody.appendChild(div);\n return function(q) {\n div.innerHTML = '­';\n docElem.insertBefore(fakeBody, refNode);\n bool = div.offsetWidth === 42;\n docElem.removeChild(fakeBody);\n return {\n matches: bool,\n media: q\n };\n };\n }(w.document);\n})(this);\n\n/*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */\n(function(w) {\n \"use strict\";\n var respond = {};\n w.respond = respond;\n respond.update = function() {};\n var requestQueue = [], xmlHttp = function() {\n var xmlhttpmethod = false;\n try {\n xmlhttpmethod = new w.XMLHttpRequest();\n } catch (e) {\n xmlhttpmethod = new w.ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n return function() {\n return xmlhttpmethod;\n };\n }(), ajax = function(url, callback) {\n var req = xmlHttp();\n if (!req) {\n return;\n }\n req.open(\"GET\", url, true);\n req.onreadystatechange = function() {\n if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) {\n return;\n }\n callback(req.responseText);\n };\n if (req.readyState === 4) {\n return;\n }\n req.send(null);\n };\n respond.ajax = ajax;\n respond.queue = requestQueue;\n respond.regex = {\n media: /@media[^\\{]+\\{([^\\{\\}]*\\{[^\\}\\{]*\\})+/gi,\n keyframes: /@(?:\\-(?:o|moz|webkit)\\-)?keyframes[^\\{]+\\{(?:[^\\{\\}]*\\{[^\\}\\{]*\\})+[^\\}]*\\}/gi,\n urls: /(url\\()['\"]?([^\\/\\)'\"][^:\\)'\"]+)['\"]?(\\))/g,\n findStyles: /@media *([^\\{]+)\\{([\\S\\s]+?)$/,\n only: /(only\\s+)?([a-zA-Z]+)\\s?/,\n minw: /\\([\\s]*min\\-width\\s*:[\\s]*([\\s]*[0-9\\.]+)(px|em)[\\s]*\\)/,\n maxw: /\\([\\s]*max\\-width\\s*:[\\s]*([\\s]*[0-9\\.]+)(px|em)[\\s]*\\)/\n };\n respond.mediaQueriesSupported = w.matchMedia && w.matchMedia(\"only all\") !== null && w.matchMedia(\"only all\").matches;\n if (respond.mediaQueriesSupported) {\n return;\n }\n var doc = w.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName(\"head\")[0] || docElem, base = doc.getElementsByTagName(\"base\")[0], links = head.getElementsByTagName(\"link\"), lastCall, resizeDefer, eminpx, getEmValue = function() {\n var ret, div = doc.createElement(\"div\"), body = doc.body, originalHTMLFontSize = docElem.style.fontSize, originalBodyFontSize = body && body.style.fontSize, fakeUsed = false;\n div.style.cssText = \"position:absolute;font-size:1em;width:1em\";\n if (!body) {\n body = fakeUsed = doc.createElement(\"body\");\n body.style.background = \"none\";\n }\n docElem.style.fontSize = \"100%\";\n body.style.fontSize = \"100%\";\n body.appendChild(div);\n if (fakeUsed) {\n docElem.insertBefore(body, docElem.firstChild);\n }\n ret = div.offsetWidth;\n if (fakeUsed) {\n docElem.removeChild(body);\n } else {\n body.removeChild(div);\n }\n docElem.style.fontSize = originalHTMLFontSize;\n if (originalBodyFontSize) {\n body.style.fontSize = originalBodyFontSize;\n }\n ret = eminpx = parseFloat(ret);\n return ret;\n }, applyMedia = function(fromResize) {\n var name = \"clientWidth\", docElemProp = docElem[name], currWidth = doc.compatMode === \"CSS1Compat\" && docElemProp || doc.body[name] || docElemProp, styleBlocks = {}, lastLink = links[links.length - 1], now = new Date().getTime();\n if (fromResize && lastCall && now - lastCall < resizeThrottle) {\n w.clearTimeout(resizeDefer);\n resizeDefer = w.setTimeout(applyMedia, resizeThrottle);\n return;\n } else {\n lastCall = now;\n }\n for (var i in mediastyles) {\n if (mediastyles.hasOwnProperty(i)) {\n var thisstyle = mediastyles[i], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = \"em\";\n if (!!min) {\n min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1);\n }\n if (!!max) {\n max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1);\n }\n if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) {\n if (!styleBlocks[thisstyle.media]) {\n styleBlocks[thisstyle.media] = [];\n }\n styleBlocks[thisstyle.media].push(rules[thisstyle.rules]);\n }\n }\n }\n for (var j in appendedEls) {\n if (appendedEls.hasOwnProperty(j)) {\n if (appendedEls[j] && appendedEls[j].parentNode === head) {\n head.removeChild(appendedEls[j]);\n }\n }\n }\n appendedEls.length = 0;\n for (var k in styleBlocks) {\n if (styleBlocks.hasOwnProperty(k)) {\n var ss = doc.createElement(\"style\"), css = styleBlocks[k].join(\"\\n\");\n ss.type = \"text/css\";\n ss.media = k;\n head.insertBefore(ss, lastLink.nextSibling);\n if (ss.styleSheet) {\n ss.styleSheet.cssText = css;\n } else {\n ss.appendChild(doc.createTextNode(css));\n }\n appendedEls.push(ss);\n }\n }\n }, translate = function(styles, href, media) {\n var qs = styles.replace(respond.regex.keyframes, \"\").match(respond.regex.media), ql = qs && qs.length || 0;\n href = href.substring(0, href.lastIndexOf(\"/\"));\n var repUrls = function(css) {\n return css.replace(respond.regex.urls, \"$1\" + href + \"$2$3\");\n }, useMedia = !ql && media;\n if (href.length) {\n href += \"/\";\n }\n if (useMedia) {\n ql = 1;\n }\n for (var i = 0; i < ql; i++) {\n var fullq, thisq, eachq, eql;\n if (useMedia) {\n fullq = media;\n rules.push(repUrls(styles));\n } else {\n fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1;\n rules.push(RegExp.$2 && repUrls(RegExp.$2));\n }\n eachq = fullq.split(\",\");\n eql = eachq.length;\n for (var j = 0; j < eql; j++) {\n thisq = eachq[j];\n mediastyles.push({\n media: thisq.split(\"(\")[0].match(respond.regex.only) && RegExp.$2 || \"all\",\n rules: rules.length - 1,\n hasquery: thisq.indexOf(\"(\") > -1,\n minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || \"\"),\n maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || \"\")\n });\n }\n }\n applyMedia();\n }, makeRequests = function() {\n if (requestQueue.length) {\n var thisRequest = requestQueue.shift();\n ajax(thisRequest.href, function(styles) {\n translate(styles, thisRequest.href, thisRequest.media);\n parsedSheets[thisRequest.href] = true;\n w.setTimeout(function() {\n makeRequests();\n }, 0);\n });\n }\n }, ripCSS = function() {\n for (var i = 0; i < links.length; i++) {\n var sheet = links[i], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === \"stylesheet\";\n if (!!href && isCSS && !parsedSheets[href]) {\n if (sheet.styleSheet && sheet.styleSheet.rawCssText) {\n translate(sheet.styleSheet.rawCssText, href, media);\n parsedSheets[href] = true;\n } else {\n if (!/^([a-zA-Z:]*\\/\\/)/.test(href) && !base || href.replace(RegExp.$1, \"\").split(\"/\")[0] === w.location.host) {\n if (href.substring(0, 2) === \"//\") {\n href = w.location.protocol + href;\n }\n requestQueue.push({\n href: href,\n media: media\n });\n }\n }\n }\n }\n makeRequests();\n };\n ripCSS();\n respond.update = ripCSS;\n respond.getEmValue = getEmValue;\n function callMedia() {\n applyMedia(true);\n }\n if (w.addEventListener) {\n w.addEventListener(\"resize\", callMedia, false);\n } else if (w.attachEvent) {\n w.attachEvent(\"onresize\", callMedia);\n }\n})(this);","// addEventListener\n// removeEventListener\n// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility\n\n(function() {\n if (!Element.prototype.addEventListener) {\n var eventListeners=[];\n \n var addEventListener=function(type,listener /*, useCapture (will be ignored) */) {\n var self=this;\n var wrapper=function(e) {\n e.target=e.srcElement;\n e.currentTarget=self;\n if (typeof listener.handleEvent != 'undefined') {\n listener.handleEvent(e);\n } else {\n listener.call(self,e);\n }\n };\n if (type==\"DOMContentLoaded\") {\n var wrapper2=function(e) {\n if (document.readyState==\"complete\") {\n wrapper(e);\n }\n };\n document.attachEvent(\"onreadystatechange\",wrapper2);\n eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper2});\n \n if (document.readyState==\"complete\") {\n var e=new Event();\n e.srcElement=window;\n wrapper2(e);\n }\n } else {\n this.attachEvent(\"on\"+type,wrapper);\n eventListeners.push({object:this,type:type,listener:listener,wrapper:wrapper});\n }\n };\n var removeEventListener=function(type,listener /*, useCapture (will be ignored) */) {\n var counter=0;\n while (counter= 0; --i) {\n if(n = nodes[i], 1 === n.nodeType) { return n; }\n }\n return null;\n }\n });\n }\n})();","// Element.nextElementSibling\n\n(function () {\n \"use strict\";\n\n if (!(\"nextElementSibling\" in document.documentElement)) {\n Object.defineProperty(Element.prototype, \"nextElementSibling\", {\n get: function(){\n var e = this.nextSibling;\n while(e && 1 !== e.nodeType) {\n e = e.nextSibling;\n }\n return e;\n }\n });\n }\n})();","// event.pageX / event.pageY\n\n(function () {\n \"use strict\";\n\n if(!window.MouseEvent && !(\"pageX\" in Event.prototype)){\n Object.defineProperty(Event.prototype, \"pageX\", {\n get: function(){ \n return this.clientX + window.pageXOffset; \n }\n });\n Object.defineProperty(Event.prototype, \"pageY\", {\n get: function(){ \n return this.clientY + window.pageYOffset; \n }\n });\n }\n})();","// window.pageXOffset / window.pageYOffset / window.scrollX / window.scrollY\n\n(function () {\n \"use strict\";\n\n if(!(\"pageXOffset\" in window)) {\n var x = function(){ return (document.documentElement || document.body.parentNode || document.body).scrollLeft; },\n y = function(){ return (document.documentElement || document.body.parentNode || document.body).scrollTop; };\n\n Object.defineProperty(window, \"pageXOffset\", {get: x});\n Object.defineProperty(window, \"pageYOffset\", {get: y});\n Object.defineProperty(window, \"scrollX\", {get: x});\n Object.defineProperty(window, \"scrollY\", {get: y});\n }\n})();\n","// IE8 preventDefault\n// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility\n\n(function() {\n if (!Event.prototype.preventDefault) {\n Event.prototype.preventDefault=function() {\n this.returnValue=false;\n };\n }\n})();","// Element.previousElementSibling\n\n(function () {\n \"use strict\";\n\n if (!(\"previousElementSibling\" in document.documentElement)) {\n Object.defineProperty(Element.prototype, \"previousElementSibling\", {\n get: function(){\n var e = this.previousSibling;\n while(e && 1 !== e.nodeType) {\n e = e.previousSibling;\n }\n return e;\n }\n });\n }\n})();","// IE8 stopPropagation\n// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener?redirectlocale=en-US&redirectslug=DOM%2FEventTarget.addEventListener#Compatibility\n\n(function() {\n if (!Event.prototype.stopPropagation) {\n Event.prototype.stopPropagation=function() {\n this.cancelBubble=true;\n };\n }\n})();","// textContent\n\n(function(){\n \"use strict\";\n \n if(!(\"textContent\" in Element.prototype)){\n var interfaces = \"Element Text HTMLDocument HTMLCommentElement\".split(\" \");\n var haveText = {3:1, 8:1, 4:1, 7:1};\n var haveNull = {9:1, 10:1, 12:1};\n var srcTags = {SCRIPT:1, STYLE:1};\n for(var I, i = 0; i < 4; ++i){\n I = window[interfaces[i]];\n I && Object.defineProperty(I.prototype, \"textContent\", {\n get: function(){ return getText(this); },\n set: function(input){\n var type = this.nodeType;\n \n /** Text nodes: set nodeValue */\n if(haveText[type]) {\n this.nodeValue = input;\n } else if(!haveNull[type]){\n /** For everything that isn't a document, DOCTYPE or notation */\n var name = this.nodeName;\n \n /** IE8 throws a runtime error trying to set the innerHTML of a