/*! domx - v0.17.2 - 2017-04-06 * http://esha.github.io/domx/ * Copyright (c) 2017 ESHA Research; Licensed , */ !function(a,b,c){"use strict";c={slice:Array.prototype.slice,zero:function(){return 0},isList:function(a){return a&&"object"==typeof a&&"length"in a&&!a.nodeType||a instanceof NodeList||a instanceof HTMLCollection},define:function(a,b,d,e){if("string"==typeof b)for(var f=0,g=a.length;f0){for(var h=f.split(".");h.length>1&&(g=g[f=h.shift()]););void 0===g?(g=b,f=a):f=h[0]}var i=g[f];if(void 0!==i){if("function"==typeof i&&i.apply)return i.apply(g,d);if(!d)return i;g[f]=d[0]}else if(1===b.nodeType){if(!d)return b.getAttribute(a);null===d[0]?b.removeAttribute(a):b.setAttribute(a,d[0])}},fill:function(a,b,c){for(var d=[],e=0,f=a.length;e1||c.isList(a))for(var d=arguments.length>1?arguments:a,e=0,f=d.length;ef.length);g++)f.add(e[g][d===f.length+1?"querySelector":"querySelectorAll"](a));return f},query:function(a){return this.queryAll(a,1)[0]}}),c.define(b.lists,{only:function(a,c){var d=this.toArray();return d=a>=0||a<0?d.slice(a,c||a+1||void 0):d.filter("function"==typeof a?a:1===arguments.length?function(b){return b[b.matches?"matches":"hasOwnProperty"](a)}:function(b){return(b.each?b.each(a):b[a])===c}),new b.List(d)},not:function(a){var b=a instanceof Node?[a]:this.only.apply(this,arguments);return this.only(function(a){return b.indexOf(a)<0})}}),c.estFnArgs=function(a,b,d,e){if(b=c.alias[b]||b,b in a||(e=void 0===d?"boolean"!=typeof b||b:d,d=b,b="parentElement"),"boolean"==typeof d&&(e=d,d=null),d){if("string"==typeof d){var f=d;d=function(a){return a.matches&&a.matches(f)}}}else d=function(){return!0};return[b,d,e||!1]},c.define(b.nodes,"farthest",function(a,b,d){var e=c.estFnArgs(this,a,b,d);return c.farthest(this,e[0],e[1],e[2]&&e[1](this)?this:null)}),c.farthest=function(a,b,d,e){return a&&(a=a[b])?c.farthest(a,b,d,d(a)?a:e):e},c.define(b.nodes,"nearest",function(a,b,d){var e=c.estFnArgs(this,a,b,d);return e[2]&&e[1](this)?this:c.nearest(this,e[0],e[1])}),c.nearest=function(a,b,d){return a&&(a=a[b])?d(a)?a:c.nearest(a,b,d):null},c.define(b.nodes,"closest",function(a){return this.nearest(a?a+"":"*",!0)}),b.add("all",function(a,d,e,f){d===!0&&(e=d,d=void 0),f=f||new b.List;var g=e?this:this[c.alias[a]||a];if(g){var h=d&&d.call(this,g,f);null!==h&&f.add(h||g),!g.all||!g.length&&c.isList(g)||g.all(a,d,!1,f)}return f},[Node]);var d=Element.prototype,e="atchesSelector";c.defprop(d,"matches",d.m||d["webkitM"+e]||d["mozM"+e]||d["msM"+e]);var f=c.insert={create:function(b,c,d){return f.insert(b,a.createElement(c),d)},insert:function(a,b,c){var d=f.find(a,c);return d?a.insertBefore(b,d):a.appendChild(b),b},find:function(a,b){switch(typeof b){case"string":return a[b]||a.only(b);case"number":return a.children[b];case"object":return b;case"function":return b.call(a,a)}}};b.add("insert",function(a,d){if("string"==typeof a)return f.create(this,a,d);if(c.isList(a)){for(var e=new b.List,g=0,h=a.length;g"]).call(a,g,d)||a}return a};var h=g.emmet={"#":function(a){this.each("id",a)},".":function(a){this.each("classList.add",a)},"[":function a(b){b=b.substr(0,b.length-1).match(/(?:[^\s"]+|("[^"]+"))+/g);for(var c=0,d=b.length;c":function(d){var e=this;return d.charAt(0)in h?c.emmet(e,d):this instanceof b.List?this.insert(d):(e=a.createElement(d),this.appendChild(e),e)},"*":function(a,c){for(var d=h.parent(this)||c,e=new b.List(this),f=1;f"].call(h.parent(this),a)},"^":function(a){return h["+"].call(h.parent(this),a)},",":function(a,b){return h[">"].call(b,a)},ends:{"[":"]","{":"}","(":")"},parent:function(a){return a&&(a.parentNode||a.each("parentNode")[0])},split:/(?=\#|\,|\.|\[|\>|\+|\*|\^|\{|\()/g,next:function(a){var b=a.shift(),c=b&&h.ends[b.charAt(0)];if(c){for(;c!==b[b.length-1]||"\\"===b[b.length-2];)b+=a.shift()||c;b=b.replace(new RegExp("\\\\\\"+c,"g"),c)}return b}};c.defprop(a,"html",a.documentElement);var i=c.dot={names:{3:"$text",8:"$comment",7:"$procins"},fns:{},fn:function(a,b){return i.fns[b]||(i.fns[b]=1===a?function(){return this.each("children").only(b).dot()}:function(){return this.each("childNodes").only("nodeType",a)})},init:function(){a.queryAll("[x-dot]").each(function(a){a.dot(!0),j&&!a._observer&&(a._observer=new j(function(a){for(var b=0,c=a.length;b