-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmarkout-min.js
More file actions
7 lines (7 loc) · 2.63 KB
/
markout-min.js
File metadata and controls
7 lines (7 loc) · 2.63 KB
1
2
3
4
5
6
7
/*!
* MarkoutJS - An API for creating DOM nodes in JavaScript
*
* Oddnut Software - http://oddnut.com/markout/
* Copyright (c) 2009-2011 Eric Ferraiuolo and David Fogel
*/
(function(p,m){var s,j="object",l="string",i="[object Array]",f=" ",r="for",c="htmlFor",b="class",a="className",e={},q=m.createElement("div"),o=Object.prototype.toString,n=Array.prototype.slice,d=function(u,t){return u&&u.hasOwnProperty&&u.hasOwnProperty(t);},g=function(t){return(t&&typeof t===j);},k=function(t){return typeof t===l;},h=function(t){return o.call(t)===i;};s=function(){var t=this;if(!(t&&t.hasOwnProperty&&(t instanceof s))){t=new s();}t._init.apply(t,arguments);return t;};s.prototype={constructor:s,_init:function(t){if(t&&(t.nodeType===1||t.nodeType===11)){this._node=t;}else{this._node=m.createDocumentFragment();}},toHTML:function(){var t;if(q.outerHTML){return this._node.outerHTML;}else{t=m.createDocumentFragment();t.appendChild(this._node.cloneNode(true));return t.innerHTML;}},node:function(){return this._node;},getDOMNode:function(){return this._node;},html:function(t){if(k(t)){this._node.innerHTML=t;return this;}return this._node.innerHTML;},el:function(){var u=n.call(arguments,0),v=u[0],t=u[1]&&g(u[1])?u[1]:null,w=!t&&u[1]&&k(u[1])?u[1]:u[2],x;if(!v){return this;}if(k(v)){v=m.createElement(v);}if(!(v&&v.nodeType===1)){return this;}x=new this.constructor(v);if(t){x.attrs(t);}if(w){x.text(w);}this._node.appendChild(x._node);return x;},attrs:function(u){u=u||{};var w=s.CUSTOM_ATTRS,v=this._node,t;if(!v){return;}for(t in u){t=w[t]||t;if(d(u,t)){v.setAttribute(t,u[t]);}}},text:function(){var t=n.call(arguments,0),v=(h(t[0])?t[0]:t).join(""),u=v?m.createTextNode(v):null;if(u){this._node.appendChild(u);}return u;},space:function(){return this.text(f);}};if(!m.documentElement.hasAttribute){e[r]=c;e[b]=a;}else{e[c]=r;e[a]=b;}s.CUSTOM_ATTRS=e;s.addElMethod=function(t){s.prototype[t]=function(){var u=n.call(arguments,0);u.unshift(t);return this.el.apply(this,u);};};(function(){var w=s.addElMethod,u,v,t;u=("a abbr acronym address area article aside audio b base bdi bdo big blockquote body br button canvas caption cite code col colgroup command datalist dd del details device dfn div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr i iframe img input ins kbd keygen label legend li link map mark menu meta meter nav noscript object ol optgroup option 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 thread time title tr track tt ul var video wbr").split(f);for(v=0,t=u.length;v<t;v++){w(u[v]);}}());p.Markout=s;}(window,window.document));