funcunit
Version:
<!-- @hide title
34 lines • 18 kB
JavaScript
/*can-simple-dom@0.3.0#simple-dom/document/node*/
define("can-simple-dom@0.3.0#simple-dom/document/node",[],function(){"use strict";function i(i,t,e,l){this.nodeType=i,this.nodeName=t,this.nodeValue=e,this.ownerDocument=l,this.childNodes=new n(this),this.parentNode=null,this.previousSibling=null,this.nextSibling=null,this.firstChild=null,this.lastChild=null}function t(i,t,n,e){if(i.firstChild){var l=i.firstChild,o=l,r=l;for(l.previousSibling=n,n?n.nextSibling=l:t.firstChild=l;r;)r.parentNode=t,o=r,r=r.nextSibling;o.nextSibling=e,e?e.previousSibling=o:t.lastChild=o,i.firstChild=null,i.lastChild=null}}function n(i){this.node=i}i.prototype._cloneNode=function(){return new i(this.nodeType,this.nodeName,this.nodeValue,this.ownerDocument)},i.prototype.cloneNode=function(i){var t=this._cloneNode();if(i)for(var n=this.firstChild,e=n;e;)e=n.nextSibling,t.appendChild(n.cloneNode(!0)),n=e;return t},i.prototype.appendChild=function(n){if(n.nodeType===i.DOCUMENT_FRAGMENT_NODE)return t(n,this,this.lastChild,null),n;n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this;var e=this.lastChild;return null===e?(this.firstChild=n,this.lastChild=n):(n.previousSibling=e,e.nextSibling=n,this.lastChild=n),n};var e=i.prototype.insertBefore=function(n,e){if(null==e)return this.appendChild(n);if(n.nodeType===i.DOCUMENT_FRAGMENT_NODE)return t(n,this,e?e.previousSibling:null,e),n;n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this;var l=e.previousSibling;return l&&(l.nextSibling=n,n.previousSibling=l),e.previousSibling=n,n.nextSibling=e,this.firstChild===e&&(this.firstChild=n),n},l=i.prototype.removeChild=function(i){this.firstChild===i&&(this.firstChild=i.nextSibling),this.lastChild===i&&(this.lastChild=i.previousSibling),i.previousSibling&&(i.previousSibling.nextSibling=i.nextSibling),i.nextSibling&&(i.nextSibling.previousSibling=i.previousSibling),i.parentNode=null,i.nextSibling=null,i.previousSibling=null};i.prototype.replaceChild=function(i,t){return e.call(this,i,t),l.call(this,t),t},i.prototype.addEventListener=function(){},i.prototype.removeEventListner=function(){},i.ELEMENT_NODE=1,i.ATTRIBUTE_NODE=2,i.TEXT_NODE=3,i.CDATA_SECTION_NODE=4,i.ENTITY_REFERENCE_NODE=5,i.ENTITY_NODE=6,i.PROCESSING_INSTRUCTION_NODE=7,i.COMMENT_NODE=8,i.DOCUMENT_NODE=9,i.DOCUMENT_TYPE_NODE=10,i.DOCUMENT_FRAGMENT_NODE=11,i.NOTATION_NODE=12,n.prototype.item=function(i){for(var t=this.node.firstChild,n=0;t&&i!==n;n++)t=t.nextSibling;return t};var o=i;return{get default(){return o},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/document/element*/
define("can-simple-dom@0.3.0#simple-dom/document/element",["./node"],function(t){"use strict";function e(t,e){t=t.toUpperCase(),this.nodeConstructor(1,t,null,e),this.style=new r(this),this.attributes=[],this.tagName=t}function r(t){this.__node=t}t&&t.__esModule||(t={"default":t});var n=t["default"],i={"class":function(t,e){t._className=e}};e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.nodeConstructor=n,e.prototype._cloneNode=function(){var t=this.ownerDocument.createElement(this.tagName);return t.attributes=this.attributes.map(function(t){return{name:t.name,value:t.value,specified:t.specified}}),t},e.prototype.getAttribute=function(t){for(var e,r=this.attributes,n=t.toLowerCase(),i=0,o=r.length;o>i;i++)if(e=r[i],e.name===n)return e.value;return null},e.prototype.setAttribute=function(){return this._setAttribute.apply(this,arguments)},e.prototype._setAttribute=function(t,e){for(var r,n=this.attributes,o=t.toLowerCase(),s=0,u=n.length;u>s;s++)if(r=n[s],r.name===o)return void(r.value=e);n.push({name:o,value:e,specified:!0}),n[o]=e;var a=i[o];a&&a(this,e)},e.prototype.removeAttribute=function(t){for(var e=this.attributes,r=0,n=e.length;n>r;r++){var i=e[r];if(i.name===t)return e.splice(r,1),void delete e[t]}},e.prototype.getElementsByTagName=function(t){t=t.toUpperCase();for(var e=[],r=this.firstChild;r;)r.nodeType===n.ELEMENT_NODE&&((r.nodeName===t||"*"===t)&&e.push(r),e.push.apply(e,r.getElementsByTagName(t))),r=r.nextSibling;return e},e.prototype.contains=function(t){for(t=t.parentNode;t;){if(t===this)return!0;t=t.parentNode}return!1},e.prototype.getElementById=function(t){for(var e,r=this.firstChild;r;){if(r.attributes&&r.attributes.length)for(var n=void 0,i=0,o=r.attributes.length;o>i;i++)if(n=r.attributes[i],"id"===n.name&&n.value===t)return r;if(r.getElementById&&(e=r.getElementById(t)))return e;r=r.nextSibling}},Object.defineProperty&&(Object.defineProperty(e.prototype,"className",{get:function(){return this._className},set:function(t){this._setAttribute("class",t),this._className=t}}),Object.defineProperty(r.prototype,"cssText",{get:function(){return this.__node.getAttribute("style")||""},set:function(t){this.__node._setAttribute("style",t)}}),Object.defineProperty(e.prototype,"innerHTML",{get:function(){for(var t="",e=this.firstChild;e;)t+=this.ownerDocument.__serializer.serialize(e),e=e.nextSibling;return t},set:function(t){this.lastChild=this.firstChild=null;var e;e="SCRIPT"===this.nodeName||"STYLE"===this.nodeName?this.ownerDocument.createTextNode(t):this.ownerDocument.__parser.parse(t),this.appendChild(e)}}),Object.defineProperty(e.prototype,"outerHTML",{get:function(){return this.ownerDocument.__serializer.serialize(this)},set:function(t){this.parentNode.replaceChild(this.ownerDocument.__parser.parse(t),this)}}));var o=e;return{get default(){return o},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/document/text*/
define("can-simple-dom@0.3.0#simple-dom/document/text",["./node"],function(t){"use strict";function e(t,e){this.nodeConstructor(3,"#text",t,e)}t&&t.__esModule||(t={"default":t});var o=t["default"];e.prototype._cloneNode=function(){return this.ownerDocument.createTextNode(this.nodeValue)},e.prototype=Object.create(o.prototype),e.prototype.constructor=e,e.prototype.nodeConstructor=o;var n=e;return{get default(){return n},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/document/comment*/
define("can-simple-dom@0.3.0#simple-dom/document/comment",["./node"],function(t){"use strict";function e(t,e){this.nodeConstructor(8,"#comment",t,e)}t&&t.__esModule||(t={"default":t});var o=t["default"];e.prototype._cloneNode=function(){return this.ownerDocument.createComment(this.nodeValue)},e.prototype=Object.create(o.prototype),e.prototype.constructor=e,e.prototype.nodeConstructor=o;var n=e;return{get default(){return n},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/document/document-fragment*/
define("can-simple-dom@0.3.0#simple-dom/document/document-fragment",["./node"],function(t){"use strict";function e(t){this.nodeConstructor(11,"#document-fragment",null,t)}t&&t.__esModule||(t={"default":t});var o=t["default"];e.prototype._cloneNode=function(){return this.ownerDocument.createDocumentFragment()},e.prototype=Object.create(o.prototype),e.prototype.constructor=e,e.prototype.nodeConstructor=o;var n=e;return{get default(){return n},__esModule:!0}});
/*micro-location@0.1.5#lib/micro-location*/
function Location(){this.init.apply(this,arguments)}Location.prototype={init:function(protocol,host,hostname,port,pathname,search,hash){if(this.protocol=protocol,this.host=host,this.hostname=hostname,this.port=port||"",this.pathname=pathname||"",this.search=search||"",this.hash=hash||"",protocol)with(this)this.href=protocol+"//"+host+pathname+search+hash;else if(host)with(this)this.href="//"+host+pathname+search+hash;else with(this)this.href=pathname+search+hash},params:function(t){if(!this._params){for(var e={},a=this.search.substring(1).split(/[;&]/),o=0,s=a.length;s>o;o++)if(a[o]){var h=a[o].split(/=/),i=decodeURIComponent(h[0].replace(/\+/g,"%20")),n=decodeURIComponent(h[1].replace(/\+/g,"%20"));e[i]||(e[i]=[]),e[i].push(n)}this._params=e}switch(typeof t){case"undefined":return this._params;case"object":return this.build(t)}return this._params[t]?this._params[t][0]:null},build:function(params){params||(params=this._params);var ret=new Location,_search=this.search;if(params){var search=[];for(var key in params)if(params.hasOwnProperty(key)){var val=params[key];switch(typeof val){case"object":for(var i=0,len=val.length;len>i;i++)search.push(encodeURIComponent(key)+"="+encodeURIComponent(val[i]));break;default:search.push(encodeURIComponent(key)+"="+encodeURIComponent(val))}}_search="?"+search.join("&")}with(this)ret.init.apply(ret,[protocol,host,hostname,port,pathname,_search,hash]);return ret}},Location.regexp=new RegExp("^(?:(https?:)//(([^:/]+)(:[^/]+)?))?([^#?]*)(\\?[^#]*)?(#.*)?$"),Location.parse=function(t){var e=String(t).match(this.regexp),a=new Location;return a.init.apply(a,e.slice(1)),a},function(t,e){"object"==typeof module&&module.exports?module.exports={Location:e()}:"function"==typeof define&&define.amd?define("micro-location@0.1.5#lib/micro-location",[],function(){return{Location:e()}}):t.Location=e()}(this,function(){return Location});
/*can-simple-dom@0.3.0#simple-dom/extend*/
define("can-simple-dom@0.3.0#simple-dom/extend",[],function(){"use strict";var e=function(e,n){for(var t in n)e[t]=n[t];return e};return{get default(){return e},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/document/anchor-element*/
define("can-simple-dom@0.3.0#simple-dom/document/anchor-element",["./element","micro-location","../extend"],function(t,e,o){"use strict";function r(t,e){this.elementConstructor(t,e),s(this,c.parse(""))}t&&t.__esModule||(t={"default":t}),e&&e.__esModule||(e={"default":e}),o&&o.__esModule||(o={"default":o});var n=t["default"],u=e["default"],s=o["default"],c=u.Location||u;r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.prototype.elementConstructor=n,r.prototype.setAttribute=function(t,e){n.prototype.setAttribute.apply(this,arguments),"href"===t.toLowerCase()&&s(this,c.parse(e))};var a=r;return{get default(){return a},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/document*/
define("can-simple-dom@0.3.0#simple-dom/document",["./document/node","./document/element","./document/text","./document/comment","./document/document-fragment","./document/anchor-element"],function(e,t,n,o,r,d){"use strict";function a(){this.nodeConstructor(9,"#document",null,this),this.documentElement=new i("html",this),this.body=new i("body",this),this.documentElement.appendChild(this.body),this.appendChild(this.documentElement);var e=this;this.implementation={createHTMLDocument:function(t){var n=new a,o=e.__parser.parse(t),r=i.prototype.getElementsByTagName.call(o,"body")[0],d=i.prototype.getElementsByTagName.call(o,"head")[0];return r||d?(r&&n.documentElement.replaceChild(r,n.body),d&&n.documentElement.replaceChild(d,n.head),n.documentElement.appendChild(o)):n.body.appendChild(o),n.__addSerializerAndParser(e.__serializer,e.__parser),n}}}e&&e.__esModule||(e={"default":e}),t&&t.__esModule||(t={"default":t}),n&&n.__esModule||(n={"default":n}),o&&o.__esModule||(o={"default":o}),r&&r.__esModule||(r={"default":r}),d&&d.__esModule||(d={"default":d});var u=e["default"],i=t["default"],l=n["default"],p=o["default"],c=r["default"],s=d["default"];a.prototype=Object.create(u.prototype),a.prototype.constructor=a,a.prototype.nodeConstructor=u;var m={a:s};a.prototype.createElement=function(e){var t=m[e.toLowerCase()];return t?new t(e,this):new i(e,this)},a.prototype.createTextNode=function(e){return new l(e,this)},a.prototype.createComment=function(e){return new p(e,this)},a.prototype.createDocumentFragment=function(){return new c(this)},a.prototype.getElementsByTagName=function(e){e=e.toUpperCase();for(var t=[],n=this.firstChild;n;)n.nodeType===u.ELEMENT_NODE&&((n.nodeName===e||"*"===e)&&t.push(n),t.push.apply(t,n.getElementsByTagName(e))),n=n.nextSibling;return t},a.prototype.getElementById=function(e){return i.prototype.getElementById.apply(this.documentElement,arguments)},a.prototype.__addSerializerAndParser=function(e,t){this.__parser=t,this.__serializer=e},Object.defineProperty&&Object.defineProperty(a.prototype,"currentScript",{get:function(){var e=this.getElementsByTagName("script"),t=e[e.length-1];return t||(t=this.createElement("script")),t}});var h=a;return{get default(){return h},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/html-parser*/
define("can-simple-dom@0.3.0#simple-dom/html-parser",[],function(){"use strict";function t(t,e,n){this.tokenize=t,this.document=e,this.voidMap=n,this.parentStack=[]}t.prototype.isVoid=function(t){return this.voidMap[t.nodeName]===!0},t.prototype.pushElement=function(t){for(var e=this.document.createElement(t.tagName),n=0;n<t.attributes.length;n++){var a=t.attributes[n];e.setAttribute(a[0],a[1])}return this.isVoid(e)||t.selfClosing?this.appendChild(e):void this.parentStack.push(e)},t.prototype.popElement=function(t){var e=this.parentStack.pop();if(e.nodeName!==t.tagName.toUpperCase())throw new Error("unbalanced tag");this.appendChild(e)},t.prototype.appendText=function(t){var e=this.document.createTextNode(t.chars);this.appendChild(e)},t.prototype.appendComment=function(t){var e=this.document.createComment(t.chars);this.appendChild(e)},t.prototype.appendChild=function(t){var e=this.parentStack[this.parentStack.length-1];e.appendChild(t)},t.prototype.parse=function(t){var e=this.document.createDocumentFragment();this.parentStack.push(e);for(var n=this.tokenize(t),a=0,p=n.length;p>a;a++){var i=n[a];switch(i.type){case"StartTag":this.pushElement(i);break;case"EndTag":this.popElement(i);break;case"Chars":this.appendText(i);break;case"Comment":this.appendComment(i)}}return this.parentStack.pop()};var e=t;return{get default(){return e},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/html-serializer*/
define("can-simple-dom@0.3.0#simple-dom/html-serializer",[],function(){"use strict";function e(e){this.voidMap=e}e.prototype.openTag=function(e){return"<"+e.nodeName.toLowerCase()+this.attributes(e.attributes)+">"},e.prototype.closeTag=function(e){return"</"+e.nodeName.toLowerCase()+">"},e.prototype.isVoid=function(e){return this.voidMap[e.nodeName]===!0},e.prototype.attributes=function(e){for(var t="",n=0,o=e.length;o>n;n++)t+=this.attr(e[n]);return t},e.prototype.escapeAttrValue=function(e){return e.replace(/[&"]/g,function(e){switch(e){case"&":return"&";case'"':return"""}})},e.prototype.attr=function(e){return e.specified?e.value?" "+e.name+'="'+this.escapeAttrValue(e.value)+'"':" "+e.name:""},e.prototype.escapeText=function(e){return e.replace(/[&<>]/g,function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">"}})},e.prototype.text=function(e){var t=e.parentNode;return!t||"STYLE"!==t.nodeName&&"SCRIPT"!==t.nodeName?this.escapeText(e.nodeValue):e.nodeValue},e.prototype.comment=function(e){return"<!--"+e.nodeValue+"-->"},e.prototype.serialize=function(e){var t,n="";switch(e.nodeType){case 1:n+=this.openTag(e);break;case 3:n+=this.text(e);break;case 8:n+=this.comment(e)}if(t=e.firstChild)for(;t;)n+=this.serialize(t),t=t.nextSibling;else 1===e.nodeType&&e.textContent&&(n+=e.textContent);return 1!==e.nodeType||this.isVoid(e)||(n+=this.closeTag(e)),n};var t=e;return{get default(){return t},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/void-map*/
define("can-simple-dom@0.3.0#simple-dom/void-map",[],function(){"use strict";var e={AREA:!0,BASE:!0,BR:!0,COL:!0,COMMAND:!0,EMBED:!0,HR:!0,IMG:!0,INPUT:!0,KEYGEN:!0,LINK:!0,META:!0,PARAM:!0,SOURCE:!0,TRACK:!0,WBR:!0};return{get default(){return e},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom/dom*/
define("can-simple-dom@0.3.0#simple-dom/dom",["./document/node","./document/element","./document","./html-parser","./html-serializer","./void-map"],function(e,t,u,n,o,r){"use strict";function c(e,t){var u=new f;return u.__serializer=e,u.__parser=t,u}e&&e.__esModule||(e={"default":e}),t&&t.__esModule||(t={"default":t}),u&&u.__esModule||(u={"default":u}),n&&n.__esModule||(n={"default":n}),o&&o.__esModule||(o={"default":o}),r&&r.__esModule||(r={"default":r});var d=e["default"],l=t["default"],f=u["default"],a=n["default"],i=o["default"],_=r["default"];return{get Node(){return d},get Element(){return l},get Document(){return f},get HTMLParser(){return a},get HTMLSerializer(){return i},get voidMap(){return _},get createDocument(){return c},__esModule:!0}});
/*can-simple-dom@0.3.0#simple-dom*/
define("can-simple-dom@0.3.0#simple-dom",["./simple-dom/dom","./simple-dom/dom"],function(e,d){"use strict";e&&e.__esModule||(e={"default":e}),d&&d.__esModule||(d={"default":d});var o=e;"undefined"!=typeof window&&(window.SimpleDOM=o);var i=d;return $traceurRuntime.exportStar({__esModule:!0},i)});
/*can@2.3.27#util/vdom/build_fragment/make_parser*/
define("can@2.3.27#util/vdom/build_fragment/make_parser",["can/view/parser/parser","can-simple-dom/can-simple-dom"],function(t,n){return function(a){return new n.HTMLParser(function(n){var a,e,r=[];return t(n,{start:function(t,n){a={type:"StartTag",attributes:[],tagName:t}},end:function(t,n){r.push(a),a=void 0},close:function(t){r.push({type:"EndTag",tagName:t})},attrStart:function(t){e=[t,""],a.attributes.push(e)},attrEnd:function(t){},attrValue:function(t){e[1]+=t},chars:function(t){r.push({type:"Chars",chars:t})},comment:function(t){r.push({type:"Comment",chars:t})},special:function(t){},done:function(){}}),r},a,n.voidMap)}});
/*can@2.3.27#util/vdom/document/document*/
define("can@2.3.27#util/vdom/document/document",["can/util/can","can-simple-dom/can-simple-dom","../build_fragment/make_parser"],function(e,n,t){function r(){n.Document.apply(this,arguments);var e=new n.HTMLSerializer(n.voidMap),r=t(this);this.__addSerializerAndParser(e,r)}r.prototype=new n.Document,r.prototype.constructor=r;var a=new r;return e.simpleDocument=a,a});
/*can@2.3.27#util/vdom/vdom*/
define("can@2.3.27#util/vdom/vdom",["can/util/can","./document/document"],function(n,e){var t=n.global;t.document=e,t.window=t,t.addEventListener=function(){},t.removeEventListener=function(){},t.navigator={userAgent:"",platform:"",language:"",languages:[],plugins:[],onLine:!0},t.location={href:"",protocol:"",host:"",hostname:"",port:"",pathname:"",search:"",hash:""},t.history={pushState:n.k,replaceState:n.k}});