diff --git a/lib/browser/imba.js b/lib/browser/imba.js index 16513deaf..76e95d5c9 100644 --- a/lib/browser/imba.js +++ b/lib/browser/imba.js @@ -1467,11 +1467,6 @@ return this.dom().getAttribute(key); }; - ElementTag.prototype.object = function (v){ - if (arguments.length) { return ((this.setObject(v),v),this) }; - return this._object; - }; - ElementTag.prototype.setContent = function (content){ this.setChildren(content); // override? return this; @@ -1879,7 +1874,6 @@ ElementTag.prototype.initialize = ElementTag; - function HTMLElementTag(){ ElementTag.apply(this,arguments) }; subclass$(HTMLElementTag,ElementTag); @@ -2354,7 +2348,6 @@ Imba.extendTag('htmlelement', function(tag){ - tag.prototype.setChildren = function (nodes){ if (nodes && nodes.static) { this.setStaticChildren(nodes); diff --git a/lib/browser/imba.min.js b/lib/browser/imba.min.js index 7dba1d63c..3a2278be5 100644 --- a/lib/browser/imba.min.js +++ b/lib/browser/imba.min.js @@ -2,31 +2,17 @@ !function(){require("./imba"),require("./core.events"),require("./dom"),require("./dom.html"),require("./dom.events"),require("./dom.static"),require("./selector")}(); },{"./core.events":2,"./dom":5,"./dom.events":3,"./dom.html":4,"./dom.static":6,"./imba":7,"./selector":8}],2:[function(require,module,exports){ !function(){function t(t,e,n){for(var l,i,a;(l=n)&&(n=n.next);)(i=n.listener)&&(a=n.path&&i[n.path]?e?i[n.path].apply(i,e):i[n.path]():e?i.apply(n,e):i.call(n)),n.times&&--n.times<=0&&(l.next=n.next,n.listener=null)}Imba.listen=function(t,e,n,l){var i,a,r,s;return a=t.__listeners__||(t.__listeners__={}),r=a[i=e]||(a[i]={}),s=r.tail||(r.tail=r.next={}),s.listener=n,s.path=l,r.tail=s.next={},s},Imba.once=function(t,e,n){var l=Imba.listen(t,e,n);return l.times=1,l},Imba.unlisten=function(t,e,n,l){var i,a,r=t.__listeners__;if(r&&(i=r[e]))for(;(a=i)&&(i=i.next);)if(i==n||i.listener==n){a.next=i.next,i.listener=null;break}},Imba.emit=function(e,n,l){var i;(i=e.__listeners__)&&(i[n]&&t(n,l,i[n]),i.all&&t(n,[n,l],i.all))},Imba.observeProperty=function(t,e,n,l,i){return i&&"object"==typeof i&&Imba.unlisten(i,"all",t,n),l&&"object"==typeof l&&Imba.listen(l,"all",t,n),this}}(); - - },{}],3:[function(require,module,exports){ !function(){function t(t){return t?t.toArray?t.toArray():t:[]}var e=(document,window),n=e&&void 0!==e.ontouchstart;Imba.RingBuffer=function(t){void 0===t&&(t=10),this._array=[],this._keep=t,this._head=0},Imba.RingBuffer.prototype.__head={name:"head"},Imba.RingBuffer.prototype.head=function(t){return this._head},Imba.RingBuffer.prototype.setHead=function(t){return this._head=t,this},Imba.RingBuffer.prototype.push=function(t){var e=this._head++;return this._array[e%this._keep]=t,e},Imba.RingBuffer.prototype.last=function(){return this._array[this._head%this._keep]},Imba.Pointer=function(){this.setButton(-1),this.setEvents(new Imba.RingBuffer(10)),this.setEvent({x:0,y:0,type:"uninitialized"})},Imba.Pointer.prototype.__phase={name:"phase"},Imba.Pointer.prototype.phase=function(t){return this._phase},Imba.Pointer.prototype.setPhase=function(t){return this._phase=t,this},Imba.Pointer.prototype.__prevEvent={name:"prevEvent"},Imba.Pointer.prototype.prevEvent=function(t){return this._prevEvent},Imba.Pointer.prototype.setPrevEvent=function(t){return this._prevEvent=t,this},Imba.Pointer.prototype.__button={name:"button"},Imba.Pointer.prototype.button=function(t){return this._button},Imba.Pointer.prototype.setButton=function(t){return this._button=t,this},Imba.Pointer.prototype.__event={name:"event"},Imba.Pointer.prototype.event=function(t){return this._event},Imba.Pointer.prototype.setEvent=function(t){return this._event=t,this},Imba.Pointer.prototype.__dirty={name:"dirty"},Imba.Pointer.prototype.dirty=function(t){return this._dirty},Imba.Pointer.prototype.setDirty=function(t){return this._dirty=t,this},Imba.Pointer.prototype.__events={name:"events"},Imba.Pointer.prototype.events=function(t){return this._events},Imba.Pointer.prototype.setEvents=function(t){return this._events=t,this},Imba.Pointer.prototype.__touch={name:"touch"},Imba.Pointer.prototype.touch=function(t){return this._touch},Imba.Pointer.prototype.setTouch=function(t){return this._touch=t,this},Imba.Pointer.prototype.update=function(t){return this.setEvent(t),this.events().push(t),this.setDirty(!0),this},Imba.Pointer.prototype.process=function(){var t=(this.phase(),this.prevEvent(),this.event());return this.dirty()?(this.setPrevEvent(t),this.setDirty(!1),"mousedown"==t.type?(this.setButton(t.button),this.setTouch(new Imba.Touch(t,this)),this.touch().mousedown(t,t)):"mousemove"==t.type?this.touch()&&this.touch().mousemove(t,t):"mouseup"==t.type&&(this.setButton(-1),this.touch()&&this.touch().mouseup(t,t),this.setTouch(null))):this.touch()&&this.touch().idle(),this},Imba.Pointer.prototype.emit=function(t,e,n){n&&n.constructor===Object||(n={});void 0!==n.bubble?n.bubble:!0;return!0},Imba.Pointer.prototype.cleanup=function(){return Imba.POINTERS},Imba.Pointer.prototype.x=function(){return this.event().x},Imba.Pointer.prototype.y=function(){return this.event().y},Imba.Pointer.update=function(){for(var n=0,o=t(Imba.POINTERS),r=o.length;r>n;n++)o[n].process();return e.requestAnimationFrame(Imba.Pointer.update),this},Imba.Touch=function(t,e){this.setEvent(t),this.setData({}),this.setActive(!0),this._suppress=!1,this.setBubble(!1),this.setPointer(e),this.setUpdates(0)};var o=[],r=0,i={};Imba.Touch.count=function(){return r},Imba.Touch.lookup=function(t){return t&&(t.__touch__||i[t.identifier])},Imba.Touch.release=function(t,e){var n,o;n=i[t.identifier],delete i[t.identifier],n,o=t.__touch__,delete t.__touch__,o},Imba.Touch.ontouchstart=function(e){for(var n,s=0,u=t(e.changedTouches),a=u.length;a>s;s++)if(n=u[s],!this.lookup(n)){var h=i[n.identifier]=new this(e);n.__touch__=h,o.push(h),r++,h.touchstart(e,n)}return this},Imba.Touch.ontouchmove=function(e){for(var n,o,r=0,i=t(e.changedTouches),s=i.length;s>r;r++)o=i[r],(n=this.lookup(o))&&n.touchmove(e,o);return this},Imba.Touch.ontouchend=function(e){for(var n,o,i=0,s=t(e.changedTouches),u=s.length;u>i;i++)o=s[i],(n=this.lookup(o))&&(n.touchend(e,o),this.release(o,n),r--);return this},Imba.Touch.ontouchcancel=function(e){for(var n,o,i=0,s=t(e.changedTouches),u=s.length;u>i;i++)o=s[i],(n=this.lookup(o))&&(n.touchcancel(e,o),this.release(o,n),r--);return this},Imba.Touch.prototype.__phase={name:"phase"},Imba.Touch.prototype.phase=function(t){return this._phase},Imba.Touch.prototype.setPhase=function(t){return this._phase=t,this},Imba.Touch.prototype.__active={name:"active"},Imba.Touch.prototype.active=function(t){return this._active},Imba.Touch.prototype.setActive=function(t){return this._active=t,this},Imba.Touch.prototype.__event={name:"event"},Imba.Touch.prototype.event=function(t){return this._event},Imba.Touch.prototype.setEvent=function(t){return this._event=t,this},Imba.Touch.prototype.__pointer={name:"pointer"},Imba.Touch.prototype.pointer=function(t){return this._pointer},Imba.Touch.prototype.setPointer=function(t){return this._pointer=t,this},Imba.Touch.prototype.__target={name:"target"},Imba.Touch.prototype.target=function(t){return this._target},Imba.Touch.prototype.setTarget=function(t){return this._target=t,this},Imba.Touch.prototype.__handler={name:"handler"},Imba.Touch.prototype.handler=function(t){return this._handler},Imba.Touch.prototype.setHandler=function(t){return this._handler=t,this},Imba.Touch.prototype.__updates={name:"updates"},Imba.Touch.prototype.updates=function(t){return this._updates},Imba.Touch.prototype.setUpdates=function(t){return this._updates=t,this},Imba.Touch.prototype.__suppress={name:"suppress"},Imba.Touch.prototype.suppress=function(t){return this._suppress},Imba.Touch.prototype.setSuppress=function(t){return this._suppress=t,this},Imba.Touch.prototype.__data={name:"data"},Imba.Touch.prototype.data=function(t){return this._data},Imba.Touch.prototype.setData=function(t){return this._data=t,this},Imba.Touch.prototype.__bubble={chainable:!0,name:"bubble"},Imba.Touch.prototype.bubble=function(t){return void 0!==t?(this.setBubble(t),this):this._bubble},Imba.Touch.prototype.setBubble=function(t){return this._bubble=t,this},Imba.Touch.prototype.__gestures={name:"gestures"},Imba.Touch.prototype.gestures=function(t){return this._gestures},Imba.Touch.prototype.setGestures=function(t){return this._gestures=t,this},Imba.Touch.prototype.__x0={name:"x0"},Imba.Touch.prototype.x0=function(t){return this._x0},Imba.Touch.prototype.setX0=function(t){return this._x0=t,this},Imba.Touch.prototype.__y0={name:"y0"},Imba.Touch.prototype.y0=function(t){return this._y0},Imba.Touch.prototype.setY0=function(t){return this._y0=t,this},Imba.Touch.prototype.preventDefault=function(){return this._preventDefault=!0,this.event()&&this.event().preventDefault(),this},Imba.Touch.prototype.extend=function(t){return this._gestures||(this._gestures=[]),this._gestures.push(t),this},Imba.Touch.prototype.redirect=function(t){return this._redirect=t,this},Imba.Touch.prototype.suppress=function(){return this._active=!1,this},Imba.Touch.prototype.touchstart=function(t,e){return this._event=t,this._touch=e,this._x=e.clientX,this._y=e.clientY,this.began(),t&&this._suppress&&t.preventDefault(),this},Imba.Touch.prototype.touchmove=function(t,e){return this._event=t,this._x=e.clientX,this._y=e.clientY,this.update(),t&&this._suppress&&t.preventDefault(),this},Imba.Touch.prototype.touchend=function(t,e){return this._event=t,this._x=e.clientX,this._y=e.clientY,this.ended(),t&&this._suppress&&t.preventDefault(),this},Imba.Touch.prototype.touchcancel=function(t,e){return this},Imba.Touch.prototype.mousedown=function(t,e){return this._x=e.clientX,this._y=e.clientY,this.began(),this},Imba.Touch.prototype.mousemove=function(t,e){return this._x=e.clientX,this._y=e.clientY,this._event=t,this._suppress&&t.preventDefault(),this.update(),this.move(),this},Imba.Touch.prototype.mouseup=function(t,e){return this._x=e.clientX,this._y=e.clientY,this.ended(),this},Imba.Touch.prototype.idle=function(){return this.update()},Imba.Touch.prototype.began=function(){this._x0=this._x,this._y0=this._y;var t=(this.event(),this.event().target),e=null;for(this._sourceTarget=t&&tag$wrap(t);t&&(e=tag$wrap(t),!e||!e.ontouchstart||(this._bubble=!1,this.setTarget(e),this.target().ontouchstart(this),this._bubble));)t=t.parentNode;return this._updates++,this},Imba.Touch.prototype.update=function(){if(!this._active)return this;if(this._redirect&&(this._target&&this._target.ontouchcancel&&this._target.ontouchcancel(this),this.setTarget(this._redirect),this._redirect=null,this.target().ontouchstart&&this.target().ontouchstart(this)),this._updates++,this._gestures)for(var e=0,n=t(this._gestures),o=n.length;o>e;e++)n[e].ontouchupdate(this);return this.target()&&this.target().ontouchupdate&&this.target().ontouchupdate(this),this},Imba.Touch.prototype.move=function(){if(!this._active)return this;if(this._gestures)for(var e,n=0,o=t(this._gestures),r=o.length;r>n;n++)e=o[n],e.ontouchmove&&e.ontouchmove(this,this._event);return this.target()&&this.target().ontouchmove&&this.target().ontouchmove(this,this._event),this},Imba.Touch.prototype.ended=function(){if(!this._active)return this;if(this._updates++,this._gestures)for(var e=0,n=t(this._gestures),o=n.length;o>e;e++)n[e].ontouchend(this);return this.target()&&this.target().ontouchend&&this.target().ontouchend(this),this._touch&&ED.trigger("tap",this.event().target),this},Imba.Touch.prototype.cancelled=function(){return this},Imba.Touch.prototype.dx=function(){return this._x-this._x0},Imba.Touch.prototype.dy=function(){return this._y-this._y0},Imba.Touch.prototype.x=function(){return this._x},Imba.Touch.prototype.y=function(){return this._y},Imba.Touch.prototype.button=function(){return this._pointer?this._pointer.button():0},Imba.Touch.prototype.sourceTarget=function(){return this._sourceTarget},Imba.TouchGesture=function(){},Imba.TouchGesture.prototype.__active={"default":!1,name:"active"},Imba.TouchGesture.prototype.active=function(t){return this._active},Imba.TouchGesture.prototype.setActive=function(t){return this._active=t,this},Imba.TouchGesture.prototype._active=!1,Imba.TouchGesture.prototype.ontouchstart=function(t){return this},Imba.TouchGesture.prototype.ontouchupdate=function(t){return this},Imba.TouchGesture.prototype.ontouchend=function(t){return this},Imba.POINTER=new Imba.Pointer,Imba.POINTERS=[Imba.POINTER],Imba.KEYMAP={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",19:"break",20:"caps",27:"esc",32:"space",35:"end",36:"home",37:"larr",38:"uarr",39:"rarr",40:"darr",45:"insert",46:"delete",107:"plus",106:"mult",91:"meta"},Imba.CHARMAP={"%":"modulo","*":"multiply","+":"add","-":"sub","/":"divide",".":"dot"},Imba.Event=function(t){this.setEvent(t),this.setBubble(!0)},Imba.Event.prototype.__event={name:"event"},Imba.Event.prototype.event=function(t){return this._event},Imba.Event.prototype.setEvent=function(t){return this._event=t,this},Imba.Event.prototype.__target={name:"target"},Imba.Event.prototype.target=function(t){return this._target},Imba.Event.prototype.setTarget=function(t){return this._target=t,this},Imba.Event.prototype.__prefix={name:"prefix"},Imba.Event.prototype.prefix=function(t){return this._prefix},Imba.Event.prototype.setPrefix=function(t){return this._prefix=t,this},Imba.Event.prototype.__data={name:"data"},Imba.Event.prototype.data=function(t){return this._data},Imba.Event.prototype.setData=function(t){return this._data=t,this},Imba.Event.prototype.__source={name:"source"},Imba.Event.prototype.source=function(t){return this._source},Imba.Event.prototype.setSource=function(t){return this._source=t,this},Imba.Event.prototype.__bubble={name:"bubble"},Imba.Event.prototype.bubble=function(t){return this._bubble},Imba.Event.prototype.setBubble=function(t){return this._bubble=t,this},Imba.Event.wrap=function(t){return new this(t)},Imba.Event.prototype.name=function(){return this.event().type.toLowerCase().replace(/\:/g,"")},Imba.Event.prototype.bubble=function(t){return void 0!=t?(this.setBubble(t),this):this._bubble},Imba.Event.prototype.halt=function(){return this.setBubble(!1),this},Imba.Event.prototype.cancel=function(){return this.event().preventDefault&&this.event().preventDefault(),this},Imba.Event.prototype.target=function(){return tag$wrap(this.event()._target||this.event().target)},Imba.Event.prototype.redirect=function(t){return this._redirect=t,this},Imba.Event.prototype.keychar=function(){if(this.event()instanceof TextEvent)return this.event().data;if(this.event()instanceof KeyboardEvent){var t=this.event().keyIdentifier,e=Imba.KEYMAP[this.event().keyCode];return e||"U+"!=t.substr(0,2)||(e=String.fromCharCode(parseInt(t.substr(2),16))),e}return null},Imba.Event.prototype.keycombo=function(){var t;if(t=this.keychar()){t=Imba.CHARMAP[t]||t;var e=[];return this.event().ctrlKey&&e.push("ctrl"),this.event().shiftKey&&e.push("shift"),this.event().altKey&&e.push("alt"),this.event().metaKey&&e.push("cmd"),e.push(t),e.join("_").toLowerCase()}},Imba.Event.prototype.process=function(){for(var t,e,n="on"+(this._prefix||"")+this.name(),o=null,r=this.event()._target||this.event().target,i=r._responder||r;i;){if(this._redirect=null,t=tag$wrap(i)){if("string"==typeof t[e=n]||t[e]instanceof String){n=t[n];continue}if(t[n]instanceof Array){o=t[n].concat(t),n=o.shift();continue}if(t[n]instanceof Function){o?t[n].apply(t,o):t[n](this,this.data())}}if(!this.bubble()||!(i=this._redirect||(t?t.parent():i.parentNode)))break}return this},Imba.Event.prototype.x=function(){return this.event().x},Imba.Event.prototype.y=function(){return this.event().y},Imba.Event.prototype.which=function(){return this.event().which},Imba.EventManager=function(e,n){var o=this;n&&n.constructor===Object||(n={});var r=void 0!==n.events?n.events:[];o.setRoot(e),o.setListeners([]),o.setDelegators({}),o.setDelegator(function(t){return o.delegate(t),!0});for(var i=0,s=t(r),u=s.length;u>i;i++)o.register(s[i])},Imba.EventManager.prototype.__root={name:"root"},Imba.EventManager.prototype.root=function(t){return this._root},Imba.EventManager.prototype.setRoot=function(t){return this._root=t,this},Imba.EventManager.prototype.__enabled={"default":!1,watch:"enabledDidSet",name:"enabled"},Imba.EventManager.prototype.enabled=function(t){return this._enabled},Imba.EventManager.prototype.setEnabled=function(t){var e=this.enabled();return t!=e&&(t=this._enabled=t),t!=e&&this.enabledDidSet&&this.enabledDidSet(t,e,this.__enabled),this},Imba.EventManager.prototype._enabled=!1,Imba.EventManager.prototype.__listeners={name:"listeners"},Imba.EventManager.prototype.listeners=function(t){return this._listeners},Imba.EventManager.prototype.setListeners=function(t){return this._listeners=t,this},Imba.EventManager.prototype.__delegators={name:"delegators"},Imba.EventManager.prototype.delegators=function(t){return this._delegators},Imba.EventManager.prototype.setDelegators=function(t){return this._delegators=t,this},Imba.EventManager.prototype.__delegator={name:"delegator"},Imba.EventManager.prototype.delegator=function(t){return this._delegator},Imba.EventManager.prototype.setDelegator=function(t){return this._delegator=t,this},Imba.EventManager.prototype.enabledDidSet=function(t){return t?this.onenable():this.ondisable(),this},Imba.EventManager.prototype.register=function(e,n){if(void 0===n&&(n=!0),e instanceof Array){for(var o=0,r=t(e),i=r.length;i>o;o++)this.register(r[o],n);return this}if(this.delegators()[e])return this;var s=this.delegators()[e]=n instanceof Function?n:this.delegator();return this.enabled()?this.root().addEventListener(e,s,!0):void 0},Imba.EventManager.prototype.listen=function(t,e,n){return void 0===n&&(n=!0),this.listeners().push([t,e,n]),this.enabled()&&this.root().addEventListener(t,e,n),this},Imba.EventManager.prototype.delegate=function(t){var e=Imba.Event.wrap(t);return e.process(),this},Imba.EventManager.prototype.create=function(t,e,n){n&&n.constructor===Object||(n={});var o=void 0!==n.data?n.data:null,r=void 0!==n.source?n.source:null,i=Imba.Event.wrap({type:t,target:e});return o&&(i.setData(o),o),r&&(i.setSource(r),r),i},Imba.EventManager.prototype.trigger=function(t,e,n){n&&n.constructor===Object||(n={});var o=void 0!==n.data?n.data:null,r=void 0!==n.source?n.source:null,i=Imba.Event.wrap({type:t,target:e});return o&&(i.setData(o),o),r&&(i.setSource(r),r),i.process()},Imba.EventManager.prototype.emit=function(e,n,o,r){r&&r.constructor===Object||(r={});for(var i,s=(void 0!==r.dom?r.dom:!0,void 0!==r.ns?r.ns:"object"),u="on"+s,a=DOC.querySelectorAll("."+e.uid()),h=0,p=t(a),c=p.length;c>h;h++)i=p[h],i._tag&&i._tag[u]&&i._tag[u](n,o);return this},Imba.EventManager.prototype.onenable=function(){for(var e=this.delegators(),n=0,o=Object.keys(e),r=o.length;r>n;n++)this.root().addEventListener(o[n],e[o[n]],!0);for(var i,s=0,u=t(this.listeners()),a=u.length;a>s;s++)i=u[s],this.root().addEventListener(i[0],i[1],i[2]);return this},Imba.EventManager.prototype.ondisable=function(){for(var e=this.delegators(),n=0,o=Object.keys(e),r=o.length;r>n;n++)this.root().removeEventListener(o[n],e[o[n]],!0);for(var i,s=0,u=t(this.listeners()),a=u.length;a>s;s++)i=u[s],this.root().removeEventListener(i[0],i[1],i[2]);return this},ED=Imba.Events=new Imba.EventManager(document,{events:["keydown","keyup","keypress","textInput","input","change","submit","focusin","focusout","blur","contextmenu","mousedown","mouseup","mousewheel","dblclick"]}),n?(ED.listen("touchstart",function(t){return Imba.Touch.ontouchstart(t)}),ED.listen("touchmove",function(t){return Imba.Touch.ontouchmove(t)}),ED.listen("touchend",function(t){return Imba.Touch.ontouchend(t)}),ED.listen("touchcancel",function(t){return Imba.Touch.ontouchcancel(t)})):(ED.listen("click",function(t){return ED.trigger("tap",t.target)}),ED.listen("mousedown",function(t){return Imba.POINTER?Imba.POINTER.update(t).process():void 0}),ED.listen("mousemove",function(t){return Imba.POINTER?Imba.POINTER.update(t).process():void 0}),ED.listen("mouseup",function(t){return Imba.POINTER?Imba.POINTER.update(t).process():void 0})),Imba.Events.setEnabled(!0)}(); - - },{}],4:[function(require,module,exports){ !function(){Imba.extendTag("htmlelement",function(t){t.prototype.__id={name:"id"},t.prototype.id=function(t){return this.getAttribute("id")},t.prototype.setId=function(t){return this.setAttribute("id",t),this},t.prototype.__tabindex={name:"tabindex"},t.prototype.tabindex=function(t){return this.getAttribute("tabindex")},t.prototype.setTabindex=function(t){return this.setAttribute("tabindex",t),this},t.prototype.__title={name:"title"},t.prototype.title=function(t){return this.getAttribute("title")},t.prototype.setTitle=function(t){return this.setAttribute("title",t),this},t.prototype.__role={name:"role"},t.prototype.role=function(t){return this.getAttribute("role")},t.prototype.setRole=function(t){return this.setAttribute("role",t),this}}),Imba.defineTag("fragment","htmlelement",function(t){t.createNode=function(){return Imba.document().createDocumentFragment()}}),Imba.defineTag("a",function(t){t.prototype.__href={dom:!0,name:"href"},t.prototype.href=function(t){return this.getAttribute("href")},t.prototype.setHref=function(t){return this.setAttribute("href",t),this}}),Imba.defineTag("abbr"),Imba.defineTag("address"),Imba.defineTag("area"),Imba.defineTag("article"),Imba.defineTag("aside"),Imba.defineTag("audio"),Imba.defineTag("b"),Imba.defineTag("base"),Imba.defineTag("bdi"),Imba.defineTag("bdo"),Imba.defineTag("big"),Imba.defineTag("blockquote"),Imba.defineTag("body"),Imba.defineTag("br"),Imba.defineTag("button",function(t){t.prototype.__autofocus={name:"autofocus"},t.prototype.autofocus=function(t){return this.getAttribute("autofocus")},t.prototype.setAutofocus=function(t){return this.setAttribute("autofocus",t),this},t.prototype.__type={dom:!0,name:"type"},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this},t.prototype.__disabled={dom:!0,name:"disabled"},t.prototype.disabled=function(t){return this.getAttribute("disabled")},t.prototype.setDisabled=function(t){return this.setAttribute("disabled",t),this}}),Imba.defineTag("canvas"),Imba.defineTag("caption"),Imba.defineTag("cite"),Imba.defineTag("code"),Imba.defineTag("col"),Imba.defineTag("colgroup"),Imba.defineTag("data"),Imba.defineTag("datalist"),Imba.defineTag("dd"),Imba.defineTag("del"),Imba.defineTag("details"),Imba.defineTag("dfn"),Imba.defineTag("div"),Imba.defineTag("dl"),Imba.defineTag("dt"),Imba.defineTag("em"),Imba.defineTag("embed"),Imba.defineTag("fieldset"),Imba.defineTag("figcaption"),Imba.defineTag("figure"),Imba.defineTag("footer"),Imba.defineTag("form",function(t){t.prototype.__method={dom:!0,name:"method"},t.prototype.method=function(t){return this.getAttribute("method")},t.prototype.setMethod=function(t){return this.setAttribute("method",t),this},t.prototype.__action={dom:!0,name:"action"},t.prototype.action=function(t){return this.getAttribute("action")},t.prototype.setAction=function(t){return this.setAttribute("action",t),this}}),Imba.defineTag("h1"),Imba.defineTag("h2"),Imba.defineTag("h3"),Imba.defineTag("h4"),Imba.defineTag("h5"),Imba.defineTag("h6"),Imba.defineTag("head"),Imba.defineTag("header"),Imba.defineTag("hr"),Imba.defineTag("html"),Imba.defineTag("i"),Imba.defineTag("iframe",function(t){t.prototype.__src={name:"src"},t.prototype.src=function(t){return this.getAttribute("src")},t.prototype.setSrc=function(t){return this.setAttribute("src",t),this}}),Imba.defineTag("img",function(t){t.prototype.__src={name:"src"},t.prototype.src=function(t){return this.getAttribute("src")},t.prototype.setSrc=function(t){return this.setAttribute("src",t),this}}),Imba.defineTag("input",function(t){t.prototype.__name={dom:!0,name:"name"},t.prototype.name=function(t){return this.getAttribute("name")},t.prototype.setName=function(t){return this.setAttribute("name",t),this},t.prototype.__type={dom:!0,name:"type"},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this},t.prototype.__value={dom:!0,name:"value"},t.prototype.value=function(t){return this.getAttribute("value")},t.prototype.setValue=function(t){return this.setAttribute("value",t),this},t.prototype.__required={dom:!0,name:"required"},t.prototype.required=function(t){return this.getAttribute("required")},t.prototype.setRequired=function(t){return this.setAttribute("required",t),this},t.prototype.__disabled={dom:!0,name:"disabled"},t.prototype.disabled=function(t){return this.getAttribute("disabled")},t.prototype.setDisabled=function(t){return this.setAttribute("disabled",t),this},t.prototype.__placeholder={dom:!0,name:"placeholder"},t.prototype.placeholder=function(t){return this.getAttribute("placeholder")},t.prototype.setPlaceholder=function(t){return this.setAttribute("placeholder",t),this},t.prototype.__autofocus={name:"autofocus"},t.prototype.autofocus=function(t){return this.getAttribute("autofocus")},t.prototype.setAutofocus=function(t){return this.setAttribute("autofocus",t),this},t.prototype.value=function(){return this.dom().value},t.prototype.setValue=function(t){return this.dom().value=t,this},t.prototype.checked=function(){return this.dom().checked},t.prototype.setChecked=function(t){return this.dom().checked=t,this}}),Imba.defineTag("ins"),Imba.defineTag("kbd"),Imba.defineTag("keygen"),Imba.defineTag("label"),Imba.defineTag("legend"),Imba.defineTag("li"),Imba.defineTag("link",function(t){t.prototype.__rel={dom:!0,name:"rel"},t.prototype.rel=function(t){return this.getAttribute("rel")},t.prototype.setRel=function(t){return this.setAttribute("rel",t),this},t.prototype.__type={dom:!0,name:"type"},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this},t.prototype.__href={dom:!0,name:"href"},t.prototype.href=function(t){return this.getAttribute("href")},t.prototype.setHref=function(t){return this.setAttribute("href",t),this},t.prototype.__media={dom:!0,name:"media"},t.prototype.media=function(t){return this.getAttribute("media")},t.prototype.setMedia=function(t){return this.setAttribute("media",t),this}}),Imba.defineTag("main"),Imba.defineTag("map"),Imba.defineTag("mark"),Imba.defineTag("menu"),Imba.defineTag("menuitem"),Imba.defineTag("meta",function(t){t.prototype.__name={dom:!0,name:"name"},t.prototype.name=function(t){return this.getAttribute("name")},t.prototype.setName=function(t){return this.setAttribute("name",t),this},t.prototype.__content={dom:!0,name:"content"},t.prototype.content=function(t){return this.getAttribute("content")},t.prototype.setContent=function(t){return this.setAttribute("content",t),this},t.prototype.__charset={dom:!0,name:"charset"},t.prototype.charset=function(t){return this.getAttribute("charset")},t.prototype.setCharset=function(t){return this.setAttribute("charset",t),this}}),Imba.defineTag("meter"),Imba.defineTag("nav"),Imba.defineTag("noscript"),Imba.defineTag("object"),Imba.defineTag("ol"),Imba.defineTag("optgroup"),Imba.defineTag("option",function(t){t.prototype.__value={dom:!0,name:"value"},t.prototype.value=function(t){return this.getAttribute("value")},t.prototype.setValue=function(t){return this.setAttribute("value",t),this}}),Imba.defineTag("output"),Imba.defineTag("p"),Imba.defineTag("param"),Imba.defineTag("pre"),Imba.defineTag("progress"),Imba.defineTag("q"),Imba.defineTag("rp"),Imba.defineTag("rt"),Imba.defineTag("ruby"),Imba.defineTag("s"),Imba.defineTag("samp"),Imba.defineTag("script",function(t){t.prototype.__src={dom:!0,name:"src"},t.prototype.src=function(t){return this.getAttribute("src")},t.prototype.setSrc=function(t){return this.setAttribute("src",t),this},t.prototype.__type={dom:!0,name:"type"},t.prototype.type=function(t){return this.getAttribute("type")},t.prototype.setType=function(t){return this.setAttribute("type",t),this}}),Imba.defineTag("section"),Imba.defineTag("select",function(t){t.prototype.__multiple={dom:!0,name:"multiple"},t.prototype.multiple=function(t){return this.getAttribute("multiple")},t.prototype.setMultiple=function(t){return this.setAttribute("multiple",t),this},t.prototype.value=function(){return this.dom().value},t.prototype.setValue=function(t){return this.dom().value=t,this}}),Imba.defineTag("small"),Imba.defineTag("source"),Imba.defineTag("span"),Imba.defineTag("strong"),Imba.defineTag("style"),Imba.defineTag("sub"),Imba.defineTag("summary"),Imba.defineTag("sup"),Imba.defineTag("table"),Imba.defineTag("tbody"),Imba.defineTag("td"),Imba.defineTag("textarea",function(t){t.prototype.__name={dom:!0,name:"name"},t.prototype.name=function(t){return this.getAttribute("name")},t.prototype.setName=function(t){return this.setAttribute("name",t),this},t.prototype.__disabled={dom:!0,name:"disabled"},t.prototype.disabled=function(t){return this.getAttribute("disabled")},t.prototype.setDisabled=function(t){return this.setAttribute("disabled",t),this},t.prototype.__required={dom:!0,name:"required"},t.prototype.required=function(t){return this.getAttribute("required")},t.prototype.setRequired=function(t){return this.setAttribute("required",t),this},t.prototype.__placeholder={dom:!0,name:"placeholder"},t.prototype.placeholder=function(t){return this.getAttribute("placeholder")},t.prototype.setPlaceholder=function(t){return this.setAttribute("placeholder",t),this},t.prototype.__value={dom:!0,name:"value"},t.prototype.value=function(t){return this.getAttribute("value")},t.prototype.setValue=function(t){return this.setAttribute("value",t),this},t.prototype.__rows={dom:!0,name:"rows"},t.prototype.rows=function(t){return this.getAttribute("rows")},t.prototype.setRows=function(t){return this.setAttribute("rows",t),this},t.prototype.__cols={dom:!0,name:"cols"},t.prototype.cols=function(t){return this.getAttribute("cols")},t.prototype.setCols=function(t){return this.setAttribute("cols",t),this},t.prototype.__autofocus={name:"autofocus"},t.prototype.autofocus=function(t){return this.getAttribute("autofocus")},t.prototype.setAutofocus=function(t){return this.setAttribute("autofocus",t),this},t.prototype.value=function(){return this.dom().value},t.prototype.setValue=function(t){return this.dom().value=t,this}}),Imba.defineTag("tfoot"),Imba.defineTag("th"),Imba.defineTag("thead"),Imba.defineTag("time"),Imba.defineTag("title"),Imba.defineTag("tr"),Imba.defineTag("track"),Imba.defineTag("u"),Imba.defineTag("ul"),Imba.defineTag("video"),Imba.defineTag("wbr")}(); - - },{}],5:[function(require,module,exports){ -!function(){function t(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)}function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t}function n(t){return t?t.toArray?t.toArray():t:[]}function o(t){this.setDom(t)}function r(){o.apply(this,arguments)}function i(){o.apply(this,arguments)}function s(t,e){for(var n=0,o=Object.keys(e),r=o.length;r>n;n++)t[o[n]]=e[o[n]];return t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t,t}var a="undefined"!=typeof SVGElement;Imba.document=function(){return window.document},Imba["static"]=function(t,e){return t["static"]=e,t},o.prototype.__object={name:"object"},o.prototype.object=function(t){return this._object},o.prototype.setObject=function(t){return this._object=t,this},o.prototype.dom=function(){return this._dom},o.prototype.setDom=function(t){return t._tag=this,this._dom=t,this},o.prototype.setRef=function(t){return this.flag(this._ref=t),this},o.prototype.setHandler=function(t,e){return this["on"+t]=e,this},o.prototype.setId=function(t){return this.dom().id=t,this},o.prototype.id=function(){return this.dom().id},o.prototype.setAttribute=function(t,e){var n=this.dom().getAttribute(t);return n==e?e:null!=e&&e!==!1?this.dom().setAttribute(t,e):this.dom().removeAttribute(t)},o.prototype.removeAttribute=function(t){return this.dom().removeAttribute(t)},o.prototype.getAttribute=function(t){return this.dom().getAttribute(t)},o.prototype.object=function(t){return arguments.length?(this.setObject(t),t,this):this._object},o.prototype.setContent=function(t){return this.setChildren(t),this},o.prototype.setChildren=function(t){return this._empty?this.append(t):this.empty().append(t),this._children=null,this},o.prototype.text=function(t){return arguments.length?(this.setText(t),t,this):this._dom.textContent},o.prototype.setText=function(t){return this._empty=!1,this._dom.textContent=null==t?t="":t,this},o.prototype.empty=function(){for(;this._dom.firstChild;)this._dom.removeChild(this._dom.firstChild);return this._children=null,this._empty=!0,this},o.prototype.remove=function(t){var e=this.dom(),n=t&&t.dom();return n&&n.parentNode==e&&e.removeChild(n),this},o.prototype.parent=function(){return tag$wrap(this.dom().parentNode)},o.prototype.log=function(){for(var t=arguments,e=t.length,n=new Array(e>0?e:0);e>0;)n[e-1]=t[--e];return n.unshift(console),Function.prototype.call.apply(console.log,n),this},o.prototype.emit=function(t,e){e&&e.constructor===Object||(e={});var n=void 0!==e.data?e.data:null,o=void 0!==e.bubble?e.bubble:!0;return Imba.Events.trigger(t,this,{data:n,bubble:o}),this},o.prototype.css=function(t,e){if(t instanceof Object)for(var n=0,o=Object.keys(t),r=o.length;r>n;n++)this.css(o[n],t[o[n]]);else if(null==e)this.dom().style.removeProperty(t);else{if(void 0==e)return this.dom().style[t];("number"==typeof e||e instanceof Number)&&t.match(/width|height|left|right|top|bottom/)&&(e+="px"),this.dom().style[t]=e}return this},o.prototype.find=function(t){return new Imba.Selector(t,this)},o.prototype.first=function(t){return t?this.find(t).first():tag$wrap(this.dom().firstElementChild)},o.prototype.last=function(t){return t?this.find(t).last():tag$wrap(this.dom().lastElementChild)},o.prototype.child=function(t){return tag$wrap(this.dom().children[t||0])},o.prototype.children=function(t){var e=new Imba.Selector(null,this,this._dom.children);return t?e.filter(t):e},o.prototype.orphanize=function(){var t;return(t=this.dom().parentNode)&&t.removeChild(this._dom),this},o.prototype.matches=function(t){var e;return t instanceof Function?t(this):(t.query&&(t=t.query()),(e=this._dom.webkitMatchesSelector||this._dom.matches)?e.call(this._dom,t):void 0)},o.prototype.closest=function(t){if(!t)return this.parent();var e=this;for(t.query&&(t=t.query());e;){if(e.matches(t))return e;e=e.parent()}return null},o.prototype.path=function(t){var e=this,n=[];for(t&&t.query&&(t=t.query());e;)(!t||e.matches(t))&&n.push(e),e=e.parent();return n},o.prototype.parents=function(t){var e=this.parent();return e?e.path(t):[]},o.prototype.up=function(t){return t?this.parent()&&this.parent().closest(t):this.parent()},o.prototype.siblings=function(t){var e,n=this;if(!(e=this.parent()))return[];var o=this.dom().parentNode.children,r=new Imba.Selector(null,this,o);return r.filter(function(e){return e!=n&&(!t||e.matches(t))})},o.prototype.next=function(t){if(t){for(var e=this;e=e.next();)if(e.matches(t))return e;return null}return tag$wrap(this.dom().nextElementSibling)},o.prototype.prev=function(t){if(t){for(var e=this;e=e.prev();)if(e.matches(t))return e;return null}return tag$wrap(this.dom().previousElementSibling)},o.prototype.contains=function(t){return this.dom().contains(t&&t._dom||t)},o.prototype.index=function(){for(var t=0,e=this.dom();e.previousSibling;)e=e.previousSibling,t++;return t},o.prototype.insert=function(t,e){e&&e.constructor===Object||(e={});var n=void 0!==e.before?e.before:null,o=void 0!==e.after?e.after:null;return o&&(n=o.next()),t instanceof Array&&(t=t$("fragment").setContent([t]).end()),n?this.dom().insertBefore(t.dom(),n.dom()):this.append(t),this},o.prototype.bind=function(t){return this.setObject(t),this},o.prototype.render=function(){return this},o.prototype.build=function(){return this.render(),this},o.prototype.commit=function(){return this},o.prototype.end=function(){return this._built?this.commit():(this._built=!0,this.build()),this},o.prototype.synced=function(){return this},o.prototype.awaken=function(){return this},o.prototype.focus=function(){return this.dom().focus(),this},o.prototype.blur=function(){return this.dom().blur(),this},o.prototype.template=function(){return null},o.prototype.prepend=function(t){return this.insert(t,{before:this.first()})},o.prototype.append=function(t){if(!t)return this;if(t instanceof Array)for(var e,o=0,r=n(t),i=r.length;i>o;o++)e=r[o],e&&this.append(e);else if("string"==typeof t||t instanceof String||"number"==typeof t||t instanceof Number){var s=Imba.document().createTextNode(t);this._dom.appendChild(s),this._empty&&(this._empty=!1)}else this._dom.appendChild(t._dom||t),this._empty&&(this._empty=!1);return this},o.prototype.insertBefore=function(t,e){return("string"==typeof t||t instanceof String)&&(t=Imba.document().createTextNode(t)),t&&e&&this.dom().insertBefore(t._dom||t,e._dom||e),this},o.prototype.appendChild=function(t){return("string"==typeof t||t instanceof String)&&(t=Imba.document().createTextNode(t)),t&&this.dom().appendChild(t._dom||t),this},o.prototype.removeChild=function(t){return t&&this.dom().removeChild(t._dom||t),this},o.prototype.toString=function(){return this._dom.toString()},o.prototype.classes=function(){return this._dom.classList},o.prototype.flags=function(){return this._dom.classList},o.prototype.flag=function(t,e){return 2==arguments.length?e?this.flags().add(t):this.flags().remove(t):this.flags().add(t),this},o.prototype.unflag=function(t){return this.flags().remove(t),this},o.prototype.hasFlag=function(t){return this.flags().contains(t)},o.dom=function(){if(this._dom)return this._dom;var t,e=this.__super__.constructor;if(this._isNative)t=Imba.document().createElement(this._nodeType);else if(this._nodeType!=e._nodeType){t=Imba.document().createElement(this._nodeType);for(var o,r=0,i=n(e.dom()),s=i.length;s>r;r++)o=i[r],t.setAttribute(o.name,o.value)}else t=e.dom().cloneNode(!1);if(this._domFlags)for(var r=0,i=n(this._domFlags),s=i.length;s>r;r++)t.classList.add(i[r]);return this._dom=t},o.createNode=function(t,e){var n=this._dom||this.dom(),o=n.cloneNode(!1);return o},o.flag=function(t){return this.dom().classList.add(t),this},o.unflag=function(t){return this.dom().classList.remove(t),this},o.createNode=function(t,e){var n=this._dom||this.dom(),o=n.cloneNode(!1);return o},o.prototype.initialize=o,e(r,o),e(i,o),HTML_TAGS="a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr".split(" "),HTML_TAGS_UNSAFE="article aside header section".split(" "),SVG_TAGS="circle defs ellipse g line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" "),Imba.TAGS={element:o,htmlelement:r,svgelement:i},Imba.SINGLETONS={},IMBA_TAGS=Imba.TAGS,Imba.defineTag=function(e,n,o){void 0==o&&"function"==typeof n&&(o=n,n="");var r=e.split("$"),e=r[0],i=r[1];n||(n=t(e,HTML_TAGS)>=0?"htmlelement":"div");var a=Imba.TAGS[n],p=new Function("return function "+e.replace(/[\s\-\:]/g,"_")+"(dom){ this.setDom(dom); }"),u=p(),d=u;if(s(d,a),d._nodeType=a._nodeType||e,d._name=e,d._ns=i,d._nodeType!=e){d._nodeFlag="_"+e.replace(/_/g,"-");var l=a._nodeClass;l=l?l.split(/\s+/g):[];var c=null;i&&-1==t(c,l)&&l.push(c=""+i+"_"),t(c,l)>=0||l.push(c=d._nodeFlag),d._nodeClass=l.join(" "),d._domFlags=l,d._isNative=!1}else d._isNative=!0;return d._dom=null,d.prototype._nodeType=d._nodeType,d.prototype._dom=null,d.prototype._built=!1,d.prototype._empty=!0,i||(Imba.TAGS[e]=d),Imba.TAGS[""+e+"$"+(i||"html")]=d,o&&o.call(d,d,d.prototype),d},Imba.defineSingletonTag=function(t,e,n){void 0==n&&"function"==typeof e&&(n=e,e="");var o=Imba.TAGS[e||"div"],r=new Function("return function "+t.replace(/[\s\-\:]/g,"_")+"(dom){ this.setDom(dom); }"),i=r(),a=s(i,o);return a._id=t,a._ns=o._ns,a._nodeType=o._nodeType,a._nodeClass=o._nodeClass,a._domFlags=o._domFlags,a._isNative=!1,a._dom=null,a._instance=null,a.prototype._dom=null,a.prototype._built=!1,a.prototype._empty=!0,Imba.SINGLETONS[t]=a,n&&n.call(a,a,a.prototype),a},Imba.extendTag=function(t,e){var n="string"==typeof t||t instanceof String?Imba.TAGS[t]:t;return e&&e&&e.call(n,n,n.prototype),n},Imba.tag=function(t){var e=Imba.TAGS[t];return new e(e.createNode())},Imba.tagWithId=function(t,e){var n=Imba.TAGS[t],o=n.createNode();return o.id=e,new n(o)},Imba.getTagSingleton=function(t){var e,n,o;return(e=Imba.SINGLETONS[t])?e&&e.Instance?e.Instance:(o=Imba.document().getElementById(t))?(n=e.Instance=new e(o),n.awaken(o),n):(o=e.createNode(),o.id=t,n=e.Instance=new e(o),n.end().awaken(o),n):(o=Imba.document().getElementById(t))?Imba.getTagForDom(o):void 0},Imba.getTagForDom=function(t){var e;if(!t)return null;if(t._dom)return t;if(t._tag)return t._tag;if(!t.nodeName)return null;var n=null,o=t.id,r=t.nodeName.toLowerCase(),i=t.className;if(o&&Imba.SINGLETONS[o])return Imba.getTagSingleton(o);a&&t instanceof SVGElement&&(n="svg",i=t.className.baseVal),i&&((e=i.match(/\b_([a-z\-]+)\b(?!\s*_[a-z\-]+)/))&&(r=e[1].replace(/-/g,"_")),(e=i.match(/\b([a-z]+)_\b/))&&(n=e[1]));var s=Imba.TAGS[r];return s?new s(t).awaken(t):null},t$=Imba.tag,tc$=Imba.tagWithFlags,ti$=Imba.tagWithId,tic$=Imba.tagWithIdAndFlags,id$=Imba.getTagSingleton,tag$wrap=Imba.getTagForDom}(); - - +!function(){function t(t,e){return e&&e.indexOf?e.indexOf(t):[].indexOf.call(t,e)}function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t}function n(t){return t?t.toArray?t.toArray():t:[]}function o(t){this.setDom(t)}function r(){o.apply(this,arguments)}function i(){o.apply(this,arguments)}function s(t,e){for(var n=0,o=Object.keys(e),r=o.length;r>n;n++)t[o[n]]=e[o[n]];return t.prototype=Object.create(e.prototype),t.__super__=t.prototype.__super__=e.prototype,t.prototype.initialize=t.prototype.constructor=t,t}var a="undefined"!=typeof SVGElement;Imba.document=function(){return window.document},Imba["static"]=function(t,e){return t["static"]=e,t},o.prototype.__object={name:"object"},o.prototype.object=function(t){return this._object},o.prototype.setObject=function(t){return this._object=t,this},o.prototype.dom=function(){return this._dom},o.prototype.setDom=function(t){return t._tag=this,this._dom=t,this},o.prototype.setRef=function(t){return this.flag(this._ref=t),this},o.prototype.setHandler=function(t,e){return this["on"+t]=e,this},o.prototype.setId=function(t){return this.dom().id=t,this},o.prototype.id=function(){return this.dom().id},o.prototype.setAttribute=function(t,e){var n=this.dom().getAttribute(t);return n==e?e:null!=e&&e!==!1?this.dom().setAttribute(t,e):this.dom().removeAttribute(t)},o.prototype.removeAttribute=function(t){return this.dom().removeAttribute(t)},o.prototype.getAttribute=function(t){return this.dom().getAttribute(t)},o.prototype.setContent=function(t){return this.setChildren(t),this},o.prototype.setChildren=function(t){return this._empty?this.append(t):this.empty().append(t),this._children=null,this},o.prototype.text=function(t){return arguments.length?(this.setText(t),t,this):this._dom.textContent},o.prototype.setText=function(t){return this._empty=!1,this._dom.textContent=null==t?t="":t,this},o.prototype.empty=function(){for(;this._dom.firstChild;)this._dom.removeChild(this._dom.firstChild);return this._children=null,this._empty=!0,this},o.prototype.remove=function(t){var e=this.dom(),n=t&&t.dom();return n&&n.parentNode==e&&e.removeChild(n),this},o.prototype.parent=function(){return tag$wrap(this.dom().parentNode)},o.prototype.log=function(){for(var t=arguments,e=t.length,n=new Array(e>0?e:0);e>0;)n[e-1]=t[--e];return n.unshift(console),Function.prototype.call.apply(console.log,n),this},o.prototype.emit=function(t,e){e&&e.constructor===Object||(e={});var n=void 0!==e.data?e.data:null,o=void 0!==e.bubble?e.bubble:!0;return Imba.Events.trigger(t,this,{data:n,bubble:o}),this},o.prototype.css=function(t,e){if(t instanceof Object)for(var n=0,o=Object.keys(t),r=o.length;r>n;n++)this.css(o[n],t[o[n]]);else if(null==e)this.dom().style.removeProperty(t);else{if(void 0==e)return this.dom().style[t];("number"==typeof e||e instanceof Number)&&t.match(/width|height|left|right|top|bottom/)&&(e+="px"),this.dom().style[t]=e}return this},o.prototype.find=function(t){return new Imba.Selector(t,this)},o.prototype.first=function(t){return t?this.find(t).first():tag$wrap(this.dom().firstElementChild)},o.prototype.last=function(t){return t?this.find(t).last():tag$wrap(this.dom().lastElementChild)},o.prototype.child=function(t){return tag$wrap(this.dom().children[t||0])},o.prototype.children=function(t){var e=new Imba.Selector(null,this,this._dom.children);return t?e.filter(t):e},o.prototype.orphanize=function(){var t;return(t=this.dom().parentNode)&&t.removeChild(this._dom),this},o.prototype.matches=function(t){var e;return t instanceof Function?t(this):(t.query&&(t=t.query()),(e=this._dom.webkitMatchesSelector||this._dom.matches)?e.call(this._dom,t):void 0)},o.prototype.closest=function(t){if(!t)return this.parent();var e=this;for(t.query&&(t=t.query());e;){if(e.matches(t))return e;e=e.parent()}return null},o.prototype.path=function(t){var e=this,n=[];for(t&&t.query&&(t=t.query());e;)(!t||e.matches(t))&&n.push(e),e=e.parent();return n},o.prototype.parents=function(t){var e=this.parent();return e?e.path(t):[]},o.prototype.up=function(t){return t?this.parent()&&this.parent().closest(t):this.parent()},o.prototype.siblings=function(t){var e,n=this;if(!(e=this.parent()))return[];var o=this.dom().parentNode.children,r=new Imba.Selector(null,this,o);return r.filter(function(e){return e!=n&&(!t||e.matches(t))})},o.prototype.next=function(t){if(t){for(var e=this;e=e.next();)if(e.matches(t))return e;return null}return tag$wrap(this.dom().nextElementSibling)},o.prototype.prev=function(t){if(t){for(var e=this;e=e.prev();)if(e.matches(t))return e;return null}return tag$wrap(this.dom().previousElementSibling)},o.prototype.contains=function(t){return this.dom().contains(t&&t._dom||t)},o.prototype.index=function(){for(var t=0,e=this.dom();e.previousSibling;)e=e.previousSibling,t++;return t},o.prototype.insert=function(t,e){e&&e.constructor===Object||(e={});var n=void 0!==e.before?e.before:null,o=void 0!==e.after?e.after:null;return o&&(n=o.next()),t instanceof Array&&(t=t$("fragment").setContent([t]).end()),n?this.dom().insertBefore(t.dom(),n.dom()):this.append(t),this},o.prototype.bind=function(t){return this.setObject(t),this},o.prototype.render=function(){return this},o.prototype.build=function(){return this.render(),this},o.prototype.commit=function(){return this},o.prototype.end=function(){return this._built?this.commit():(this._built=!0,this.build()),this},o.prototype.synced=function(){return this},o.prototype.awaken=function(){return this},o.prototype.focus=function(){return this.dom().focus(),this},o.prototype.blur=function(){return this.dom().blur(),this},o.prototype.template=function(){return null},o.prototype.prepend=function(t){return this.insert(t,{before:this.first()})},o.prototype.append=function(t){if(!t)return this;if(t instanceof Array)for(var e,o=0,r=n(t),i=r.length;i>o;o++)e=r[o],e&&this.append(e);else if("string"==typeof t||t instanceof String||"number"==typeof t||t instanceof Number){var s=Imba.document().createTextNode(t);this._dom.appendChild(s),this._empty&&(this._empty=!1)}else this._dom.appendChild(t._dom||t),this._empty&&(this._empty=!1);return this},o.prototype.insertBefore=function(t,e){return("string"==typeof t||t instanceof String)&&(t=Imba.document().createTextNode(t)),t&&e&&this.dom().insertBefore(t._dom||t,e._dom||e),this},o.prototype.appendChild=function(t){return("string"==typeof t||t instanceof String)&&(t=Imba.document().createTextNode(t)),t&&this.dom().appendChild(t._dom||t),this},o.prototype.removeChild=function(t){return t&&this.dom().removeChild(t._dom||t),this},o.prototype.toString=function(){return this._dom.toString()},o.prototype.classes=function(){return this._dom.classList},o.prototype.flags=function(){return this._dom.classList},o.prototype.flag=function(t,e){return 2==arguments.length?e?this.flags().add(t):this.flags().remove(t):this.flags().add(t),this},o.prototype.unflag=function(t){return this.flags().remove(t),this},o.prototype.hasFlag=function(t){return this.flags().contains(t)},o.dom=function(){if(this._dom)return this._dom;var t,e=this.__super__.constructor;if(this._isNative)t=Imba.document().createElement(this._nodeType);else if(this._nodeType!=e._nodeType){t=Imba.document().createElement(this._nodeType);for(var o,r=0,i=n(e.dom()),s=i.length;s>r;r++)o=i[r],t.setAttribute(o.name,o.value)}else t=e.dom().cloneNode(!1);if(this._domFlags)for(var r=0,i=n(this._domFlags),s=i.length;s>r;r++)t.classList.add(i[r]);return this._dom=t},o.createNode=function(t,e){var n=this._dom||this.dom(),o=n.cloneNode(!1);return o},o.flag=function(t){return this.dom().classList.add(t),this},o.unflag=function(t){return this.dom().classList.remove(t),this},o.createNode=function(t,e){var n=this._dom||this.dom(),o=n.cloneNode(!1);return o},o.prototype.initialize=o,e(r,o),e(i,o),HTML_TAGS="a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup data datalist dd del details dfn div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hr html i iframe img input ins kbd keygen label legend li link main map mark menu menuitem meta meter nav noscript object ol optgroup option output p param pre progress q rp rt ruby s samp script section select small source span strong style sub summary sup table tbody td textarea tfoot th thead time title tr track u ul var video wbr".split(" "),HTML_TAGS_UNSAFE="article aside header section".split(" "),SVG_TAGS="circle defs ellipse g line linearGradient mask path pattern polygon polyline radialGradient rect stop svg text tspan".split(" "),Imba.TAGS={element:o,htmlelement:r,svgelement:i},Imba.SINGLETONS={},IMBA_TAGS=Imba.TAGS,Imba.defineTag=function(e,n,o){void 0==o&&"function"==typeof n&&(o=n,n="");var r=e.split("$"),e=r[0],i=r[1];n||(n=t(e,HTML_TAGS)>=0?"htmlelement":"div");var a=Imba.TAGS[n],p=new Function("return function "+e.replace(/[\s\-\:]/g,"_")+"(dom){ this.setDom(dom); }"),u=p(),d=u;if(s(d,a),d._nodeType=a._nodeType||e,d._name=e,d._ns=i,d._nodeType!=e){d._nodeFlag="_"+e.replace(/_/g,"-");var l=a._nodeClass;l=l?l.split(/\s+/g):[];var m=null;i&&-1==t(m,l)&&l.push(m=""+i+"_"),t(m,l)>=0||l.push(m=d._nodeFlag),d._nodeClass=l.join(" "),d._domFlags=l,d._isNative=!1}else d._isNative=!0;return d._dom=null,d.prototype._nodeType=d._nodeType,d.prototype._dom=null,d.prototype._built=!1,d.prototype._empty=!0,i||(Imba.TAGS[e]=d),Imba.TAGS[""+e+"$"+(i||"html")]=d,o&&o.call(d,d,d.prototype),d},Imba.defineSingletonTag=function(t,e,n){void 0==n&&"function"==typeof e&&(n=e,e="");var o=Imba.TAGS[e||"div"],r=new Function("return function "+t.replace(/[\s\-\:]/g,"_")+"(dom){ this.setDom(dom); }"),i=r(),a=s(i,o);return a._id=t,a._ns=o._ns,a._nodeType=o._nodeType,a._nodeClass=o._nodeClass,a._domFlags=o._domFlags,a._isNative=!1,a._dom=null,a._instance=null,a.prototype._dom=null,a.prototype._built=!1,a.prototype._empty=!0,Imba.SINGLETONS[t]=a,n&&n.call(a,a,a.prototype),a},Imba.extendTag=function(t,e){var n="string"==typeof t||t instanceof String?Imba.TAGS[t]:t;return e&&e&&e.call(n,n,n.prototype),n},Imba.tag=function(t){var e=Imba.TAGS[t];return new e(e.createNode())},Imba.tagWithId=function(t,e){var n=Imba.TAGS[t],o=n.createNode();return o.id=e,new n(o)},Imba.getTagSingleton=function(t){var e,n,o;return(e=Imba.SINGLETONS[t])?e&&e.Instance?e.Instance:(o=Imba.document().getElementById(t))?(n=e.Instance=new e(o),n.awaken(o),n):(o=e.createNode(),o.id=t,n=e.Instance=new e(o),n.end().awaken(o),n):(o=Imba.document().getElementById(t))?Imba.getTagForDom(o):void 0},Imba.getTagForDom=function(t){var e;if(!t)return null;if(t._dom)return t;if(t._tag)return t._tag;if(!t.nodeName)return null;var n=null,o=t.id,r=t.nodeName.toLowerCase(),i=t.className;if(o&&Imba.SINGLETONS[o])return Imba.getTagSingleton(o);a&&t instanceof SVGElement&&(n="svg",i=t.className.baseVal),i&&((e=i.match(/\b_([a-z\-]+)\b(?!\s*_[a-z\-]+)/))&&(r=e[1].replace(/-/g,"_")),(e=i.match(/\b([a-z]+)_\b/))&&(n=e[1]));var s=Imba.TAGS[r];return s?new s(t).awaken(t):null},t$=Imba.tag,tc$=Imba.tagWithFlags,ti$=Imba.tagWithId,tic$=Imba.tagWithIdAndFlags,id$=Imba.getTagSingleton,tag$wrap=Imba.getTagForDom}(); },{}],6:[function(require,module,exports){ !function(){function t(t){return t?t.toArray?t.toArray():t:[]}function e(n,r,i){if(r instanceof Array)for(var o=0,f=t(r),s=f.length;s>o;o++)e(n,f[o],i);else"number"==typeof r||r instanceof Number||r&&n.removeChild(r);return i}function n(e,r){if(r instanceof Array)for(var i=0,o=t(r),f=o.length;f>i;i++)n(e,o[i]);else"number"==typeof r||r instanceof Number||("string"==typeof r||r instanceof String?e.appendChild(Imba.document().createTextNode(r)):r&&e.appendChild(r))}function r(e,n,i){if(("string"==typeof n||n instanceof String)&&(n=Imba.document().createTextNode(n)),n instanceof Array)for(var o=0,f=t(n),s=f.length;s>o;o++)r(e,f[o],i);else"number"==typeof n||n instanceof Number||n&&e.insertBefore(n,i);return i}function i(t,e,i){var o=i?i.nextSibling:t._dom.firstChild;return o?(r(t,e,o),o.previousSibling):(n(t,e),t._dom.lastChild)}function o(e,n,r,o){for(var f,s=n.length,a=(r.length,n[s-1]),h=[],c=[],u=[],l=0,d=0,p=0,m=t(r),g=m.length;g>p;p++){f=m[p];var y=n.indexOf(f);if(h.push(y),-1!=y){for(var v=h.length-2;v>=0;)if(-1==h[v])v--;else{if(y>h[v])break;v=c[v]}c.push(v);var _=-1==v?0:u[v]+1;_>l&&(l=_,d=p),u.push(_)}else e.removeChild(f),c.push(-1),u.push(-1)}for(var b=[],x=h.length-1;x>=0;)-1==h[x]||x==d&&(b[h[x]]=!0,d=c[d]),x-=1;for(var C=0,m=t(n),g=m.length;g>C;C++)if(!b[C]){var A=n[C-1];i(e,m[C],A&&A._dom||o)}return a&&a._dom||o}function f(t,e,n,r){var i=e.length,f=i,s=e[i-1];if(i==n.length&&e[0]===n[0])for(;f--&&e[f]===n[f];);return-1==f?s&&s._dom||r:o(t,e,n,r)}function s(n,r,o,a,h,c){if(r===o)return r&&r._dom||r||a;if(r instanceof Array&&o instanceof Array){if(!r["static"])return f(n,r,o,a);if(r["static"]==o["static"]){for(var u=0,l=t(r),d=l.length;d>u;u++)a=s(n,l[u],o[u],a,r,u);return a}}else if("string"==typeof r||r instanceof String){var p;return o instanceof Text?(o.textContent!=r&&(o.textContent=r),p=o):(o&&e(n,o,a),p=Imba.document().createTextNode(r),i(n,p,a)),h[c]=a=p}return o&&e(n,o,a),r&&(a=i(n,r,a)),a}Imba.extendTag("htmlelement",function(e){e.prototype.setChildren=function(t){return t&&t["static"]?this.setStaticChildren(t):(this.empty().append(t),this._children=t),this},e.prototype.setStaticChildren=function(e){var n,r,i=this._children||[],o=null;if(1==e.length&&("string"==typeof e[n=0]||e[n]instanceof String))return this.setText(e[r=0]),e[r];i.length&&i["static"]||(i=[],this.empty());for(var f,a=0,h=t(e),c=h.length;c>a;a++)f=h[a],f===i[a]?f&&f._dom&&(o=f._dom):o=s(this,f,i[a],o,e,a);return this._children=e,this},e.prototype.content=function(){return this._content||this.children().toArray()},e.prototype.setText=function(t){return t!=this._children&&(this.dom().textContent=this._children=t),this}})}(); - - },{}],7:[function(require,module,exports){ !function(){"undefined"!=typeof window&&(global=window),Imba={}}(); - - },{}],8:[function(require,module,exports){ !function(){function t(t){return t?t.toArray?t.toArray():t:[]}Imba.Selector=function(e,r,o){if(this._query=e instanceof Imba.Selector?e.query():e,this._context=r,o){for(var n=0,i=t(o),u=i.length,c=[];u>n;n++)c.push(tag$wrap(i[n]));this._nodes=c}return this._lazy=!o,this},Imba.Selector.prototype.__query={name:"query"},Imba.Selector.prototype.query=function(t){return this._query},Imba.Selector.prototype.setQuery=function(t){return this._query=t,this},Imba.Selector.prototype.reload=function(){return this._nodes=null,this},Imba.Selector.prototype.scope=function(){var t;return this._scope?this._scope:(t=this._context)?this._scope=t.toScope?t.toScope():t:Imba.document()},Imba.Selector.prototype.first=function(){return this._lazy?tag$wrap(this._first||(this._first=this.scope().querySelector(this.query()))):this.nodes()[0]},Imba.Selector.prototype.last=function(){return this.nodes()[this._nodes.length-1]},Imba.Selector.prototype.nodes=function(){if(this._nodes)return this._nodes;for(var e=this.scope().querySelectorAll(this.query()),r=0,o=t(e),n=o.length,i=[];n>r;r++)i.push(tag$wrap(o[r]));return this._nodes=i,this._lazy=!1,this._nodes},Imba.Selector.prototype.count=function(){return this.nodes().length},Imba.Selector.prototype.len=function(){return this.nodes().length},Imba.Selector.prototype.any=function(){return this.count()},Imba.Selector.prototype.at=function(t){return this.nodes()[t]},Imba.Selector.prototype.forEach=function(t){return this.nodes().forEach(t),this},Imba.Selector.prototype.map=function(t){return this.nodes().map(t)},Imba.Selector.prototype.toArray=function(){return this.nodes()},Imba.Selector.prototype.closest=function(t){return this._nodes=this.map(function(e){return e.closest(t)}),this},Imba.Selector.prototype.siblings=function(t){return this._nodes=this.map(function(e){return e.siblings(t)}),this},Imba.Selector.prototype.find=function(t){return this._nodes=this.__query__(t.query(),this.nodes()),this},Imba.Selector.prototype.children=function(t){return!0},Imba.Selector.prototype.has=function(){return!0},Imba.Selector.prototype.__union=function(){return this.p("called Imba.Selector.__union"),this},Imba.Selector.prototype.__intersect=function(){return this.p("called Imba.Selector.__union"),this},Imba.Selector.prototype.reject=function(t){return this.filter(t,!1)},Imba.Selector.prototype.filter=function(t,e){void 0===e&&(e=!0);var r=t instanceof Function&&t||function(e){return e.matches(t)},o=this.nodes().filter(function(t){return r(t)==e});return new Imba.Selector("",this._scope,o)},Imba.Selector.prototype.__query__=function(t,e){for(var r=[],o=0,n=e.length;n>o;)r.push.apply(r,e[o++].querySelectorAll(t));return r},Imba.Selector.prototype.__matches__=function(){return!0},Imba.Selector.prototype.flag=function(t){return this.forEach(function(e){return e.flag(t)})},Imba.Selector.prototype.unflag=function(t){return this.forEach(function(e){return e.unflag(t)})},Imba.Selector.prototype.call=function(t,e){var r=this;return void 0===e&&(e=[]),r.forEach(function(o){var n;return r.setFn(o[n=t]),o[n]?r.fn().apply(o,e):void 0})},q$=function(t,e){return new Imba.Selector(t,e)},q$$=function(t,e){var r=(e||Imba.document()).querySelector(t);return r&&tag$wrap(r)||null},Imba.extendTag("element",function(t){t.prototype.querySelectorAll=function(t){return this._dom.querySelectorAll(t)},t.prototype.querySelector=function(t){return this._dom.querySelector(t)},t.prototype.find=function(t){return new Imba.Selector(t,this)}})}(); - - },{}]},{},[1])(1) }); \ No newline at end of file diff --git a/lib/imba/dom.js b/lib/imba/dom.js index ae0e90506..3ee356bf1 100644 --- a/lib/imba/dom.js +++ b/lib/imba/dom.js @@ -87,11 +87,6 @@ return this.dom().getAttribute(key); }; - ElementTag.prototype.object = function (v){ - if (arguments.length) { return ((this.setObject(v),v),this) }; - return this._object; - }; - ElementTag.prototype.setContent = function (content){ this.setChildren(content); // override? return this; @@ -499,7 +494,6 @@ ElementTag.prototype.initialize = ElementTag; - function HTMLElementTag(){ ElementTag.apply(this,arguments) }; subclass$(HTMLElementTag,ElementTag); diff --git a/lib/imba/dom.static.js b/lib/imba/dom.static.js index 861296326..242e4fda6 100644 --- a/lib/imba/dom.static.js +++ b/lib/imba/dom.static.js @@ -249,7 +249,6 @@ Imba.extendTag('htmlelement', function(tag){ - tag.prototype.setChildren = function (nodes){ if (nodes && nodes.static) { this.setStaticChildren(nodes); diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 000000000..a0c5f1f5d Binary files /dev/null and b/screenshot.png differ diff --git a/src/imba/dom.imba b/src/imba/dom.imba index cac6fe89e..c04d16b97 100644 --- a/src/imba/dom.imba +++ b/src/imba/dom.imba @@ -56,10 +56,6 @@ class ElementTag def getAttribute key return dom.getAttribute(key) - def object v - return (object = v,self) if arguments:length - @object - def content= content children = content # override? self @@ -374,7 +370,6 @@ class ElementTag ElementTag:prototype:initialize = ElementTag - class HTMLElementTag < ElementTag class SVGElementTag < ElementTag diff --git a/src/imba/dom.static.imba b/src/imba/dom.static.imba index f962b8c46..61429ed0f 100644 --- a/src/imba/dom.static.imba +++ b/src/imba/dom.static.imba @@ -216,7 +216,6 @@ def reconcileNested root, new, old, caret, container, ci extend tag htmlelement - def setChildren nodes if nodes and nodes:static setStaticChildren(nodes)