Skip to content
Browse files

version 1.7.6

  • Loading branch information...
1 parent 47c57d0 commit 050669e6f91f84763e98f613e04d2fb1421f5a6c @chemerisuk committed
Showing with 308 additions and 260 deletions.
  1. +1 −1 bower.json
  2. +2 −2 dist/better-dom-legacy.js
  3. +1 −1 dist/better-dom-legacy.min.js
  4. +301 −253 dist/better-dom.js
  5. +2 −2 dist/better-dom.min.js
  6. +1 −1 package.json
View
2 bower.json
@@ -1,6 +1,6 @@
{
"name": "better-dom",
- "version": "1.7.5",
+ "version": "1.7.6",
"main": [
"dist/better-dom.js",
"dist/better-dom-legacy.js",
View
4 dist/better-dom-legacy.js
@@ -1,6 +1,6 @@
/**
* @file better-dom-legacy.js
- * @version 1.7.5 2014-04-14T18:47:42
+ * @version 1.7.6 2014-07-21T01:32:43
* @overview Live extension playground
* @copyright 2013-2014 Maksim Chemerisuk
* @license MIT
@@ -1798,4 +1798,4 @@ if (!document.addEventListener) {
});
}
-},{}]},{},[3,4,5,2,1]);
+},{}]},{},[3,4,5,2,1])
View
2 dist/better-dom-legacy.min.js
@@ -1,6 +1,6 @@
/**
* @file better-dom-legacy.js
- * @version 1.7.5 2014-04-14T18:47:42
+ * @version 1.7.6 2014-07-21T01:32:43
* @overview Live extension playground
* @copyright 2013-2014 Maksim Chemerisuk
* @license MIT
View
554 dist/better-dom.js
@@ -1,6 +1,6 @@
/**
* @file better-dom.js
- * @version 1.7.5 2014-04-14T18:47:43
+ * @version 1.7.6 2014-07-21T01:32:45
* @overview Live extension playground
* @copyright 2013-2014 Maksim Chemerisuk
* @license MIT
@@ -9,6 +9,85 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
+
+/*
+ * Helper for accessing css properties
+ */
+var hooks = {get: {}, set: {}},
+ reDash = /\-./g,
+ reCamel = /[A-Z]/g,
+ directions = ["Top", "Right", "Bottom", "Left"],
+ computed = _.computeStyle(_.docEl),
+ // In Opera CSSStyleDeclaration objects returned by _.computeStyle have length 0
+ props = computed.length ? _.slice.call(computed, 0) : Object.keys(computed).map(function(key) {
+ return key.replace(reCamel, function(str) {return "-" + str.toLowerCase()});
+ });
+
+props.forEach(function(propName) {
+ var prefix = propName[0] === "-" ? propName.substr(1, propName.indexOf("-", 1) - 1) : null,
+ unprefixedName = prefix ? propName.substr(prefix.length + 2) : propName,
+ stylePropName = propName.replace(reDash, function(str) {return str[1].toUpperCase()});
+ // most of browsers starts vendor specific props in lowercase
+ if (!(stylePropName in computed)) {
+ stylePropName = stylePropName[0].toLowerCase() + stylePropName.substr(1);
+ }
+
+ hooks.get[unprefixedName] = function(style) {return style[stylePropName]};
+ hooks.set[unprefixedName] = function(style, value) {
+ value = typeof value === "number" ? value + "px" : value.toString();
+ // use cssText property to determine DOM.importStyles call
+ style["cssText" in style ? stylePropName : propName] = value;
+ };
+});
+
+// Exclude the following css properties from adding px
+" float fill-opacity font-weight line-height opacity orphans widows z-index zoom ".split(" ").forEach(function(propName) {
+ var stylePropName = propName.replace(reDash, function(str) {return str[1].toUpperCase()});
+
+ if (propName === "float") {
+ stylePropName = "cssFloat" in computed ? "cssFloat" : "styleFloat";
+ // normalize float css property
+ hooks.get[propName] = function(style) {return style[stylePropName]};
+ }
+
+ hooks.set[propName] = function(style, value) {
+ style["cssText" in style ? stylePropName : propName] = value.toString();
+ };
+});
+
+// normalize property shortcuts
+_.forOwn({
+ font: ["fontStyle", "fontSize", "/", "lineHeight", "fontFamily"],
+ padding: directions.map(function(dir) {return "padding" + dir}),
+ margin: directions.map(function(dir) {return "margin" + dir}),
+ "border-width": directions.map(function(dir) {return "border" + dir + "Width"}),
+ "border-style": directions.map(function(dir) {return "border" + dir + "Style"})
+}, function(props, key) {
+ hooks.get[key] = function(style) {
+ var result = [],
+ hasEmptyStyleValue = function(prop, index) {
+ result.push(prop === "/" ? prop : style[prop]);
+
+ return !result[index];
+ };
+
+ return props.some(hasEmptyStyleValue) ? "" : result.join(" ");
+ };
+
+ hooks.set[key] = function(style, value) {
+ if (value && "cssText" in style) {
+ // normalize setting complex property across browsers
+ style.cssText += ";" + key + ":" + value;
+ } else {
+ props.forEach(function(name) {return style[name] = typeof value === "number" ? value + "px" : value.toString()});
+ }
+ };
+});
+
+exports["default"] = hooks;
+},{"./utils":32}],2:[function(require,module,exports){
+"use strict";
+var _ = require("./utils")["default"];
var DOM = require("./dom")["default"];
var $Element = require("./element")["default"];
var $Elements = require("./elements")["default"];
@@ -44,19 +123,13 @@ DOM.create = function(value, varMap) {
return new $Element(value);
};
-},{"./dom":5,"./element":12,"./elements":20,"./utils":32}],2:[function(require,module,exports){
+},{"./dom":6,"./element":13,"./elements":21,"./utils":32}],3:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var DOM = require("./dom")["default"];
var $Element = require("./element")["default"];
var SelectorMatcher = require("./selectormatcher")["default"];
-/**
- * Live extensions support
- * @module extend
- * @see https://github.com/chemerisuk/better-dom/wiki/Live-extensions
- */
-
// Inspired by trick discovered by Daniel Buchner:
// https://github.com/csuwldcat/SelectorListener
var reRemovableMethod = /^(on|do)[A-Z]/,
@@ -90,7 +163,41 @@ var reRemovableMethod = /^(on|do)[A-Z]/,
makeExtHandler = function(node, skip) {return function(ext, index) {
// skip previously excluded or mismatched elements
if (!skip[index] && ext.accept(node)) ext(node);
- }};
+ }},
+ startExt = function(ext) {
+ // initialize extension manually to make sure that all elements
+ // have appropriate methods before they are used in other DOM.extend.
+ // Also fixes legacy IEs when the HTC behavior is already attached
+ _.each.call(document.querySelectorAll(ext.selector), ext);
+ // MUST be after querySelectorAll because of legacy IEs behavior
+ DOM.importStyles(ext.selector, styles);
+ },
+ readyState = document.readyState,
+ readyCallback = function() {
+ if (readyCallback) {
+ extensions.forEach(startExt);
+
+ readyCallback = false;
+ }
+ };
+
+// Catch cases where ready is called after the browser event has already occurred.
+// IE10 and lower don't handle "interactive" properly... use a weak inference to detect it
+// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+if (document.attachEvent ? readyState === "complete" : readyState !== "loading") {
+ // use setTimeout to make sure that the library is fully initialized
+ setTimeout(readyCallback, 0);
+} else {
+ if (_.DOM2_EVENTS) {
+ window.addEventListener("load", readyCallback, false);
+ document.addEventListener("DOMContentLoaded", readyCallback, false);
+ } else {
+ window.attachEvent("onload", readyCallback);
+ document.attachEvent("ondataavailable", function() {
+ if (window.event.srcUrn === "DOMContentLoaded" && readyCallback) readyCallback();
+ });
+ }
+}
if (_.CSS3_ANIMATIONS) {
nativeEventType = _.WEBKIT_PREFIX ? "webkitAnimationStart" : "animationstart";
@@ -127,10 +234,11 @@ if (_.CSS3_ANIMATIONS) {
/**
* Declare a live extension
- * @memberOf module:extend
+ * @memberOf DOM
* @param {String} selector css selector of which elements to capture
* @param {Boolean|Function} [condition=true] indicates if live extension should be attached or not
* @param {Object} mixins extension declatation
+ * @see https://github.com/chemerisuk/better-dom/wiki/Live-extensions
*/
DOM.extend = function(selector, condition, mixins) {
if (arguments.length === 2) {
@@ -140,6 +248,8 @@ DOM.extend = function(selector, condition, mixins) {
if (typeof condition === "boolean") condition = condition ? returnTrue : returnFalse;
+ if (typeof mixins === "function") mixins = {constructor: mixins};
+
if (!mixins || typeof mixins !== "object" || typeof condition !== "function") throw _.makeError("extend", true);
if (selector === "*") {
@@ -168,24 +278,17 @@ DOM.extend = function(selector, condition, mixins) {
};
ext.accept = SelectorMatcher(selector);
+ ext.selector = selector;
extensions.push(ext);
- DOM.ready(function() {
- // initialize extension manually to make sure that all elements
- // have appropriate methods before they are used in other DOM.ready.
- // Also fixes legacy IEs when the HTC behavior is already attached
- _.each.call(document.querySelectorAll(selector), ext);
- // Any extension should be initialized after DOM.ready
- // MUST be after querySelectorAll because of legacy IEs behavior
- DOM.importStyles(selector, styles);
- });
+ if (!readyCallback) startExt(ext);
}
};
/**
* Return {@link $Element} initialized with all existing live extensions.
* Also exposes private event handler functions that aren't usually presented
- * @memberOf module:extend
+ * @memberOf DOM
* @param {Mixed} [content] HTMLString, EmmetString
* @param {Object|Array} [varMap] key/value map of variables in emmet template
* @return {$Element} mocked instance
@@ -193,7 +296,7 @@ DOM.extend = function(selector, condition, mixins) {
DOM.mock = function(content, varMap) {
return content ? DOM.create(content, varMap).legacy(applyExtensions) : new $Element();
};
-},{"./dom":5,"./element":12,"./selectormatcher":30,"./utils":32}],3:[function(require,module,exports){
+},{"./dom":6,"./element":13,"./selectormatcher":31,"./utils":32}],4:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var DOM = require("./dom")["default"];
@@ -226,11 +329,11 @@ DOM.importScripts = function() {var SLICE$0 = Array.prototype.slice;var urls = S
callback();
};
-},{"./dom":5,"./utils":32}],4:[function(require,module,exports){
+},{"./dom":6,"./utils":32}],5:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var DOM = require("./dom")["default"];
-var styleAccessor = require("./styleaccessor")["default"];
+var CSS = require("./css")["default"];
var styleNode = _.injectElement(document.createElement("style")),
styleSheet = styleNode.sheet || styleNode.styleSheet,
@@ -244,12 +347,11 @@ var styleNode = _.injectElement(document.createElement("style")),
*/
DOM.importStyles = function(selector, cssText) {
if (cssText && typeof cssText === "object") {
+ // use styleObj to collect all style props for a new CSS rule
var styleObj = {};
_.forOwn(cssText, function(value, prop) {
- var hook = styleAccessor.set[prop];
-
- value = typeof value === "number" ? value + "px" : value || "";
+ var hook = CSS.set[prop];
if (hook) {
hook(styleObj, value);
@@ -276,13 +378,13 @@ DOM.importStyles = function(selector, cssText) {
selector.split(",").forEach(function(selector) { styleSheet.addRule(selector, cssText) });
}
};
-},{"./dom":5,"./styleaccessor":31,"./utils":32}],5:[function(require,module,exports){
+},{"./css":1,"./dom":6,"./utils":32}],6:[function(require,module,exports){
"use strict";
var $Node = require("./node")["default"];
var DOM = new $Node(document);
-DOM.version = "1.7.5";
+DOM.version = "1.7.6";
DOM.template = function(str) {return str};
/**
@@ -291,7 +393,7 @@ DOM.template = function(str) {return str};
* @extends $Node
*/
exports["default"] = window.DOM = DOM;
-},{"./node":29}],6:[function(require,module,exports){
+},{"./node":30}],7:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var DOM = require("./dom")["default"];
@@ -325,6 +427,7 @@ if (document.attachEvent ? readyState === "complete" : readyState !== "loading")
* Execute callback when DOM is ready
* @memberOf DOM
* @param {Function} callback event listener
+ * @deprecated use DOM.extend instead
*/
DOM.ready = function(callback) {
if (typeof callback !== "function") throw _.makeError("ready", true);
@@ -335,7 +438,7 @@ DOM.ready = function(callback) {
DOM.dispatch(callback);
}
};
-},{"./dom":5,"./utils":32}],7:[function(require,module,exports){
+},{"./dom":6,"./utils":32}],8:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var DOM = require("./dom")["default"];
@@ -508,7 +611,7 @@ DOM.template = function(template, varMap) {
return varMap ? output : cache[template] = output;
};
-},{"./dom":5,"./utils":32}],8:[function(require,module,exports){
+},{"./dom":6,"./utils":32}],9:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
@@ -605,7 +708,7 @@ $Element.prototype.toggleClass = makeClassesMethod("toggle", function(className)
if (oldClassName === this._._node.className) this.removeClass(className);
});
-},{"./element":12,"./utils":32}],9:[function(require,module,exports){
+},{"./element":13,"./utils":32}],10:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
@@ -640,7 +743,7 @@ $Element.prototype.clone = function() {var deep = arguments[0];if(deep === void
return result;
};
-},{"./element":12,"./utils":32}],10:[function(require,module,exports){
+},{"./element":13,"./utils":32}],11:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -657,28 +760,32 @@ $Element.prototype.get = function(name) {
var data = this._,
node = data._node,
hook = hooks[name],
+ nameType = typeof name,
key, value;
if (!node) return;
if (hook) return hook(node, name);
- if (typeof name === "string") {
- if (name[0] === "_") {
+ if (nameType === "string") {
+ if (name[0] === "_" || name[0] === "-") {
key = name.substr(1);
if (key in data) {
value = data[key];
} else {
- try {
- value = node.getAttribute("data-" + key);
- // parse object notation syntax
+ value = node.getAttribute("data-" + key);
+
+ if (value != null) {
+ // try to recognize and parse object notation syntax
if (value[0] === "{" && value[value.length - 1] === "}") {
- value = JSON.parse(value);
+ try {
+ value = JSON.parse(value);
+ } catch (err) { }
}
- } catch (err) { }
- if (value != null) data[key] = value;
+ data[key] = value;
+ }
}
return value;
@@ -695,11 +802,15 @@ $Element.prototype.get = function(name) {
hooks.undefined = function(node) {
var name;
- if (node.tagName === "OPTION") {
- name = node.hasAttribute("value") ? "value" : "text";
- } else if (node.tagName === "SELECT") {
+ switch(node.tagName) {
+ case "SELECT":
return ~node.selectedIndex ? node.options[node.selectedIndex].value : "";
- } else {
+
+ case "OPTION":
+ name = node.hasAttribute("value") ? "value" : "text";
+ break;
+
+ default:
name = node.type && "value" in node ? "value" : "innerHTML";
}
@@ -710,7 +821,7 @@ hooks.undefined = function(node) {
hooks.type = function(node) {return node.getAttribute("type") || node.type};
if (!_.DOM2_EVENTS) hooks.textContent = function(node) {return node.innerText};
-},{"./element":12,"./node":29,"./utils":32}],11:[function(require,module,exports){
+},{"./element":13,"./node":30,"./utils":32}],12:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var DOM = require("./dom")["default"];
@@ -725,26 +836,21 @@ var strings = {},
languages = [];
/**
- * Get/set localized value
+ * Set inner content to a localized string
* @memberOf module:i18n
- * @param {String} [value] resource string key
+ * @param {String} [key] resource string key
* @param {Object|Array} [varMap] resource string variables
* @return {String|$Element}
*/
-$Element.prototype.i18n = function(value, varMap) {var this$0 = this;
- var len = arguments.length;
-
- if (!len) return this.get("data-i18n");
+$Element.prototype.i18n = function(key, varMap) {
+ if (typeof key !== "string" || varMap && typeof varMap !== "object") throw _.makeError("i18n");
- if (len > 2 || value && typeof value !== "string" || varMap && typeof varMap !== "object") throw _.makeError("i18n");
- // update data-i18n-{lang} attributes
- [value].concat(strings[value]).forEach(function(value, index) {
- var attrName = "data-i18n" + (index ? "-" + languages[index - 1] : "");
+ return this.set(languages.concat("").reduce(function(memo, lang, index) {
+ var value = key in strings && strings[key][index] || key,
+ content = value && varMap ? _.format(value, varMap) : value;
- if (value) this$0.set(attrName, varMap ? _.format(value, varMap) : value);
- });
-
- return this.set("");
+ return memo + "<span data-i18n=" + lang + ">" + content + "</span>";
+ }, ""));
};
/**
@@ -757,31 +863,30 @@ $Element.prototype.i18n = function(value, varMap) {var this$0 = this;
*/
DOM.importStrings = function(lang, key, value) {
var keyType = typeof key,
- attrName = "data-i18n-" + lang,
langIndex = languages.indexOf(lang);
if (keyType === "string") {
if (langIndex === -1) {
langIndex = languages.push(lang) - 1;
// add global rule for the data-i18n-{lang} attribute
- DOM.importStyles("[" + attrName + "]:lang(" + lang + "):before", "content:attr(" + attrName + ")");
+ DOM.importStyles(":lang(" + lang + ") > [data-i18n]", "display:none");
+ DOM.importStyles(":lang(" + lang + ") > [data-i18n=" + lang + "]", "display:inline");
}
if (!strings[key]) strings[key] = [];
// store localized string internally
strings[key][langIndex] = value;
-
- DOM.ready(function() {return DOM.findAll("[data-i18n=\"" + key + "\"]").set(attrName, value)});
} else if (keyType === "object") {
- _.forOwn(key, function(value, key) {return DOM.importStrings(lang, key, value)});
+ _.forOwn(key, function(value, key) { DOM.importStrings(lang, key, value) });
} else {
throw _.makeError("importStrings", true);
}
};
-// by default just show data-i18n string
-DOM.importStyles("[data-i18n]:before", "content:attr(data-i18n)");
-},{"./dom":5,"./element":12,"./utils":32}],12:[function(require,module,exports){
+// by default just show data-i18n attribute value
+DOM.importStyles("[data-i18n]", "display:none");
+DOM.importStyles("[data-i18n='']", "display:inline");
+},{"./dom":6,"./element":13,"./utils":32}],13:[function(require,module,exports){
"use strict";
var $Node = require("./node")["default"];
@@ -810,7 +915,7 @@ $Element.prototype.toString = function() {
};
exports["default"] = $Element;
-},{"./node":29}],13:[function(require,module,exports){
+},{"./node":30}],14:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
@@ -918,7 +1023,7 @@ $Element.prototype.replace = makeManipulationMethod("replace", "", false, functi
$Element.prototype.remove = makeManipulationMethod("remove", "", false, function(node) {
node.parentNode.removeChild(node);
});
-},{"./element":12,"./utils":32}],14:[function(require,module,exports){
+},{"./element":13,"./utils":32}],15:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
@@ -956,7 +1061,7 @@ hooks[":hidden"] = function(node) {
};
hooks[":visible"] = function(node) {return !hooks[":hidden"](node)};
-},{"./element":12,"./selectormatcher":30,"./utils":32}],15:[function(require,module,exports){
+},{"./element":13,"./selectormatcher":31,"./utils":32}],16:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
@@ -992,7 +1097,7 @@ $Element.prototype.offset = function() {
};
}
};
-},{"./element":12,"./utils":32}],16:[function(require,module,exports){
+},{"./element":13,"./utils":32}],17:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -1021,7 +1126,7 @@ $Element.prototype.set = function(name, value) {
if (watchers) oldValue = el.get(name);
- if (name && name[0] === "_") {
+ if (name && (name[0] === "_" || name[0] === "-")) {
el._[name.substr(1)] = newValue;
} else {
if (typeof newValue === "function") newValue = value(el, index, ref);
@@ -1037,12 +1142,13 @@ $Element.prototype.set = function(name, value) {
} else {
node.setAttribute(name, newValue);
}
+
// trigger reflow manually in IE8
if (!_.DOM2_EVENTS || _.LEGACY_ANDROID) node.className = node.className;
}
if (watchers && oldValue !== newValue) {
- watchers.forEach(function(w) { el.dispatch(w, newValue, oldValue) });
+ watchers.forEach(function(w) { el.dispatch(w, newValue, oldValue, el, index, ref) });
}
});
};
@@ -1092,8 +1198,8 @@ hooks.undefined = function(node, value) {
node.selectedIndex = -1;
}
} else if (node.type && "value" in node) {
- // for IE use innerText because it doesn't trigger onpropertychange
- name = _.DOM2_EVENTS ? "value" : "innerText";
+ // for IE use innerText for textareabecause it doesn't trigger onpropertychange
+ name = _.DOM2_EVENTS || node.type !== "textarea" ? "value" : "innerText";
} else {
name = "innerHTML";
}
@@ -1102,11 +1208,11 @@ hooks.undefined = function(node, value) {
};
if (!_.DOM2_EVENTS) hooks.textContent = function(node, value) { node.innerText = value };
-},{"./element":12,"./node":29,"./utils":32}],17:[function(require,module,exports){
+},{"./element":13,"./node":30,"./utils":32}],18:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
-var styleAccessor = require("./styleaccessor")["default"];
+var CSS = require("./css")["default"];
/**
* Changing of element styles support
@@ -1119,6 +1225,7 @@ var styleAccessor = require("./styleaccessor")["default"];
* @param {String|Object} name style property name or key/value object
* @param {String|Function} [value] style property value or function that returns it
* @return {String|$Element} property value or reference to this
+ * @deprecated use getter and setter instead
*/
$Element.prototype.style = function(name, value) {
var len = arguments.length,
@@ -1131,7 +1238,7 @@ $Element.prototype.style = function(name, value) {
style = node.style;
value = (nameType === "string" ? [name] : name).reduce(function(memo, name) {
- hook = styleAccessor.get[name];
+ hook = CSS.get[name];
value = hook ? hook(style) : style[name];
if (!computed && !value) {
@@ -1153,7 +1260,7 @@ $Element.prototype.style = function(name, value) {
return this.legacy(function(node, el, index, ref) {
var style = node.style,
appendCssText = function(value, key) {
- var hook = styleAccessor.set[key];
+ var hook = CSS.set[key];
if (typeof value === "function") value = value(el, index, ref);
@@ -1175,7 +1282,7 @@ $Element.prototype.style = function(name, value) {
}
});
};
-},{"./element":12,"./styleaccessor":31,"./utils":32}],18:[function(require,module,exports){
+},{"./css":1,"./element":13,"./utils":32}],19:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
@@ -1301,11 +1408,11 @@ $Element.prototype.child = makeChildTraversingMethod(false);
* @function
*/
$Element.prototype.children = makeChildTraversingMethod(true);
-},{"./element":12,"./elements":20,"./selectormatcher":30,"./utils":32}],19:[function(require,module,exports){
+},{"./element":13,"./elements":21,"./selectormatcher":31,"./utils":32}],20:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
-var styleAccessor = require("./styleaccessor")["default"];
+var CSS = require("./css")["default"];
/**
* Changing of element visibility support
@@ -1313,16 +1420,15 @@ var styleAccessor = require("./styleaccessor")["default"];
*/
var parseTimeValue = function(value) {
- var endIndex = value.length - 1;
-
- return value.lastIndexOf("ms") === endIndex - 1 || value.lastIndexOf("s") !== endIndex ?
- parseFloat(value) : parseFloat(value) * 1000;
+ var result = parseFloat(value) || 0;
+ // if duration is in seconds, then multiple result value by 1000
+ return value.lastIndexOf("ms") === value.length - 2 ? result : result * 1000;
},
- calcDuration = function(style, animation) {
- var prefix = animation ? "animation-" : "transition-",
- delay = styleAccessor.get[prefix + "delay"](style).split(","),
- duration = styleAccessor.get[prefix + "duration"](style).split(","),
- iterationCount = animation ? styleAccessor.get[prefix + "iteration-count"](style).split(",") : [];
+ calcDuration = function(style, prefix, iterationCount) {
+ var delay = CSS.get[prefix + "delay"](style).split(","),
+ duration = CSS.get[prefix + "duration"](style).split(",");
+
+ if (!iterationCount) iterationCount = CSS.get[prefix + "iteration-count"](style).split(",");
return Math.max.apply(Math, duration.map(function(value, index) {
var it = iterationCount[index] || "1";
@@ -1336,89 +1442,96 @@ var parseTimeValue = function(value) {
absentStrategy = !_.LEGACY_ANDROID && _.CSS3_ANIMATIONS ? ["position", "absolute"] : ["display", "none"],
changeVisibility = function(el, fn, callback) {return function() {return el.legacy(function(node, el, index, ref) {
var style = node.style,
- compStyle = _.computeStyle(node),
- isHidden = typeof fn === "function" ? fn(node) : fn,
- isDetached = !_.docEl.contains(node),
completeVisibilityChange = function() {
if (style.visibility === "hidden") {
style[absentStrategy[0]] = absentStrategy[1];
- } else {
+ }
+
+ if (!_.LEGACY_ANDROID && _.CSS3_ANIMATIONS) {
+ // remove temporary properties
style.pointerEvents = "";
+ style.willChange = "";
}
if (callback) callback(el, index, ref);
- },
- processVisibilityChange = function() {
- var duration, index, transition, absentance;
-
- // Android Browser is too slow and has a lot of bugs in
- // the implementation, so disable animations for them
- if (!_.LEGACY_ANDROID && _.CSS3_ANIMATIONS && !isDetached) {
- duration = Math.max(calcDuration(compStyle), calcDuration(compStyle, true));
- }
+ };
- if (duration) {
- // make sure that the visibility property will be changed
- // to trigger the completeAnimation callback
- if (!style.visibility) style.visibility = isHidden ? "visible" : "hidden";
+ // by using requestAnimationFrame we fix several issues:
+ // 1) animation of new added elements (http://christianheilmann.com/2013/09/19/quicky-fading-in-a-newly-created-element-using-css/)
+ // 2) firefox-specific animations sync quirks (because of the getComputedStyle call)
+ // 3) power consuption: looped show/hide does almost nothing if page is not active
+ _.raf(function() {
+ var compStyle = _.computeStyle(node),
+ isHidden = typeof fn === "function" ? fn(node) : fn,
+ duration, index, transition, absentance, completeAnimation, timeoutId;
+ // Legacy Android is too slow and has a lot of bugs in the CSS animations
+ // implementation, so skip animations for it (duration value is always zero)
+ if (!_.LEGACY_ANDROID && _.CSS3_ANIMATIONS) {
+ duration = Math.max(calcDuration(compStyle, "transition-", []), calcDuration(compStyle, "animation-"));
+ }
- transition = transitionProps.map(function(prop, index) {
- // have to use regexp to split transition-timing-function value
- return styleAccessor.get[prop](compStyle).split(index ? ", " : /, (?!\d)/);
- });
+ if (duration) {
+ // make sure that the visibility property will be changed
+ // to trigger the completeAnimation callback
+ if (!style.visibility) style.visibility = isHidden ? "visible" : "hidden";
- // try to find existing or use 0s length or make a new visibility transition
- index = transition[1].indexOf("visibility");
- if (index < 0) index = transition[2].indexOf("0s");
- if (index < 0) index = transition[0].length;
+ transition = transitionProps.map(function(prop, index) {
+ // have to use regexp to split transition-timing-function value
+ return CSS.get[prop](compStyle).split(index ? ", " : /, (?!\d)/);
+ });
- transition[0][index] = "linear";
- transition[1][index] = "visibility";
- transition[isHidden ? 2 : 3][index] = "0s";
- transition[isHidden ? 3 : 2][index] = duration + "ms";
+ // try to find existing or use 0s length or make a new visibility transition
+ index = transition[1].indexOf("visibility");
+ if (index < 0) index = transition[2].indexOf("0s");
+ if (index < 0) index = transition[0].length;
- transition.forEach(function(value, index) {
- styleAccessor.set[transitionProps[index]](style, value.join(", "));
- });
+ transition[0][index] = "linear";
+ transition[1][index] = "visibility";
+ transition[isHidden ? 2 : 3][index] = "0s";
+ transition[isHidden ? 3 : 2][index] = duration + "ms";
- node.addEventListener(eventType, function completeAnimation(e) {
- if (e.propertyName === "visibility") {
- e.stopPropagation(); // this is an internal event
+ transition.forEach(function(value, index) {
+ CSS.set[transitionProps[index]](style, value.join(", "));
+ });
- node.removeEventListener(eventType, completeAnimation, false);
+ // prevent accidental user actions during animation
+ style.pointerEvents = "none";
+ // use willChange to improve performance in modern browsers:
+ // http://dev.opera.com/articles/css-will-change-property/
+ style.willChange = transition[1].join(", ");
- completeVisibilityChange();
- }
- }, false);
- }
+ completeAnimation = function(e) {
+ if (!e || e.propertyName === "visibility") {
+ if (e) e.stopPropagation(); // this is an internal event
- if (isHidden) {
- absentance = style[absentStrategy[0]];
- // store current inline value in a internal property
- if (absentance !== "none") el.set("__visibility", absentance);
- // prevent accidental user actions during animation
- style.pointerEvents = "none";
- } else {
- // restore initial property value if it exists
- style[absentStrategy[0]] = el.get("__visibility") || "";
- }
+ clearTimeout(timeoutId);
- style.visibility = isHidden ? "hidden" : "visible";
- // trigger native CSS animation
- el.set("aria-hidden", String(isHidden));
- // must be AFTER changing the aria-hidden attribute
- if (!duration) completeVisibilityChange();
- };
+ node.removeEventListener(eventType, completeAnimation, false);
- // if element is not detached use requestAnimationFrame that fixes several issues:
- // 1) animation of new added elements (http://christianheilmann.com/2013/09/19/quicky-fading-in-a-newly-created-element-using-css/)
- // 2) firefox-specific animations sync quirks (because of the getComputedStyle call)
- // 3) power consuption: show/hide do almost nothing if page is not active
- if (isDetached) {
- processVisibilityChange();
- } else {
- _.raf(processVisibilityChange);
- }
+ completeVisibilityChange();
+ }
+ };
+
+ node.addEventListener(eventType, completeAnimation, false);
+ // make sure that the completeAnimation callback will be called
+ timeoutId = setTimeout(completeAnimation, duration + 1000 / 60);
+ }
+
+ if (isHidden) {
+ absentance = style[absentStrategy[0]];
+ // store current inline value in the internal property
+ if (absentance !== "none") el.set("__visibility", absentance);
+ } else {
+ // restore initial property value if it exists
+ style[absentStrategy[0]] = el.get("__visibility") || "";
+ }
+
+ style.visibility = isHidden ? "hidden" : "visible";
+ // trigger native CSS animation
+ el.set("aria-hidden", String(isHidden));
+ // must be AFTER changing the aria-hidden attribute
+ if (!duration) completeVisibilityChange();
+ });
})}},
makeVisibilityMethod = function(name, fn) {return function(delay, callback) {
var len = arguments.length,
@@ -1476,7 +1589,7 @@ $Element.prototype.hide = makeVisibilityMethod("hide", true);
$Element.prototype.toggle = makeVisibilityMethod("toggle", function(node) {
return node.getAttribute("aria-hidden") !== "true";
});
-},{"./element":12,"./styleaccessor":31,"./utils":32}],20:[function(require,module,exports){
+},{"./css":1,"./element":13,"./utils":32}],21:[function(require,module,exports){
"use strict";
var $Element = require("./element")["default"];
@@ -1500,7 +1613,7 @@ $Elements.prototype = new $Element();
$Elements.prototype.toString = Array.prototype.join;
exports["default"] = $Elements;
-},{"./element":12}],21:[function(require,module,exports){
+},{"./element":13}],22:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Element = require("./element")["default"];
@@ -1525,8 +1638,16 @@ var defaultArgs = ["target", "currentTarget", "defaultPrevented"],
// srcElement can be null in legacy IE when target is document
var target = e.target || e.srcElement || document,
currentTarget = matcher ? matcher(target) : node,
- fn = typeof callback === "string" ? el[callback] : callback,
- args = props || defaultArgs;
+ args = props || defaultArgs,
+ fn = callback;
+
+ if (typeof callback === "string") {
+ if (callback[0] === "-") {
+ fn = el._[callback.substr(1)];
+ } else {
+ fn = el[callback];
+ }
+ }
// early stop for late binding or when target doesn't match selector
if (typeof fn !== "function" || !currentTarget) return;
@@ -1624,7 +1745,7 @@ if (!_.DOM2_EVENTS) {
EventHandler.hooks = hooks;
exports["default"] = EventHandler;
-},{"./element":12,"./selectormatcher":30,"./utils":32}],22:[function(require,module,exports){
+},{"./element":13,"./selectormatcher":31,"./utils":32}],23:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -1638,7 +1759,7 @@ $Node.prototype.get = function(key) {
var el = this;
if (typeof key === "string") {
- if (key[0] === "_") {
+ if (key[0] === "_" || key[0] === "-") {
return this._[key.substr(1)];
} else {
return this._._node[key];
@@ -1660,7 +1781,7 @@ $Node.prototype.set = function(key, value) {var this$0 = this;
var keyType = typeof key;
if (keyType === "string") {
- if (key[0] === "_") {
+ if (key[0] === "_" || key[0] === "-") {
this._[key.substr(1)] = value;
} else {
this._._node[key] = value;
@@ -1673,7 +1794,7 @@ $Node.prototype.set = function(key, value) {var this$0 = this;
throw _.makeError("set");
};
-},{"./node":29,"./utils":32}],23:[function(require,module,exports){
+},{"./node":30,"./utils":32}],24:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -1699,7 +1820,7 @@ $Node.prototype.contains = function(element) {
throw _.makeError("contains");
};
-},{"./element":12,"./node":29,"./utils":32}],24:[function(require,module,exports){
+},{"./element":13,"./node":30,"./utils":32}],25:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -1732,7 +1853,7 @@ $Node.prototype.data = function(key, value) {var this$0 = this;
throw _.makeError("data", this);
};
-},{"./node":29,"./utils":32}],25:[function(require,module,exports){
+},{"./node":30,"./utils":32}],26:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -1781,7 +1902,7 @@ $Node.prototype.dispatch = function(method) {var SLICE$0 = Array.prototype.slice
return result;
};
-},{"./node":29,"./utils":32}],26:[function(require,module,exports){
+},{"./node":30,"./utils":32}],27:[function(require,module,exports){
var SLICE$0 = Array.prototype.slice;"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -1942,7 +2063,7 @@ $Node.prototype.fire = function(type) {var args = SLICE$0.call(arguments, 1);
return canContinue;
});
};
-},{"./eventhandler":21,"./node":29,"./utils":32}],27:[function(require,module,exports){
+},{"./eventhandler":22,"./node":30,"./utils":32}],28:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
var $Node = require("./node")["default"];
@@ -2027,7 +2148,7 @@ $Node.prototype.find = function(selector, /*INTERNAL*/all) {
$Node.prototype.findAll = function(selector) {
return this.find(selector, true);
};
-},{"./element":12,"./elements":20,"./node":29,"./utils":32}],28:[function(require,module,exports){
+},{"./element":13,"./elements":21,"./node":30,"./utils":32}],29:[function(require,module,exports){
"use strict";
var $Node = require("./node")["default"];
@@ -2053,6 +2174,7 @@ var reInvoke = /cb\.call\(([^)]+)\)/g,
/**
* Execute callback on each element in the collection
+ * @memberOf $Node.prototype
* @param {Function} callback function that accepts (element, index, self)
* @param {Object} [context] callback context
* @return {$Node}
@@ -2064,6 +2186,7 @@ $Node.prototype.each = makeLoopMethod({
/**
* Check if the callback returns true for any element in the collection
+ * @memberOf $Node.prototype
* @param {Function} callback function that accepts (element, index, self)
* @param {Object} [context] callback context
* @return {Boolean} true, if any element in the collection return true
@@ -2076,6 +2199,7 @@ $Node.prototype.some = makeLoopMethod({
/**
* Check if the callback returns true for all elements in the collection
+ * @memberOf $Node.prototype
* @param {Function} callback function that accepts (element, index, self)
* @param {Object} [context] callback context
* @return {Boolean} true, if all elements in the collection returns true
@@ -2089,6 +2213,7 @@ $Node.prototype.every = makeLoopMethod({
/**
* Create an array of values by running each element in the collection through the callback
+ * @memberOf $Node.prototype
* @param {Function} callback function that accepts (element, index, self)
* @param {Object} [context] callback context
* @return {Array} new array of the results of each callback execution
@@ -2102,6 +2227,7 @@ $Node.prototype.map = makeLoopMethod({
/**
* Examine each element in a collection, returning an array of all elements the callback returns truthy for
+ * @memberOf $Node.prototype
* @param {Function} callback function that accepts (element, index, self)
* @param {Object} [context] callback context
* @return {Array} new array with elements where callback returned true
@@ -2115,6 +2241,7 @@ $Node.prototype.filter = makeLoopMethod({
/**
* Boil down a list of values into a single value (from start to end)
+ * @memberOf $Node.prototype
* @param {Function} callback function that accepts (memo, element, index, self)
* @param {Object} [memo] initial value of the accumulator
* @return {Object} the accumulated value
@@ -2128,6 +2255,7 @@ $Node.prototype.reduce = makeLoopMethod({
/**
* Boil down a list of values into a single value (from end to start)
+ * @memberOf $Node.prototype
* @param {Function} callback function that accepts (memo, element, index, self)
* @param {Object} [memo] initial value of the accumulator
* @return {Object} the accumulated value
@@ -2149,7 +2277,7 @@ $Node.prototype.reduceRight = makeLoopMethod({
$Node.prototype.legacy = makeLoopMethod({
BODY: "cb.call(that, this[i]._._node, this[i], i, this)"
});
-},{"./node":29}],29:[function(require,module,exports){
+},{"./node":30}],30:[function(require,module,exports){
"use strict";
/**
* Used to represent a DOM node
@@ -2165,7 +2293,7 @@ function $Node(node) {
}
exports["default"] = $Node;
-},{}],30:[function(require,module,exports){
+},{}],31:[function(require,module,exports){
"use strict";
var _ = require("./utils")["default"];
/*
@@ -2218,86 +2346,6 @@ exports["default"] = function(selector, context) {
return result && node;
};
}
-},{"./utils":32}],31:[function(require,module,exports){
-"use strict";
-var _ = require("./utils")["default"];
-/*
- * Helper for accessing css
- */
-var hooks = {get: {}, set: {}},
- reDash = /\-./g,
- reCamel = /[A-Z]/g,
- directions = ["Top", "Right", "Bottom", "Left"],
- computed = _.computeStyle(_.docEl),
- // In Opera CSSStyleDeclaration objects returned by _.computeStyle have length 0
- props = computed.length ? _.slice.call(computed, 0) : Object.keys(computed).map(function(key) {
- return key.replace(reCamel, function(str) {return "-" + str.toLowerCase()});
- });
-
-props.forEach(function(propName) {
- var prefix = propName[0] === "-" ? propName.substr(1, propName.indexOf("-", 1) - 1) : null,
- unprefixedName = prefix ? propName.substr(prefix.length + 2) : propName,
- stylePropName = propName.replace(reDash, function(str) {return str[1].toUpperCase()});
- // most of browsers starts vendor specific props in lowercase
- if (!(stylePropName in computed)) {
- stylePropName = stylePropName[0].toLowerCase() + stylePropName.substr(1);
- }
-
- if (stylePropName !== propName) {
- hooks.get[unprefixedName] = function(style) {return style[stylePropName]};
- hooks.set[unprefixedName] = function(style, value) {
- value = typeof value === "number" ? value + "px" : value.toString();
- // use cssText property to determine DOM.importStyles call
- style["cssText" in style ? stylePropName : propName] = value;
- };
- }
-});
-
-// Exclude the following css properties from adding px
-" float fill-opacity font-weight line-height opacity orphans widows z-index zoom ".split(" ").forEach(function(propName) {
- var stylePropName = propName.replace(reDash, function(str) {return str[1].toUpperCase()});
-
- if (propName === "float") {
- stylePropName = "cssFloat" in computed ? "cssFloat" : "styleFloat";
- // normalize float css property
- hooks.get[propName] = function(style) {return style[stylePropName]};
- }
-
- hooks.set[propName] = function(style, value) {
- style["cssText" in style ? stylePropName : propName] = value.toString();
- };
-});
-
-// normalize property shortcuts
-_.forOwn({
- font: ["fontStyle", "fontSize", "/", "lineHeight", "fontFamily"],
- padding: directions.map(function(dir) {return "padding" + dir}),
- margin: directions.map(function(dir) {return "margin" + dir}),
- "border-width": directions.map(function(dir) {return "border" + dir + "Width"}),
- "border-style": directions.map(function(dir) {return "border" + dir + "Style"})
-}, function(props, key) {
- hooks.get[key] = function(style) {
- var result = [],
- hasEmptyStyleValue = function(prop, index) {
- result.push(prop === "/" ? prop : style[prop]);
-
- return !result[index];
- };
-
- return props.some(hasEmptyStyleValue) ? "" : result.join(" ");
- };
-
- hooks.set[key] = function(style, value) {
- if (value && "cssText" in style) {
- // normalize setting complex property across browsers
- style.cssText += ";" + key + ":" + value;
- } else {
- props.forEach(function(name) {return style[name] = typeof value === "number" ? value + "px" : value.toString()});
- }
- };
-});
-
-exports["default"] = hooks;
},{"./utils":32}],32:[function(require,module,exports){
"use strict";
var doc = document,
@@ -2363,4 +2411,4 @@ exports["default"] = {
each: Array.prototype.forEach,
some: Array.prototype.some
};
-},{}]},{},[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]);
+},{}]},{},[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32])
View
4 dist/better-dom.min.js
@@ -1,9 +1,9 @@
/**
* @file better-dom.js
- * @version 1.7.5 2014-04-14T18:47:43
+ * @version 1.7.6 2014-07-21T01:32:45
* @overview Live extension playground
* @copyright 2013-2014 Maksim Chemerisuk
* @license MIT
* @see https://github.com/chemerisuk/better-dom
*/
-!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=a("./element")["default"],e=a("./elements")["default"],f=/^\w+$/,g=document.createElement("body");c.create=function(a,h){if(1===a.nodeType)return d(a);if("string"!=typeof a)throw b.makeError("create",!0);if(f.test(a))a=document.createElement(a);else{g.innerHTML=c.template(a,h);for(var i=[];a=g.firstChild;g.removeChild(a))1===a.nodeType&&i.push(a);if(1!==i.length)return new e(i);a=i[0]}return new d(a)}},{"./dom":5,"./element":12,"./elements":20,"./utils":32}],2:[function(a){"use strict";var b,c,d,e,f=a("./utils")["default"],g=a("./dom")["default"],h=a("./element")["default"],i=a("./selectormatcher")["default"],j=/^(on|do)[A-Z]/,k=[],l=function(){return!0},m=function(){return!1},n=function(a,b){f.forOwn(b,function(b,c){"constructor"!==c&&(a[c]=b)})},o=function(a){k.forEach(function(b){b.accept(a)&&b(a,!0)}),f.each.call(a.children,o)},p=function(a,b){return function(d){var e;d=d||window.event,e=f.CSS3_ANIMATIONS?d.animationName===c&&d.target===a:"dataavailable"===d.srcUrn&&d.srcElement===a,e&&((d._skip=d._skip||{})[b]=!0)}},q=function(a,b){return function(c,d){!b[d]&&c.accept(a)&&c(a)}};if(f.CSS3_ANIMATIONS)b=f.WEBKIT_PREFIX?"webkitAnimationStart":"animationstart",c="DOM"+(new Date).getTime(),setTimeout(function(){return g.importStyles("@"+f.WEBKIT_PREFIX+"keyframes "+c,"from {opacity:.99} to {opacity:1}")},0),e={"animation-duration":"1ms !important","animation-name":c+" !important"},document.addEventListener(b,function(a){a.animationName===c&&k.forEach(q(a.target,a._skip||{}))},!1);else{if(b="ondataavailable",d=document.querySelector("link[rel=htc]"),!d)throw"You forgot to include <link rel='htc'> for IE < 10";e={behavior:"url("+d.href+") !important"},document.attachEvent(b,function(){var a=window.event;"dataavailable"===a.srcUrn&&k.forEach(q(a.srcElement,a._skip||{}))})}g.extend=function(a,c,d){if(2===arguments.length&&(d=c,c=!0),"boolean"==typeof c&&(c=c?l:m),!d||"object"!=typeof d||"function"!=typeof c)throw f.makeError("extend",!0);if("*"===a)n(h.prototype,d);else{var o=Object.keys(d).filter(function(a){return!!j.exec(a)}),q=d.hasOwnProperty("constructor")&&d.constructor,r=k.length,s=function(a,e){var g=h(a);f.CSS3_ANIMATIONS?a.addEventListener(b,p(a,r),!1):a.attachEvent(b,p(a,r)),(e===!0||c(g)!==!1)&&(n(g,d),q&&g.dispatch(q),e!==!0&&o.forEach(function(a){delete g[a]}))};s.accept=i(a),k.push(s),g.ready(function(){f.each.call(document.querySelectorAll(a),s),g.importStyles(a,e)})}},g.mock=function(a,b){return a?g.create(a,b).legacy(o):new h}},{"./dom":5,"./element":12,"./selectormatcher":30,"./utils":32}],3:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"];c.importScripts=function(){var a=Array.prototype.slice,c=a.call(arguments,0),d=function(){var a,e=c.shift(),f=typeof e;if("string"===f)a=document.createElement("script"),a.src=e,a.onload=d,a.async=!0,b.injectElement(a);else if("function"===f)e();else if(e)throw b.makeError("importScripts",!0)};d()}},{"./dom":5,"./utils":32}],4:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=a("./styleaccessor")["default"],e=b.injectElement(document.createElement("style")),f=e.sheet||e.styleSheet,g=f.cssRules||f.rules;c.importStyles=function(a,c){if(c&&"object"==typeof c){var e={};b.forOwn(c,function(a,b){var c=d.set[b];a="number"==typeof a?a+"px":a||"",c?c(e,a):e[b]=a}),c=[],b.forOwn(e,function(a,b){c.push(b+":"+a)}),c=c.join(";")}if("string"!=typeof a||"string"!=typeof c)throw b.makeError("importStyles",!0);f.cssRules?f.insertRule(a+" {"+c+"}",g.length):a.split(",").forEach(function(a){f.addRule(a,c)})}},{"./dom":5,"./styleaccessor":31,"./utils":32}],5:[function(a,b,c){"use strict";var d=a("./node")["default"],e=new d(document);e.version="1.7.5",e.template=function(a){return a},c["default"]=window.DOM=e},{"./node":29}],6:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=[],e=document.readyState,f=function(){d&&(d=d.forEach(c.dispatch,c))};(document.attachEvent?"complete"===e:"loading"!==e)?setTimeout(f,0):b.DOM2_EVENTS?(window.addEventListener("load",f,!1),document.addEventListener("DOMContentLoaded",f,!1)):(window.attachEvent("onload",f),document.attachEvent("ondataavailable",function(){"DOMContentLoaded"===window.event.srcUrn&&f()})),c.ready=function(a){if("function"!=typeof a)throw b.makeError("ready",!0);d?d.push(a):c.dispatch(a)}},{"./dom":5,"./utils":32}],7:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d={"(":1,")":2,"^":3,">":4,"+":4,"*":5,"`":6,"]":5,"[":6,".":7,"#":8},e=/([\w\-]+)(?:=((?:(`|')((?:\\?.)*)?\3)|[^\s]+))?/g,f=/(\$+)(?:@(-)?(\d+)?)?/g,g=/^[\s<]/,h={},i=function(a){return a.join?a.join(""):a},j=function(a,b,c,d,e){return d&&"`"!==d||(d='"'),b+"="+d+(e||c||b)+d},k=function(a,b){return function(c){var d=b?c.indexOf(">"):c.lastIndexOf("<");return c.substr(0,d)+a+c.substr(d)}},l=function(a){var b=h[a];return b||(b=h[a]="<"+a+"></"+a+">"),b},m=function(a){return function(b,c,d){return a.replace(f,function(a,b,e,f){var g=(e?d.length-c-1:c)+(f?+f:1);return(b+g).slice(-b.length).split("$").join("0")})}};"area base br col hr img input link meta param command keygen source".split(" ").forEach(function(a){h[a]="<"+a+">"}),c.template=function(a,c){if("string"!=typeof a)throw b.makeError("template",!0);c&&(a=b.format(a,c));var f,n,o,p,q,r,s=[],t=[],u="";if(a in h)return h[a];if(!a||g.exec(a))return a;for(f=0,n=a.length;n>f;++f)if(o=a[f],"."===o&&"."===s[0]&&(o=" "),p=d[o],!p||q&&q!==o)u+=o;else{if("+"===o&&"`"===s[0]&&(o=">"),"^"===o&&"^"===s[0]&&s.shift(),u&&(t.push(u),u=""),"("!==o)for(;d[s[0]]>p&&(t.push(s.shift()),"^"!==o||">"!==t[t.length-1]););")"===o?s.shift():q?q=!1:(s.unshift(o),"["===o&&(q="]"),"`"===o&&(q="`"))}for(u&&t.push(u),t=t.concat(s),s=[],f=0,n=t.length;n>f;++f){if(o=t[f],o in d){switch(u=s.shift(),r=s.shift()||[""],"string"==typeof r&&(r=[l(r)]),o){case".":u=k(' class="'+u+'"',!0);break;case"#":u=k(' id="'+u+'"',!0);break;case"[":u=k(" "+u.replace(e,j),!0);break;case"`":u=k(u);break;case"*":r=this.map.call(Array(+u),m(i(r)));break;default:u="string"==typeof u?l(u):i(u),">"===o?u=k(u):r.push(u)}o="function"==typeof u?r.map(u):r}s.unshift(o)}return t=i(s[0]),c?t:h[a]=t}},{"./dom":5,"./utils":32}],8:[function(a){"use strict";function b(a,b){var d="contains"===a?"hasClass":a+"Class";return c.docEl.classList&&(b=function(b){return this._._node.classList[a](b)}),"hasClass"===d?function(a){var c=arguments;return this._._node?1===c.length?b.call(this,a):this.every.call(c,b,this):void 0}:function(a){var d=arguments;return this.each(function(e){1===d.length?b.call(e,a):c.each.call(d,b,e)})}}var c=a("./utils")["default"],d=a("./element")["default"],e=/[\n\t\r]/g;d.prototype.hasClass=b("contains",function(a){return(" "+this._._node.className+" ").replace(e," ").indexOf(" "+a+" ")>=0}),d.prototype.addClass=b("add",function(a){this.hasClass(a)||(this._._node.className+=" "+a)}),d.prototype.removeClass=b("remove",function(a){a=(" "+this._._node.className+" ").replace(e," ").replace(" "+a+" "," "),this._._node.className=a.trim()}),d.prototype.toggleClass=b("toggle",function(a){var b=this._._node.className;this.addClass(a),b===this._._node.className&&this.removeClass(a)})},{"./element":12,"./utils":32}],9:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"];c.prototype.clone=function(){var a=arguments[0];if(void 0===a&&(a=!0),"boolean"!=typeof a)throw b.makeError("clone");var d,e=this._._node;return e?b.DOM2_EVENTS?d=new c(e.cloneNode(a)):(d=DOM.create(e.outerHTML),a||d.set("innerHTML","")):d=new c,d}},{"./element":12,"./utils":32}],10:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"],e={};d.prototype.get=function(a){var b,d,f=this._,g=f._node,h=e[a];if(g){if(h)return h(g,a);if("string"==typeof a){if("_"===a[0]){if(b=a.substr(1),b in f)d=f[b];else{try{d=g.getAttribute("data-"+b),"{"===d[0]&&"}"===d[d.length-1]&&(d=JSON.parse(d))}catch(i){}null!=d&&(f[b]=d)}return d}return a in g?g[a]:g.getAttribute(a)}return c.prototype.get.call(this,a)}},e.undefined=function(a){var b;if("OPTION"===a.tagName)b=a.hasAttribute("value")?"value":"text";else{if("SELECT"===a.tagName)return~a.selectedIndex?a.options[a.selectedIndex].value:"";b=a.type&&"value"in a?"value":"innerHTML"}return a[b]},e.type=function(a){return a.getAttribute("type")||a.type},b.DOM2_EVENTS||(e.textContent=function(a){return a.innerText})},{"./element":12,"./node":29,"./utils":32}],11:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=a("./element")["default"],e={},f=[];d.prototype.i18n=function(a,c){var d=this,g=arguments.length;if(!g)return this.get("data-i18n");if(g>2||a&&"string"!=typeof a||c&&"object"!=typeof c)throw b.makeError("i18n");return[a].concat(e[a]).forEach(function(a,e){var g="data-i18n"+(e?"-"+f[e-1]:"");a&&d.set(g,c?b.format(a,c):a)}),this.set("")},c.importStrings=function(a,d,g){var h=typeof d,i="data-i18n-"+a,j=f.indexOf(a);if("string"===h)-1===j&&(j=f.push(a)-1,c.importStyles("["+i+"]:lang("+a+"):before","content:attr("+i+")")),e[d]||(e[d]=[]),e[d][j]=g,c.ready(function(){return c.findAll('[data-i18n="'+d+'"]').set(i,g)});else{if("object"!==h)throw b.makeError("importStrings",!0);b.forOwn(d,function(b,d){return c.importStrings(a,d,b)})}},c.importStyles("[data-i18n]:before","content:attr(data-i18n)")},{"./dom":5,"./element":12,"./utils":32}],12:[function(a,b,c){"use strict";function d(a){return a&&a.__dom__?a.__dom__:this instanceof d?void e.call(this,a):new d(a)}var e=a("./node")["default"];d.prototype=new e,d.prototype.toString=function(){var a=this._._node;return a?a.tagName.toLowerCase():""},c["default"]=d},{"./node":29}],13:[function(a){"use strict";function b(a,b,e,f){return function(){var g=arguments;return this.legacy(function(h,i,j,k){if(e||h.parentNode&&1===h.parentNode.nodeType){var l,m="";c.each.call(g,function(b){if("function"==typeof b&&(b=b(i,j,k)),"string"==typeof b)m+=DOM.template(b).trim();else{if(!(b instanceof d))throw c.makeError(a);l||(l=document.createDocumentFragment()),b.legacy(function(a){return l.appendChild(a)})}}),!b&&m&&(l=DOM.create(m)._._node),!b||l?f(h,l):m&&h.insertAdjacentHTML(b,m)}})}}var c=a("./utils")["default"],d=a("./element")["default"];d.prototype.after=b("after","afterend",!1,function(a,b){a.parentNode.insertBefore(b,a.nextSibling)}),d.prototype.before=b("before","beforebegin",!1,function(a,b){a.parentNode.insertBefore(b,a)}),d.prototype.prepend=b("prepend","afterbegin",!0,function(a,b){a.insertBefore(b,a.firstChild)}),d.prototype.append=b("append","beforeend",!0,function(a,b){a.appendChild(b)}),d.prototype.replace=b("replace","",!1,function(a,b){a.parentNode.replaceChild(b,a)}),d.prototype.remove=b("remove","",!1,function(a){a.parentNode.removeChild(a)})},{"./element":12,"./utils":32}],14:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"],d=a("./selectormatcher")["default"],e={};c.prototype.matches=function(a){if(!a||"string"!=typeof a)throw b.makeError("matches");var c=e[a]||d(a),f=this._._node;return f&&!!c(f)},e[":focus"]=function(a){return a===document.activeElement},e[":hidden"]=function(a){return"true"===a.getAttribute("aria-hidden")||"none"===b.computeStyle(a).display||!b.docEl.contains(a)},e[":visible"]=function(a){return!e[":hidden"](a)}},{"./element":12,"./selectormatcher":30,"./utils":32}],15:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"];c.prototype.offset=function(){var a,c=this._._node,d=b.docEl.clientTop,e=b.docEl.clientLeft,f=window.pageYOffset||b.docEl.scrollTop,g=window.pageXOffset||b.docEl.scrollLeft;return c?(a=c.getBoundingClientRect(),{top:a.top+f-d,left:a.left+g-e,right:a.right+g-e,bottom:a.bottom+f-d,width:a.right-a.left,height:a.bottom-a.top}):void 0}},{"./element":12,"./utils":32}],16:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"],e={};d.prototype.set=function(a,d){var f=typeof a;return 1===arguments.length&&"object"!==f&&(d=a,a=void 0),this.legacy(function(g,h,i,j){var k,l=e[a],m=(h._._watchers||{})[a||("value"in g?"value":"innerHTML")],n=d;if(m&&(k=h.get(a)),a&&"_"===a[0])h._[a.substr(1)]=n;else{if("function"==typeof n&&(n=d(h,i,j)),l)l(g,n);else{if("string"!==f)return c.prototype.set.call(h,a);null==n?g.removeAttribute(a):a in g?g[a]=n:g.setAttribute(a,n)}(!b.DOM2_EVENTS||b.LEGACY_ANDROID)&&(g.className=g.className)}m&&k!==n&&m.forEach(function(a){h.dispatch(a,n,k)})})},d.prototype.watch=function(a,b){return this.each(function(c){var d=c._._watchers;d||c.set("__watchers",d={}),(d[a]||(d[a]=[])).push(b)})},d.prototype.unwatch=function(a,b){var c=function(a){return a!==b};return this.each(function(b){var d=b._._watchers;d&&(d[a]=(d[a]||[]).filter(c))})},e.undefined=function(a,c){var d;c=null==c?"":String(c),"SELECT"===a.tagName?b.every.call(a.options,function(a){return!(a.selected=a.value===c)})&&(a.selectedIndex=-1):d=a.type&&"value"in a?b.DOM2_EVENTS?"value":"innerText":"innerHTML",d&&(a[d]=c)},b.DOM2_EVENTS||(e.textContent=function(a,b){a.innerText=b})},{"./element":12,"./node":29,"./utils":32}],17:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"],d=a("./styleaccessor")["default"];c.prototype.style=function(a,c){var e,f,g,h=arguments.length,i=this._._node,j=typeof a;return 1!==h||"string"!==j&&!Array.isArray(a)?this.legacy(function(e,f,g,i){var k=e.style,l=function(a,b){var c=d.set[b];"function"==typeof a&&(a=a(f,g,i)),null==a&&(a=""),c?c(k,a):k[b]="number"==typeof a?a+"px":a.toString()};if(1===h&&a&&"object"===j)b.forOwn(a,l);else{if(2!==h||"string"!==j)throw b.makeError("style");l(c,a)}}):(i&&(e=i.style,c=("string"===j?[a]:a).reduce(function(a,h){return f=d.get[h],c=f?f(e):e[h],g||c||(e=b.computeStyle(i),c=f?f(e):e[h],g=!0),a[h]=c,a},{})),i&&"string"===j?c[a]:c)}},{"./element":12,"./styleaccessor":31,"./utils":32}],18:[function(a){"use strict";function b(a,b,c){return function(h,i){if(h&&"string"!=typeof h)throw d.makeError(a);var j=g(h),k=c?[]:null,l=this._._node;for(l=l&&!i?l[b]:l;l;l=l[b])if(1===l.nodeType&&(!j||j(l))){if(!c)return e(l);k.push(l)}return new f(k)}}function c(a){return function(b){if(a){if(b&&"string"!=typeof b)throw d.makeError("children")}else if(b&&"number"!=typeof b)throw d.makeError("child");var c=this._._node,h=c?c.children:null;return c?(d.DOM2_EVENTS||(h=this.filter.call(h,function(a){return 1===a.nodeType})),a?new f(b?this.filter.call(h,g(b)):h):(0>b&&(b=h.length+b),e(h[b]))):new e}}var d=a("./utils")["default"],e=a("./element")["default"],f=a("./elements")["default"],g=a("./selectormatcher")["default"];e.prototype.next=b("next","nextSibling"),e.prototype.prev=b("prev","previousSibling"),e.prototype.nextAll=b("nextAll","nextSibling",!0),e.prototype.prevAll=b("prevAll","previousSibling",!0),e.prototype.parent=b("parent","parentNode"),e.prototype.child=c(!1),e.prototype.children=c(!0)},{"./element":12,"./elements":20,"./selectormatcher":30,"./utils":32}],19:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"],d=a("./styleaccessor")["default"],e=function(a){var b=a.length-1;return a.lastIndexOf("ms")===b-1||a.lastIndexOf("s")!==b?parseFloat(a):1e3*parseFloat(a)},f=function(a,b){var c=b?"animation-":"transition-",f=d.get[c+"delay"](a).split(","),g=d.get[c+"duration"](a).split(","),h=b?d.get[c+"iteration-count"](a).split(","):[];return Math.max.apply(Math,g.map(function(a,b){var c=h[b]||"1";return("initial"===c?1:parseFloat(c))*e(a)+(e(f[b])||0)}))},g=["timing-function","property","duration","delay"].map(function(a){return"transition-"+a}),h=b.WEBKIT_PREFIX?"webkitTransitionEnd":"transitionend",i=!b.LEGACY_ANDROID&&b.CSS3_ANIMATIONS?["position","absolute"]:["display","none"],j=function(a,c,e){return function(){return a.legacy(function(a,j,k,l){var m=a.style,n=b.computeStyle(a),o="function"==typeof c?c(a):c,p=!b.docEl.contains(a),q=function(){"hidden"===m.visibility?m[i[0]]=i[1]:m.pointerEvents="",e&&e(j,k,l)},r=function(){var c,e,k,l;b.LEGACY_ANDROID||!b.CSS3_ANIMATIONS||p||(c=Math.max(f(n),f(n,!0))),c&&(m.visibility||(m.visibility=o?"visible":"hidden"),k=g.map(function(a,b){return d.get[a](n).split(b?", ":/, (?!\d)/)}),e=k[1].indexOf("visibility"),0>e&&(e=k[2].indexOf("0s")),0>e&&(e=k[0].length),k[0][e]="linear",k[1][e]="visibility",k[o?2:3][e]="0s",k[o?3:2][e]=c+"ms",k.forEach(function(a,b){d.set[g[b]](m,a.join(", "))}),a.addEventListener(h,function r(b){"visibility"===b.propertyName&&(b.stopPropagation(),a.removeEventListener(h,r,!1),q())},!1)),o?(l=m[i[0]],"none"!==l&&j.set("__visibility",l),m.pointerEvents="none"):m[i[0]]=j.get("__visibility")||"",m.visibility=o?"hidden":"visible",j.set("aria-hidden",String(o)),c||q()};p?r():b.raf(r)})}},k=function(a,c){return function(d,e){var f=arguments.length,g=typeof d;if(1===f&&"function"===g&&(e=d,d=0),d&&("number"!==g||0>d)||e&&"function"!=typeof e)throw b.makeError(a);return e=j(this,c,e),d?setTimeout(e,d):e(),this}};c.prototype.show=k("show",!1),c.prototype.hide=k("hide",!0),c.prototype.toggle=k("toggle",function(a){return"true"!==a.getAttribute("aria-hidden")})},{"./element":12,"./styleaccessor":31,"./utils":32}],20:[function(a,b,c){"use strict";function d(a){for(var b=0,c=a&&a.length||0;c>b;++b)this[b]=e(a[b]);this._={},this.length=c}var e=a("./element")["default"];d.prototype=new e,d.prototype.toString=Array.prototype.join,c["default"]=d},{"./element":12}],21:[function(a,b,c){"use strict";var d=a("./utils")["default"],e=a("./element")["default"],f=a("./selectormatcher")["default"],g=["target","currentTarget","defaultPrevented"],h="dataavailable",i={},j=function(a,b,c,k,l,m,n){var o=i[a],p=f(b,m),q=function(b){if(b=b||window.event,j.skip!==a&&(q._type!==h||b.srcUrn===a)){var f=b.target||b.srcElement||document,i=p?p(f):m,o="string"==typeof c?l[c]:c,r=k||g;"function"==typeof o&&i&&(n&&l.off(a,c),r=r.map(function(c){if(!d.DOM2_EVENTS)switch(c){case"which":return b.keyCode;case"button":var g=b.button;return 1&g?1:2&g?3:4&g?2:0;case"pageX":return b.pageX||b.clientX+d.docEl.scrollLeft-d.docEl.clientLeft;case"pageY":return b.clientY+d.docEl.scrollTop-d.docEl.clientTop}switch(c){case"type":return a;case"defaultPrevented":return"defaultPrevented"in b?b.defaultPrevented:b.returnValue===!1;case"target":return e(f);case"currentTarget":return e(i);case"relatedTarget":return e(b.relatedTarget||b[(b.toElement===m?"from":"to")+"Element"])}return b[c]}),b._args&&(r=b._args.concat(r)),o.apply(l,r)===!1&&(d.DOM2_EVENTS?b.preventDefault():b.returnValue=!1))}};return o&&(q=o(q,a)||q),d.DOM2_EVENTS||"on"+(q._type||a)in m||(q._type=h),q.type=b?a+" "+b:a,q.callback=c,q};["scroll","mousemove"].forEach(function(a){i[a]=function(a){var b=!0;return function(c){b&&(b=d.raf(function(){b=!a(c)}))}}}),"onfocusin"in d.docEl?d.forOwn({focus:"focusin",blur:"focusout"},function(a,b){i[b]=function(b){b._type=a}}):i.focus=i.blur=function(a){a.capturing=!0},document.createElement("input").validity&&(i.invalid=function(a){a.capturing=!0}),d.DOM2_EVENTS||["submit","change","reset"].forEach(function(a){i[a]=function(a){a._type=h}}),j.hooks=i,c["default"]=j},{"./element":12,"./selectormatcher":30,"./utils":32}],22:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"];c.prototype.get=function(a){var c=this;if("string"==typeof a)return"_"===a[0]?this._[a.substr(1)]:this._._node[a];if(Array.isArray(a))return a.reduce(function(a,b){return a[b]=c.get(b),a},{});throw b.makeError("get")},c.prototype.set=function(a,c){var d=this,e=typeof a;if("string"===e)return"_"===a[0]?this._[a.substr(1)]=c:this._._node[a]=c,this;if(a&&"object"===e)return b.forOwn(a,function(a,b){d.set(b,a)});throw b.makeError("set")}},{"./node":29,"./utils":32}],23:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"];c.prototype.contains=function(a){var c=this._._node;if(a instanceof d)return c&&a.every(function(a){return c.contains(a._._node)});throw b.makeError("contains")}},{"./element":12,"./node":29,"./utils":32}],24:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"];c.prototype.data=function(a,c){var d=this,e=arguments.length,f=typeof a;if(1===e){if("string"===f)return this.get("_"+a);if(a&&"object"===f)return Array.isArray(a)?this.get(a.map(function(a){return"_"+a})):b.forOwn(a,function(a,b){d.set("_"+b,a)})}else if(2===e)return this.each(function(b){b.set("_"+a,c)});throw b.makeError("data",this)}},{"./node":29,"./utils":32}],25:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=document.createElement("a"),e="onpropertychange";b.DOM2_EVENTS&&(d[e="handleEvent"]=null,d.addEventListener(e,d,!1)),c.prototype.dispatch=function(a){var c,f,g,h=Array.prototype.slice,i=h.call(arguments,1),j=typeof a,k=this,l=this._._node;if(l){if("function"===j)c=function(){f=a.apply(k,i)};else{if("string"!==j)throw b.makeError("dispatch");c=function(){f=l[a].apply(l,i)}}d[e]=c,b.DOM2_EVENTS&&(g=document.createEvent("HTMLEvents"),g.initEvent(e,!1,!1),d.dispatchEvent(g)),d[e]=null}return f}},{"./node":29,"./utils":32}],26:[function(a){var b=Array.prototype.slice,c=a("./utils")["default"],d=a("./node")["default"],e=a("./eventhandler")["default"];d.prototype.on=function(a,b,d,f){var g,h,i,j=this,k=typeof a;if("string"!==k){if("object"===k)return Array.isArray(a)?(i=c.slice.call(arguments,1),a.forEach(function(a){j.on.apply(j,[a].concat(i))})):c.forOwn(a,function(a,b){j.on(b,a)}),this;throw c.makeError("on")}return h=a.indexOf(" "),~h&&(g=a.substr(h+1),a=a.substr(0,h)),Array.isArray(d)||(f=d,d=void 0),this.legacy(function(h,i){var j=e(a,g,b,d,i,h,f);c.DOM2_EVENTS?h.addEventListener(j._type||a,j,!!j.capturing):(i===DOM&&"scroll"===a&&(h=window),h.attachEvent("on"+(j._type||a),j)),i._._handlers.push(j)})},d.prototype.once=function(){var a=b.call(arguments,0);return this.on.apply(this,a.concat(!0))},d.prototype.off=function(a,b){if("string"!=typeof a)throw c.makeError("off");return this.legacy(function(d,e){e.set("__handlers",e._._handlers.filter(function(f){return a!==f.type||b&&b!==f.callback?!0:(a=f._type||f.type,void(c.DOM2_EVENTS?d.removeEventListener(a,f,!!f.capturing):(e===DOM&&"scroll"===a&&(d=window),d.detachEvent("on"+a,f))))}))})},d.prototype.fire=function(a){var d,f=b.call(arguments,1),g=typeof a,h={};if("string"!==g)throw c.makeError("fire");return(d=e.hooks[a])&&(h=d(h)||h),g=h._type||a,this.every(function(b){var d,h,i=b._._node;return c.DOM2_EVENTS?(d=document.createEvent("HTMLEvents"),d.initEvent(g,!0,!0),d._args=f,h=i.dispatchEvent(d)):(d=document.createEventObject(),d._args=f,"on"+g in i||(g="dataavailable"),"dataavailable"===g&&(d.srcUrn=a),i.fireEvent("on"+g,d),h=d.returnValue!==!1),h&&i[a]&&("focus"!==a&&"blur"!==a||i.offsetWidth)&&(e.skip=a,i[a](),e.skip=null),h})}},{"./eventhandler":21,"./node":29,"./utils":32}],27:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"],e=a("./elements")["default"],f=document.getElementsByClassName?/^(?:(\w+)|\.([\w\-]+))$/:/^(?:(\w+))$/,g=/[\x20\t\r\n\f]*[+~>]/,h=/'|\\/g,i="DOM"+(new Date).getTime();c.prototype.find=function(a,c){if("string"!=typeof a)throw b.makeError("find");var j,k,l,m,n=this._._node,o=f.exec(a);if(!n)return new d;if(o)j=o[1]?n.getElementsByTagName(a):n.getElementsByClassName(o[2]),j&&!c&&(j=j[0]);else{k=!0,l=i,m=n,n!==document&&((k=n.getAttribute("id"))?l=k.replace(h,"\\$&"):n.setAttribute("id",l),l="[id='"+l+"'] ",m=g.test(a)?n.parentNode:n,a=l+a.split(",").join(","+l));try{j=m[c?"querySelectorAll":"querySelector"](a)}finally{k||n.removeAttribute("id")}}return c?new e(j):d(j)},c.prototype.findAll=function(a){return this.find(a,!0)}},{"./element":12,"./elements":20,"./node":29,"./utils":32}],28:[function(a){"use strict";var b=a("./node")["default"],c=/cb\.call\(([^)]+)\)/g,d={BEGIN:"",BODY:"",END:"return this"},e=function(a){var b,e="%BEGIN%\nfor(var i=0,n=this.length;i<n;++i){%BODY%}%END%";for(b in d)e=e.replace("%"+b+"%",a[b]||d[b]);return e=e.replace(c,function(a,b){return"(that?"+a+":cb("+b.split(",").slice(1).join()+"))"}),Function("cb","that","undefined",e)};b.prototype.each=e({BODY:"cb.call(that, this[i], i, this)"}),b.prototype.some=e({BODY:"if (cb.call(that, this[i], i, this) === true) return true",END:"return false"}),b.prototype.every=e({BEGIN:"var out = true",BODY:"out = cb.call(that, this[i], i, this) && out",END:"return out"}),b.prototype.map=e({BEGIN:"var out = Array(this && this.length || 0)",BODY:"out[i] = cb.call(that, this[i], i, this)",END:"return out"}),b.prototype.filter=e({BEGIN:"var out = []",BODY:"if (cb.call(that, this[i], i, this)) out.push(this[i])",END:"return out"}),b.prototype.reduce=e({BEGIN:"var len = arguments.length; if (len < 2) that = this[0]",BODY:"that = cb(that, this[len < 2 ? i + 1 : i], i, this)",END:"return that"}),b.prototype.reduceRight=e({BEGIN:"var j, len = arguments.length; if (len < 2) that = this[this.length - 1]",BODY:"j = n - i - 1; that = cb(that, this[len < 2 ? j - 1 : j], j, this)",END:"return that"}),b.prototype.legacy=e({BODY:"cb.call(that, this[i]._._node, this[i], i, this)"})},{"./node":29}],29:[function(a,b,c){"use strict";function d(a){a&&(this[0]=a.__dom__=this),this._={_node:a,_handlers:[]},this.length=a?1:0}c["default"]=d},{}],30:[function(a,b,c){"use strict";var d=a("./utils")["default"],e=/^(\w*)(?:#([\w\-]+))?(?:\[([\w\-\=]+)\])?(?:\.([\w\-]+))?$/;c["default"]=function(a,b){if("string"!=typeof a)return null;var c=e.exec(a);return c&&(c[1]&&(c[1]=c[1].toLowerCase()),c[3]&&(c[3]=c[3].split("=")),c[4]&&(c[4]=" "+c[4]+" ")),function(e){var f,g,h;for(c||e.webkitMatchesSelector||(g=(b||document).querySelectorAll(a),h=function(a){return a===e});e&&1===e.nodeType&&(f=c?!(c[1]&&e.nodeName.toLowerCase()!==c[1]||c[2]&&e.id!==c[2]||c[3]&&(c[3][1]?e.getAttribute(c[3][0])!==c[3][1]:!e.hasAttribute(c[3][0]))||c[4]&&!((" "+e.className+" ").indexOf(c[4])>=0)):e.webkitMatchesSelector?e.webkitMatchesSelector(a):d.some.call(g,h),!f&&b&&e!==b);e=e.parentNode);return f&&e}}},{"./utils":32}],31:[function(a,b,c){"use strict";var d=a("./utils")["default"],e={get:{},set:{}},f=/\-./g,g=/[A-Z]/g,h=["Top","Right","Bottom","Left"],i=d.computeStyle(d.docEl),j=i.length?d.slice.call(i,0):Object.keys(i).map(function(a){return a.replace(g,function(a){return"-"+a.toLowerCase()})});j.forEach(function(a){var b="-"===a[0]?a.substr(1,a.indexOf("-",1)-1):null,c=b?a.substr(b.length+2):a,d=a.replace(f,function(a){return a[1].toUpperCase()});d in i||(d=d[0].toLowerCase()+d.substr(1)),d!==a&&(e.get[c]=function(a){return a[d]},e.set[c]=function(b,c){c="number"==typeof c?c+"px":c.toString(),b["cssText"in b?d:a]=c})})," float fill-opacity font-weight line-height opacity orphans widows z-index zoom ".split(" ").forEach(function(a){var b=a.replace(f,function(a){return a[1].toUpperCase()});"float"===a&&(b="cssFloat"in i?"cssFloat":"styleFloat",e.get[a]=function(a){return a[b]}),e.set[a]=function(c,d){c["cssText"in c?b:a]=d.toString()}}),d.forOwn({font:["fontStyle","fontSize","/","lineHeight","fontFamily"],padding:h.map(function(a){return"padding"+a}),margin:h.map(function(a){return"margin"+a}),"border-width":h.map(function(a){return"border"+a+"Width"}),"border-style":h.map(function(a){return"border"+a+"Style"})},function(a,b){e.get[b]=function(b){var c=[],d=function(a,d){return c.push("/"===a?a:b[a]),!c[d]};return a.some(d)?"":c.join(" ")},e.set[b]=function(c,d){d&&"cssText"in c?c.cssText+=";"+b+":"+d:a.forEach(function(a){return c[a]="number"==typeof d?d+"px":d.toString()})}}),c["default"]=e},{"./utils":32}],32:[function(a,b,c){"use strict";var d=document,e=window,f=e.navigator.userAgent,g=d.scripts[0],h=/\{([\w\-]+)\}/g;c["default"]={makeError:function(a,b){var c=b?"DOM":"$Element";return TypeError(c+"."+a+" was called with illegal arguments. Check http://chemerisuk.github.io/better-dom to verify the function call")},computeStyle:function(a){return window.getComputedStyle?window.getComputedStyle(a):a.currentStyle},injectElement:function(a){return g.parentNode.insertBefore(a,g)},format:function(a,b){return a.replace(h,function(a,c){return c in b?b[c]:a})},raf:function(){var a=0,b=["r","webkitR","mozR","oR"].reduce(function(a,b){var c=b+"equestAnimationFrame";return a||window[c]&&c},null);return b?function(a){window[b](a)}:function(b){var c=(new Date).getTime(),d=Math.max(0,16-(c-a));a=c+d,d?setTimeout(b,d):b(c+d)}}(),docEl:d.documentElement,CSS3_ANIMATIONS:e.CSSKeyframesRule||!d.attachEvent,LEGACY_ANDROID:~f.indexOf("Android")&&f.indexOf("Chrome")<0,DOM2_EVENTS:!!d.addEventListener,WEBKIT_PREFIX:e.WebKitAnimationEvent?"-webkit-":"",forOwn:function(a,b,c){return Object.keys(a).forEach(function(d){b.call(c,a[d],d)}),c},slice:Array.prototype.slice,every:Array.prototype.every,each:Array.prototype.forEach,some:Array.prototype.some}},{}]},{},[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]);
+!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d=a("./utils")["default"],e={get:{},set:{}},f=/\-./g,g=/[A-Z]/g,h=["Top","Right","Bottom","Left"],i=d.computeStyle(d.docEl),j=i.length?d.slice.call(i,0):Object.keys(i).map(function(a){return a.replace(g,function(a){return"-"+a.toLowerCase()})});j.forEach(function(a){var b="-"===a[0]?a.substr(1,a.indexOf("-",1)-1):null,c=b?a.substr(b.length+2):a,d=a.replace(f,function(a){return a[1].toUpperCase()});d in i||(d=d[0].toLowerCase()+d.substr(1)),e.get[c]=function(a){return a[d]},e.set[c]=function(b,c){c="number"==typeof c?c+"px":c.toString(),b["cssText"in b?d:a]=c}})," float fill-opacity font-weight line-height opacity orphans widows z-index zoom ".split(" ").forEach(function(a){var b=a.replace(f,function(a){return a[1].toUpperCase()});"float"===a&&(b="cssFloat"in i?"cssFloat":"styleFloat",e.get[a]=function(a){return a[b]}),e.set[a]=function(c,d){c["cssText"in c?b:a]=d.toString()}}),d.forOwn({font:["fontStyle","fontSize","/","lineHeight","fontFamily"],padding:h.map(function(a){return"padding"+a}),margin:h.map(function(a){return"margin"+a}),"border-width":h.map(function(a){return"border"+a+"Width"}),"border-style":h.map(function(a){return"border"+a+"Style"})},function(a,b){e.get[b]=function(b){var c=[],d=function(a,d){return c.push("/"===a?a:b[a]),!c[d]};return a.some(d)?"":c.join(" ")},e.set[b]=function(c,d){d&&"cssText"in c?c.cssText+=";"+b+":"+d:a.forEach(function(a){return c[a]="number"==typeof d?d+"px":d.toString()})}}),c["default"]=e},{"./utils":32}],2:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=a("./element")["default"],e=a("./elements")["default"],f=/^\w+$/,g=document.createElement("body");c.create=function(a,h){if(1===a.nodeType)return d(a);if("string"!=typeof a)throw b.makeError("create",!0);if(f.test(a))a=document.createElement(a);else{g.innerHTML=c.template(a,h);for(var i=[];a=g.firstChild;g.removeChild(a))1===a.nodeType&&i.push(a);if(1!==i.length)return new e(i);a=i[0]}return new d(a)}},{"./dom":6,"./element":13,"./elements":21,"./utils":32}],3:[function(a){"use strict";var b,c,d,e,f=a("./utils")["default"],g=a("./dom")["default"],h=a("./element")["default"],i=a("./selectormatcher")["default"],j=/^(on|do)[A-Z]/,k=[],l=function(){return!0},m=function(){return!1},n=function(a,b){f.forOwn(b,function(b,c){"constructor"!==c&&(a[c]=b)})},o=function(a){k.forEach(function(b){b.accept(a)&&b(a,!0)}),f.each.call(a.children,o)},p=function(a,b){return function(d){var e;d=d||window.event,e=f.CSS3_ANIMATIONS?d.animationName===c&&d.target===a:"dataavailable"===d.srcUrn&&d.srcElement===a,e&&((d._skip=d._skip||{})[b]=!0)}},q=function(a,b){return function(c,d){!b[d]&&c.accept(a)&&c(a)}},r=function(a){f.each.call(document.querySelectorAll(a.selector),a),g.importStyles(a.selector,e)},s=document.readyState,t=function(){t&&(k.forEach(r),t=!1)};if((document.attachEvent?"complete"===s:"loading"!==s)?setTimeout(t,0):f.DOM2_EVENTS?(window.addEventListener("load",t,!1),document.addEventListener("DOMContentLoaded",t,!1)):(window.attachEvent("onload",t),document.attachEvent("ondataavailable",function(){"DOMContentLoaded"===window.event.srcUrn&&t&&t()})),f.CSS3_ANIMATIONS)b=f.WEBKIT_PREFIX?"webkitAnimationStart":"animationstart",c="DOM"+(new Date).getTime(),setTimeout(function(){return g.importStyles("@"+f.WEBKIT_PREFIX+"keyframes "+c,"from {opacity:.99} to {opacity:1}")},0),e={"animation-duration":"1ms !important","animation-name":c+" !important"},document.addEventListener(b,function(a){a.animationName===c&&k.forEach(q(a.target,a._skip||{}))},!1);else{if(b="ondataavailable",d=document.querySelector("link[rel=htc]"),!d)throw"You forgot to include <link rel='htc'> for IE < 10";e={behavior:"url("+d.href+") !important"},document.attachEvent(b,function(){var a=window.event;"dataavailable"===a.srcUrn&&k.forEach(q(a.srcElement,a._skip||{}))})}g.extend=function(a,c,d){if(2===arguments.length&&(d=c,c=!0),"boolean"==typeof c&&(c=c?l:m),"function"==typeof d&&(d={constructor:d}),!d||"object"!=typeof d||"function"!=typeof c)throw f.makeError("extend",!0);if("*"===a)n(h.prototype,d);else{var e=Object.keys(d).filter(function(a){return!!j.exec(a)}),g=d.hasOwnProperty("constructor")&&d.constructor,o=k.length,q=function(a,i){var j=h(a);f.CSS3_ANIMATIONS?a.addEventListener(b,p(a,o),!1):a.attachEvent(b,p(a,o)),(i===!0||c(j)!==!1)&&(n(j,d),g&&j.dispatch(g),i!==!0&&e.forEach(function(a){delete j[a]}))};q.accept=i(a),q.selector=a,k.push(q),t||r(q)}},g.mock=function(a,b){return a?g.create(a,b).legacy(o):new h}},{"./dom":6,"./element":13,"./selectormatcher":31,"./utils":32}],4:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"];c.importScripts=function(){var a=Array.prototype.slice,c=a.call(arguments,0),d=function(){var a,e=c.shift(),f=typeof e;if("string"===f)a=document.createElement("script"),a.src=e,a.onload=d,a.async=!0,b.injectElement(a);else if("function"===f)e();else if(e)throw b.makeError("importScripts",!0)};d()}},{"./dom":6,"./utils":32}],5:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=a("./css")["default"],e=b.injectElement(document.createElement("style")),f=e.sheet||e.styleSheet,g=f.cssRules||f.rules;c.importStyles=function(a,c){if(c&&"object"==typeof c){var e={};b.forOwn(c,function(a,b){var c=d.set[b];c?c(e,a):e[b]=a}),c=[],b.forOwn(e,function(a,b){c.push(b+":"+a)}),c=c.join(";")}if("string"!=typeof a||"string"!=typeof c)throw b.makeError("importStyles",!0);f.cssRules?f.insertRule(a+" {"+c+"}",g.length):a.split(",").forEach(function(a){f.addRule(a,c)})}},{"./css":1,"./dom":6,"./utils":32}],6:[function(a,b,c){"use strict";var d=a("./node")["default"],e=new d(document);e.version="1.7.6",e.template=function(a){return a},c["default"]=window.DOM=e},{"./node":30}],7:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=[],e=document.readyState,f=function(){d&&(d=d.forEach(c.dispatch,c))};(document.attachEvent?"complete"===e:"loading"!==e)?setTimeout(f,0):b.DOM2_EVENTS?(window.addEventListener("load",f,!1),document.addEventListener("DOMContentLoaded",f,!1)):(window.attachEvent("onload",f),document.attachEvent("ondataavailable",function(){"DOMContentLoaded"===window.event.srcUrn&&f()})),c.ready=function(a){if("function"!=typeof a)throw b.makeError("ready",!0);d?d.push(a):c.dispatch(a)}},{"./dom":6,"./utils":32}],8:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d={"(":1,")":2,"^":3,">":4,"+":4,"*":5,"`":6,"]":5,"[":6,".":7,"#":8},e=/([\w\-]+)(?:=((?:(`|')((?:\\?.)*)?\3)|[^\s]+))?/g,f=/(\$+)(?:@(-)?(\d+)?)?/g,g=/^[\s<]/,h={},i=function(a){return a.join?a.join(""):a},j=function(a,b,c,d,e){return d&&"`"!==d||(d='"'),b+"="+d+(e||c||b)+d},k=function(a,b){return function(c){var d=b?c.indexOf(">"):c.lastIndexOf("<");return c.substr(0,d)+a+c.substr(d)}},l=function(a){var b=h[a];return b||(b=h[a]="<"+a+"></"+a+">"),b},m=function(a){return function(b,c,d){return a.replace(f,function(a,b,e,f){var g=(e?d.length-c-1:c)+(f?+f:1);return(b+g).slice(-b.length).split("$").join("0")})}};"area base br col hr img input link meta param command keygen source".split(" ").forEach(function(a){h[a]="<"+a+">"}),c.template=function(a,c){if("string"!=typeof a)throw b.makeError("template",!0);c&&(a=b.format(a,c));var f,n,o,p,q,r,s=[],t=[],u="";if(a in h)return h[a];if(!a||g.exec(a))return a;for(f=0,n=a.length;n>f;++f)if(o=a[f],"."===o&&"."===s[0]&&(o=" "),p=d[o],!p||q&&q!==o)u+=o;else{if("+"===o&&"`"===s[0]&&(o=">"),"^"===o&&"^"===s[0]&&s.shift(),u&&(t.push(u),u=""),"("!==o)for(;d[s[0]]>p&&(t.push(s.shift()),"^"!==o||">"!==t[t.length-1]););")"===o?s.shift():q?q=!1:(s.unshift(o),"["===o&&(q="]"),"`"===o&&(q="`"))}for(u&&t.push(u),t=t.concat(s),s=[],f=0,n=t.length;n>f;++f){if(o=t[f],o in d){switch(u=s.shift(),r=s.shift()||[""],"string"==typeof r&&(r=[l(r)]),o){case".":u=k(' class="'+u+'"',!0);break;case"#":u=k(' id="'+u+'"',!0);break;case"[":u=k(" "+u.replace(e,j),!0);break;case"`":u=k(u);break;case"*":r=this.map.call(Array(+u),m(i(r)));break;default:u="string"==typeof u?l(u):i(u),">"===o?u=k(u):r.push(u)}o="function"==typeof u?r.map(u):r}s.unshift(o)}return t=i(s[0]),c?t:h[a]=t}},{"./dom":6,"./utils":32}],9:[function(a){"use strict";function b(a,b){var d="contains"===a?"hasClass":a+"Class";return c.docEl.classList&&(b=function(b){return this._._node.classList[a](b)}),"hasClass"===d?function(a){var c=arguments;return this._._node?1===c.length?b.call(this,a):this.every.call(c,b,this):void 0}:function(a){var d=arguments;return this.each(function(e){1===d.length?b.call(e,a):c.each.call(d,b,e)})}}var c=a("./utils")["default"],d=a("./element")["default"],e=/[\n\t\r]/g;d.prototype.hasClass=b("contains",function(a){return(" "+this._._node.className+" ").replace(e," ").indexOf(" "+a+" ")>=0}),d.prototype.addClass=b("add",function(a){this.hasClass(a)||(this._._node.className+=" "+a)}),d.prototype.removeClass=b("remove",function(a){a=(" "+this._._node.className+" ").replace(e," ").replace(" "+a+" "," "),this._._node.className=a.trim()}),d.prototype.toggleClass=b("toggle",function(a){var b=this._._node.className;this.addClass(a),b===this._._node.className&&this.removeClass(a)})},{"./element":13,"./utils":32}],10:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"];c.prototype.clone=function(){var a=arguments[0];if(void 0===a&&(a=!0),"boolean"!=typeof a)throw b.makeError("clone");var d,e=this._._node;return e?b.DOM2_EVENTS?d=new c(e.cloneNode(a)):(d=DOM.create(e.outerHTML),a||d.set("innerHTML","")):d=new c,d}},{"./element":13,"./utils":32}],11:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"],e={};d.prototype.get=function(a){var b,d,f=this._,g=f._node,h=e[a],i=typeof a;if(g){if(h)return h(g,a);if("string"===i){if("_"===a[0]||"-"===a[0]){if(b=a.substr(1),b in f)d=f[b];else if(d=g.getAttribute("data-"+b),null!=d){if("{"===d[0]&&"}"===d[d.length-1])try{d=JSON.parse(d)}catch(j){}f[b]=d}return d}return a in g?g[a]:g.getAttribute(a)}return c.prototype.get.call(this,a)}},e.undefined=function(a){var b;switch(a.tagName){case"SELECT":return~a.selectedIndex?a.options[a.selectedIndex].value:"";case"OPTION":b=a.hasAttribute("value")?"value":"text";break;default:b=a.type&&"value"in a?"value":"innerHTML"}return a[b]},e.type=function(a){return a.getAttribute("type")||a.type},b.DOM2_EVENTS||(e.textContent=function(a){return a.innerText})},{"./element":13,"./node":30,"./utils":32}],12:[function(a){"use strict";var b=a("./utils")["default"],c=a("./dom")["default"],d=a("./element")["default"],e={},f=[];d.prototype.i18n=function(a,c){if("string"!=typeof a||c&&"object"!=typeof c)throw b.makeError("i18n");return this.set(f.concat("").reduce(function(d,f,g){var h=a in e&&e[a][g]||a,i=h&&c?b.format(h,c):h;return d+"<span data-i18n="+f+">"+i+"</span>"},""))},c.importStrings=function(a,d,g){var h=typeof d,i=f.indexOf(a);if("string"===h)-1===i&&(i=f.push(a)-1,c.importStyles(":lang("+a+") > [data-i18n]","display:none"),c.importStyles(":lang("+a+") > [data-i18n="+a+"]","display:inline")),e[d]||(e[d]=[]),e[d][i]=g;else{if("object"!==h)throw b.makeError("importStrings",!0);b.forOwn(d,function(b,d){c.importStrings(a,d,b)})}},c.importStyles("[data-i18n]","display:none"),c.importStyles("[data-i18n='']","display:inline")},{"./dom":6,"./element":13,"./utils":32}],13:[function(a,b,c){"use strict";function d(a){return a&&a.__dom__?a.__dom__:this instanceof d?void e.call(this,a):new d(a)}var e=a("./node")["default"];d.prototype=new e,d.prototype.toString=function(){var a=this._._node;return a?a.tagName.toLowerCase():""},c["default"]=d},{"./node":30}],14:[function(a){"use strict";function b(a,b,e,f){return function(){var g=arguments;return this.legacy(function(h,i,j,k){if(e||h.parentNode&&1===h.parentNode.nodeType){var l,m="";c.each.call(g,function(b){if("function"==typeof b&&(b=b(i,j,k)),"string"==typeof b)m+=DOM.template(b).trim();else{if(!(b instanceof d))throw c.makeError(a);l||(l=document.createDocumentFragment()),b.legacy(function(a){return l.appendChild(a)})}}),!b&&m&&(l=DOM.create(m)._._node),!b||l?f(h,l):m&&h.insertAdjacentHTML(b,m)}})}}var c=a("./utils")["default"],d=a("./element")["default"];d.prototype.after=b("after","afterend",!1,function(a,b){a.parentNode.insertBefore(b,a.nextSibling)}),d.prototype.before=b("before","beforebegin",!1,function(a,b){a.parentNode.insertBefore(b,a)}),d.prototype.prepend=b("prepend","afterbegin",!0,function(a,b){a.insertBefore(b,a.firstChild)}),d.prototype.append=b("append","beforeend",!0,function(a,b){a.appendChild(b)}),d.prototype.replace=b("replace","",!1,function(a,b){a.parentNode.replaceChild(b,a)}),d.prototype.remove=b("remove","",!1,function(a){a.parentNode.removeChild(a)})},{"./element":13,"./utils":32}],15:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"],d=a("./selectormatcher")["default"],e={};c.prototype.matches=function(a){if(!a||"string"!=typeof a)throw b.makeError("matches");var c=e[a]||d(a),f=this._._node;return f&&!!c(f)},e[":focus"]=function(a){return a===document.activeElement},e[":hidden"]=function(a){return"true"===a.getAttribute("aria-hidden")||"none"===b.computeStyle(a).display||!b.docEl.contains(a)},e[":visible"]=function(a){return!e[":hidden"](a)}},{"./element":13,"./selectormatcher":31,"./utils":32}],16:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"];c.prototype.offset=function(){var a,c=this._._node,d=b.docEl.clientTop,e=b.docEl.clientLeft,f=window.pageYOffset||b.docEl.scrollTop,g=window.pageXOffset||b.docEl.scrollLeft;return c?(a=c.getBoundingClientRect(),{top:a.top+f-d,left:a.left+g-e,right:a.right+g-e,bottom:a.bottom+f-d,width:a.right-a.left,height:a.bottom-a.top}):void 0}},{"./element":13,"./utils":32}],17:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"],e={};d.prototype.set=function(a,d){var f=typeof a;return 1===arguments.length&&"object"!==f&&(d=a,a=void 0),this.legacy(function(g,h,i,j){var k,l=e[a],m=(h._._watchers||{})[a||("value"in g?"value":"innerHTML")],n=d;if(m&&(k=h.get(a)),!a||"_"!==a[0]&&"-"!==a[0]){if("function"==typeof n&&(n=d(h,i,j)),l)l(g,n);else{if("string"!==f)return c.prototype.set.call(h,a);null==n?g.removeAttribute(a):a in g?g[a]=n:g.setAttribute(a,n)}(!b.DOM2_EVENTS||b.LEGACY_ANDROID)&&(g.className=g.className)}else h._[a.substr(1)]=n;m&&k!==n&&m.forEach(function(a){h.dispatch(a,n,k,h,i,j)})})},d.prototype.watch=function(a,b){return this.each(function(c){var d=c._._watchers;d||c.set("__watchers",d={}),(d[a]||(d[a]=[])).push(b)})},d.prototype.unwatch=function(a,b){var c=function(a){return a!==b};return this.each(function(b){var d=b._._watchers;d&&(d[a]=(d[a]||[]).filter(c))})},e.undefined=function(a,c){var d;c=null==c?"":String(c),"SELECT"===a.tagName?b.every.call(a.options,function(a){return!(a.selected=a.value===c)})&&(a.selectedIndex=-1):d=a.type&&"value"in a?b.DOM2_EVENTS||"textarea"!==a.type?"value":"innerText":"innerHTML",d&&(a[d]=c)},b.DOM2_EVENTS||(e.textContent=function(a,b){a.innerText=b})},{"./element":13,"./node":30,"./utils":32}],18:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"],d=a("./css")["default"];c.prototype.style=function(a,c){var e,f,g,h=arguments.length,i=this._._node,j=typeof a;return 1!==h||"string"!==j&&!Array.isArray(a)?this.legacy(function(e,f,g,i){var k=e.style,l=function(a,b){var c=d.set[b];"function"==typeof a&&(a=a(f,g,i)),null==a&&(a=""),c?c(k,a):k[b]="number"==typeof a?a+"px":a.toString()};if(1===h&&a&&"object"===j)b.forOwn(a,l);else{if(2!==h||"string"!==j)throw b.makeError("style");l(c,a)}}):(i&&(e=i.style,c=("string"===j?[a]:a).reduce(function(a,h){return f=d.get[h],c=f?f(e):e[h],g||c||(e=b.computeStyle(i),c=f?f(e):e[h],g=!0),a[h]=c,a},{})),i&&"string"===j?c[a]:c)}},{"./css":1,"./element":13,"./utils":32}],19:[function(a){"use strict";function b(a,b,c){return function(h,i){if(h&&"string"!=typeof h)throw d.makeError(a);var j=g(h),k=c?[]:null,l=this._._node;for(l=l&&!i?l[b]:l;l;l=l[b])if(1===l.nodeType&&(!j||j(l))){if(!c)return e(l);k.push(l)}return new f(k)}}function c(a){return function(b){if(a){if(b&&"string"!=typeof b)throw d.makeError("children")}else if(b&&"number"!=typeof b)throw d.makeError("child");var c=this._._node,h=c?c.children:null;return c?(d.DOM2_EVENTS||(h=this.filter.call(h,function(a){return 1===a.nodeType})),a?new f(b?this.filter.call(h,g(b)):h):(0>b&&(b=h.length+b),e(h[b]))):new e}}var d=a("./utils")["default"],e=a("./element")["default"],f=a("./elements")["default"],g=a("./selectormatcher")["default"];e.prototype.next=b("next","nextSibling"),e.prototype.prev=b("prev","previousSibling"),e.prototype.nextAll=b("nextAll","nextSibling",!0),e.prototype.prevAll=b("prevAll","previousSibling",!0),e.prototype.parent=b("parent","parentNode"),e.prototype.child=c(!1),e.prototype.children=c(!0)},{"./element":13,"./elements":21,"./selectormatcher":31,"./utils":32}],20:[function(a){"use strict";var b=a("./utils")["default"],c=a("./element")["default"],d=a("./css")["default"],e=function(a){var b=parseFloat(a)||0;return a.lastIndexOf("ms")===a.length-2?b:1e3*b},f=function(a,b,c){var f=d.get[b+"delay"](a).split(","),g=d.get[b+"duration"](a).split(",");return c||(c=d.get[b+"iteration-count"](a).split(",")),Math.max.apply(Math,g.map(function(a,b){var d=c[b]||"1";return("initial"===d?1:parseFloat(d))*e(a)+(e(f[b])||0)}))},g=["timing-function","property","duration","delay"].map(function(a){return"transition-"+a}),h=b.WEBKIT_PREFIX?"webkitTransitionEnd":"transitionend",i=!b.LEGACY_ANDROID&&b.CSS3_ANIMATIONS?["position","absolute"]:["display","none"],j=function(a,c,e){return function(){return a.legacy(function(a,j,k,l){var m=a.style,n=function(){"hidden"===m.visibility&&(m[i[0]]=i[1]),!b.LEGACY_ANDROID&&b.CSS3_ANIMATIONS&&(m.pointerEvents="",m.willChange=""),e&&e(j,k,l)};b.raf(function(){var e,k,l,o,p,q,r=b.computeStyle(a),s="function"==typeof c?c(a):c;!b.LEGACY_ANDROID&&b.CSS3_ANIMATIONS&&(e=Math.max(f(r,"transition-",[]),f(r,"animation-"))),e&&(m.visibility||(m.visibility=s?"visible":"hidden"),l=g.map(function(a,b){return d.get[a](r).split(b?", ":/, (?!\d)/)}),k=l[1].indexOf("visibility"),0>k&&(k=l[2].indexOf("0s")),0>k&&(k=l[0].length),l[0][k]="linear",l[1][k]="visibility",l[s?2:3][k]="0s",l[s?3:2][k]=e+"ms",l.forEach(function(a,b){d.set[g[b]](m,a.join(", "))}),m.pointerEvents="none",m.willChange=l[1].join(", "),p=function(b){b&&"visibility"!==b.propertyName||(b&&b.stopPropagation(),clearTimeout(q),a.removeEventListener(h,p,!1),n())},a.addEventListener(h,p,!1),q=setTimeout(p,e+1e3/60)),s?(o=m[i[0]],"none"!==o&&j.set("__visibility",o)):m[i[0]]=j.get("__visibility")||"",m.visibility=s?"hidden":"visible",j.set("aria-hidden",String(s)),e||n()})})}},k=function(a,c){return function(d,e){var f=arguments.length,g=typeof d;if(1===f&&"function"===g&&(e=d,d=0),d&&("number"!==g||0>d)||e&&"function"!=typeof e)throw b.makeError(a);return e=j(this,c,e),d?setTimeout(e,d):e(),this}};c.prototype.show=k("show",!1),c.prototype.hide=k("hide",!0),c.prototype.toggle=k("toggle",function(a){return"true"!==a.getAttribute("aria-hidden")})},{"./css":1,"./element":13,"./utils":32}],21:[function(a,b,c){"use strict";function d(a){for(var b=0,c=a&&a.length||0;c>b;++b)this[b]=e(a[b]);this._={},this.length=c}var e=a("./element")["default"];d.prototype=new e,d.prototype.toString=Array.prototype.join,c["default"]=d},{"./element":13}],22:[function(a,b,c){"use strict";var d=a("./utils")["default"],e=a("./element")["default"],f=a("./selectormatcher")["default"],g=["target","currentTarget","defaultPrevented"],h="dataavailable",i={},j=function(a,b,c,k,l,m,n){var o=i[a],p=f(b,m),q=function(b){if(b=b||window.event,j.skip!==a&&(q._type!==h||b.srcUrn===a)){var f=b.target||b.srcElement||document,i=p?p(f):m,o=k||g,r=c;"string"==typeof c&&(r="-"===c[0]?l._[c.substr(1)]:l[c]),"function"==typeof r&&i&&(n&&l.off(a,c),o=o.map(function(c){if(!d.DOM2_EVENTS)switch(c){case"which":return b.keyCode;case"button":var g=b.button;return 1&g?1:2&g?3:4&g?2:0;case"pageX":return b.pageX||b.clientX+d.docEl.scrollLeft-d.docEl.clientLeft;case"pageY":return b.clientY+d.docEl.scrollTop-d.docEl.clientTop}switch(c){case"type":return a;case"defaultPrevented":return"defaultPrevented"in b?b.defaultPrevented:b.returnValue===!1;case"target":return e(f);case"currentTarget":return e(i);case"relatedTarget":return e(b.relatedTarget||b[(b.toElement===m?"from":"to")+"Element"])}return b[c]}),b._args&&(o=b._args.concat(o)),r.apply(l,o)===!1&&(d.DOM2_EVENTS?b.preventDefault():b.returnValue=!1))}};return o&&(q=o(q,a)||q),d.DOM2_EVENTS||"on"+(q._type||a)in m||(q._type=h),q.type=b?a+" "+b:a,q.callback=c,q};["scroll","mousemove"].forEach(function(a){i[a]=function(a){var b=!0;return function(c){b&&(b=d.raf(function(){b=!a(c)}))}}}),"onfocusin"in d.docEl?d.forOwn({focus:"focusin",blur:"focusout"},function(a,b){i[b]=function(b){b._type=a}}):i.focus=i.blur=function(a){a.capturing=!0},document.createElement("input").validity&&(i.invalid=function(a){a.capturing=!0}),d.DOM2_EVENTS||["submit","change","reset"].forEach(function(a){i[a]=function(a){a._type=h}}),j.hooks=i,c["default"]=j},{"./element":13,"./selectormatcher":31,"./utils":32}],23:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"];c.prototype.get=function(a){var c=this;if("string"==typeof a)return"_"===a[0]||"-"===a[0]?this._[a.substr(1)]:this._._node[a];if(Array.isArray(a))return a.reduce(function(a,b){return a[b]=c.get(b),a},{});throw b.makeError("get")},c.prototype.set=function(a,c){var d=this,e=typeof a;if("string"===e)return"_"===a[0]||"-"===a[0]?this._[a.substr(1)]=c:this._._node[a]=c,this;if(a&&"object"===e)return b.forOwn(a,function(a,b){d.set(b,a)});throw b.makeError("set")}},{"./node":30,"./utils":32}],24:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"];c.prototype.contains=function(a){var c=this._._node;if(a instanceof d)return c&&a.every(function(a){return c.contains(a._._node)});throw b.makeError("contains")}},{"./element":13,"./node":30,"./utils":32}],25:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"];c.prototype.data=function(a,c){var d=this,e=arguments.length,f=typeof a;if(1===e){if("string"===f)return this.get("_"+a);if(a&&"object"===f)return Array.isArray(a)?this.get(a.map(function(a){return"_"+a})):b.forOwn(a,function(a,b){d.set("_"+b,a)})}else if(2===e)return this.each(function(b){b.set("_"+a,c)});throw b.makeError("data",this)}},{"./node":30,"./utils":32}],26:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=document.createElement("a"),e="onpropertychange";b.DOM2_EVENTS&&(d[e="handleEvent"]=null,d.addEventListener(e,d,!1)),c.prototype.dispatch=function(a){var c,f,g,h=Array.prototype.slice,i=h.call(arguments,1),j=typeof a,k=this,l=this._._node;if(l){if("function"===j)c=function(){f=a.apply(k,i)};else{if("string"!==j)throw b.makeError("dispatch");c=function(){f=l[a].apply(l,i)}}d[e]=c,b.DOM2_EVENTS&&(g=document.createEvent("HTMLEvents"),g.initEvent(e,!1,!1),d.dispatchEvent(g)),d[e]=null}return f}},{"./node":30,"./utils":32}],27:[function(a){var b=Array.prototype.slice,c=a("./utils")["default"],d=a("./node")["default"],e=a("./eventhandler")["default"];d.prototype.on=function(a,b,d,f){var g,h,i,j=this,k=typeof a;if("string"!==k){if("object"===k)return Array.isArray(a)?(i=c.slice.call(arguments,1),a.forEach(function(a){j.on.apply(j,[a].concat(i))})):c.forOwn(a,function(a,b){j.on(b,a)}),this;throw c.makeError("on")}return h=a.indexOf(" "),~h&&(g=a.substr(h+1),a=a.substr(0,h)),Array.isArray(d)||(f=d,d=void 0),this.legacy(function(h,i){var j=e(a,g,b,d,i,h,f);c.DOM2_EVENTS?h.addEventListener(j._type||a,j,!!j.capturing):(i===DOM&&"scroll"===a&&(h=window),h.attachEvent("on"+(j._type||a),j)),i._._handlers.push(j)})},d.prototype.once=function(){var a=b.call(arguments,0);return this.on.apply(this,a.concat(!0))},d.prototype.off=function(a,b){if("string"!=typeof a)throw c.makeError("off");return this.legacy(function(d,e){e.set("__handlers",e._._handlers.filter(function(f){return a!==f.type||b&&b!==f.callback?!0:(a=f._type||f.type,void(c.DOM2_EVENTS?d.removeEventListener(a,f,!!f.capturing):(e===DOM&&"scroll"===a&&(d=window),d.detachEvent("on"+a,f))))}))})},d.prototype.fire=function(a){var d,f=b.call(arguments,1),g=typeof a,h={};if("string"!==g)throw c.makeError("fire");return(d=e.hooks[a])&&(h=d(h)||h),g=h._type||a,this.every(function(b){var d,h,i=b._._node;return c.DOM2_EVENTS?(d=document.createEvent("HTMLEvents"),d.initEvent(g,!0,!0),d._args=f,h=i.dispatchEvent(d)):(d=document.createEventObject(),d._args=f,"on"+g in i||(g="dataavailable"),"dataavailable"===g&&(d.srcUrn=a),i.fireEvent("on"+g,d),h=d.returnValue!==!1),h&&i[a]&&("focus"!==a&&"blur"!==a||i.offsetWidth)&&(e.skip=a,i[a](),e.skip=null),h})}},{"./eventhandler":22,"./node":30,"./utils":32}],28:[function(a){"use strict";var b=a("./utils")["default"],c=a("./node")["default"],d=a("./element")["default"],e=a("./elements")["default"],f=document.getElementsByClassName?/^(?:(\w+)|\.([\w\-]+))$/:/^(?:(\w+))$/,g=/[\x20\t\r\n\f]*[+~>]/,h=/'|\\/g,i="DOM"+(new Date).getTime();c.prototype.find=function(a,c){if("string"!=typeof a)throw b.makeError("find");var j,k,l,m,n=this._._node,o=f.exec(a);if(!n)return new d;if(o)j=o[1]?n.getElementsByTagName(a):n.getElementsByClassName(o[2]),j&&!c&&(j=j[0]);else{k=!0,l=i,m=n,n!==document&&((k=n.getAttribute("id"))?l=k.replace(h,"\\$&"):n.setAttribute("id",l),l="[id='"+l+"'] ",m=g.test(a)?n.parentNode:n,a=l+a.split(",").join(","+l));try{j=m[c?"querySelectorAll":"querySelector"](a)}finally{k||n.removeAttribute("id")}}return c?new e(j):d(j)},c.prototype.findAll=function(a){return this.find(a,!0)}},{"./element":13,"./elements":21,"./node":30,"./utils":32}],29:[function(a){"use strict";var b=a("./node")["default"],c=/cb\.call\(([^)]+)\)/g,d={BEGIN:"",BODY:"",END:"return this"},e=function(a){var b,e="%BEGIN%\nfor(var i=0,n=this.length;i<n;++i){%BODY%}%END%";for(b in d)e=e.replace("%"+b+"%",a[b]||d[b]);return e=e.replace(c,function(a,b){return"(that?"+a+":cb("+b.split(",").slice(1).join()+"))"}),Function("cb","that","undefined",e)};b.prototype.each=e({BODY:"cb.call(that, this[i], i, this)"}),b.prototype.some=e({BODY:"if (cb.call(that, this[i], i, this) === true) return true",END:"return false"}),b.prototype.every=e({BEGIN:"var out = true",BODY:"out = cb.call(that, this[i], i, this) && out",END:"return out"}),b.prototype.map=e({BEGIN:"var out = Array(this && this.length || 0)",BODY:"out[i] = cb.call(that, this[i], i, this)",END:"return out"}),b.prototype.filter=e({BEGIN:"var out = []",BODY:"if (cb.call(that, this[i], i, this)) out.push(this[i])",END:"return out"}),b.prototype.reduce=e({BEGIN:"var len = arguments.length; if (len < 2) that = this[0]",BODY:"that = cb(that, this[len < 2 ? i + 1 : i], i, this)",END:"return that"}),b.prototype.reduceRight=e({BEGIN:"var j, len = arguments.length; if (len < 2) that = this[this.length - 1]",BODY:"j = n - i - 1; that = cb(that, this[len < 2 ? j - 1 : j], j, this)",END:"return that"}),b.prototype.legacy=e({BODY:"cb.call(that, this[i]._._node, this[i], i, this)"})},{"./node":30}],30:[function(a,b,c){"use strict";function d(a){a&&(this[0]=a.__dom__=this),this._={_node:a,_handlers:[]},this.length=a?1:0}c["default"]=d},{}],31:[function(a,b,c){"use strict";var d=a("./utils")["default"],e=/^(\w*)(?:#([\w\-]+))?(?:\[([\w\-\=]+)\])?(?:\.([\w\-]+))?$/;c["default"]=function(a,b){if("string"!=typeof a)return null;var c=e.exec(a);return c&&(c[1]&&(c[1]=c[1].toLowerCase()),c[3]&&(c[3]=c[3].split("=")),c[4]&&(c[4]=" "+c[4]+" ")),function(e){var f,g,h;for(c||e.webkitMatchesSelector||(g=(b||document).querySelectorAll(a),h=function(a){return a===e});e&&1===e.nodeType&&(f=c?!(c[1]&&e.nodeName.toLowerCase()!==c[1]||c[2]&&e.id!==c[2]||c[3]&&(c[3][1]?e.getAttribute(c[3][0])!==c[3][1]:!e.hasAttribute(c[3][0]))||c[4]&&!((" "+e.className+" ").indexOf(c[4])>=0)):e.webkitMatchesSelector?e.webkitMatchesSelector(a):d.some.call(g,h),!f&&b&&e!==b);e=e.parentNode);return f&&e}}},{"./utils":32}],32:[function(a,b,c){"use strict";var d=document,e=window,f=e.navigator.userAgent,g=d.scripts[0],h=/\{([\w\-]+)\}/g;c["default"]={makeError:function(a,b){var c=b?"DOM":"$Element";return TypeError(c+"."+a+" was called with illegal arguments. Check http://chemerisuk.github.io/better-dom to verify the function call")},computeStyle:function(a){return window.getComputedStyle?window.getComputedStyle(a):a.currentStyle},injectElement:function(a){return g.parentNode.insertBefore(a,g)},format:function(a,b){return a.replace(h,function(a,c){return c in b?b[c]:a})},raf:function(){var a=0,b=["r","webkitR","mozR","oR"].reduce(function(a,b){var c=b+"equestAnimationFrame";return a||window[c]&&c},null);return b?function(a){window[b](a)}:function(b){var c=(new Date).getTime(),d=Math.max(0,16-(c-a));a=c+d,d?setTimeout(b,d):b(c+d)}}(),docEl:d.documentElement,CSS3_ANIMATIONS:e.CSSKeyframesRule||!d.attachEvent,LEGACY_ANDROID:~f.indexOf("Android")&&f.indexOf("Chrome")<0,DOM2_EVENTS:!!d.addEventListener,WEBKIT_PREFIX:e.WebKitAnimationEvent?"-webkit-":"",forOwn:function(a,b,c){return Object.keys(a).forEach(function(d){b.call(c,a[d],d)}),c},slice:Array.prototype.slice,every:Array.prototype.every,each:Array.prototype.forEach,some:Array.prototype.some}},{}]},{},[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]);
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "better-dom",
- "version": "1.7.5",
+ "version": "1.7.6",
"author": "Maksim Chemerisuk",
"description": "Live extension playground",
"license": "MIT",

0 comments on commit 050669e

Please sign in to comment.
Something went wrong with that request. Please try again.