Stephen McKamey avatar Stephen McKamey committed 4c36564

improving how events are bound; adding support for any arbitrary DOM events

Comments (0)

Files changed (3)

duel-js/src/main/javascript/dom.js

 	};
 
 	/**
-	 * Event names map
-	 * 
-	 * @private
-	 * @constant
-	 * @type {Object.<boolean>}
-	 */
-	var EVTS = {
-		"onblur" : true,
-		"onchange" : true,
-		"onclick" : true,
-		"ondblclick" : true,
-		"onerror" : true,
-		"onfocus" : true,
-		"onkeydown" : true,
-		"onkeypress" : true,
-		"onkeyup" : true,
-		"onload" : true,
-		"onmousedown" : true,
-		"onmouseenter" : true,
-		"onmouseleave" : true,
-		"onmousemove" : true,
-		"onmouseout" : true,
-		"onmouseover" : true,
-		"onmouseup" : true,
-		"onresize" : true,
-		"onscroll" : true,
-		"onselect" : true,
-		"onsubmit" : true,
-		"onunload" : true
-		// can add more events here as needed
-	};
-
-	/**
 	 * Leading SGML line ending pattern
 	 * 
 	 * @private
 	 * @param {function(Event)} handler The event handler
 	 */
 	function addHandler(elem, name, handler) {
-		if (isString(handler)) {
+		if (isFunction(handler)) {
+			if (elem.addEventListener) {
+				// DOM Level 2
+				elem.addEventListener((name.substr(0,2) === 'on') ? name.substr(2) : name, handler, false);
+			} else {
+				// DOM Level 0
+				elem[name] = handler;
+			}
+		}
+
+		else if (isString(handler)) {
+			// inline functions are DOM Level 0
 			/*jslint evil:true */
-			handler = new Function("event", handler);
+			elem[name] = new Function("event", handler);
 			/*jslint evil:false */
 		}
-	
-		if (isFunction(handler)) {
-			elem[name] = handler;
-		}
 	}
 
 	/**
 					} else if (name === "class") {
 						elem.className = value;
 
-					} else if (EVTS[name]) {
+					} else if (name.substr(0,2) === 'on') {
 						addHandler(elem, name, value);
 
 						// also set duplicated events

duel-js/target/duel.js

 	 * Formats the value as a string
 	 * 
 	 * @private
-	 * @param {*} val the object being tested
+	 * @param {*} val the object being rendered
 	 * @return {string|null}
 	 */
 	function asString(val) {
 		var buffer, needsDelim;
 		switch (getType(val)) {
 			case VAL:
-				if (val instanceof Date) {
-					// YYYY-MM-DD HH:mm:ss Z
-					return val.getUTCFullYear()+'-'+
-						digits(val.getUTCMonth()+1)+'-'+
-						digits(val.getUTCDate())+' '+
-						digits(val.getUTCHours())+':'+
-						digits(val.getUTCMinutes())+':'+
-						digits(val.getUTCSeconds())+" Z";
-				}
 				return ""+val;
 			case NUL:
 				return "";
 	};
 
 	/**
-	 * Event names map
-	 * 
-	 * @private
-	 * @constant
-	 * @type {Object.<boolean>}
-	 */
-	var EVTS = {
-		"onblur" : true,
-		"onchange" : true,
-		"onclick" : true,
-		"ondblclick" : true,
-		"onerror" : true,
-		"onfocus" : true,
-		"onkeydown" : true,
-		"onkeypress" : true,
-		"onkeyup" : true,
-		"onload" : true,
-		"onmousedown" : true,
-		"onmouseenter" : true,
-		"onmouseleave" : true,
-		"onmousemove" : true,
-		"onmouseout" : true,
-		"onmouseover" : true,
-		"onmouseup" : true,
-		"onresize" : true,
-		"onscroll" : true,
-		"onselect" : true,
-		"onsubmit" : true,
-		"onunload" : true
-		// can add more events here as needed
-	};
-
-	/**
 	 * Leading SGML line ending pattern
 	 * 
 	 * @private
 	 * @param {function(Event)} handler The event handler
 	 */
 	function addHandler(elem, name, handler) {
-		if (isString(handler)) {
+		if (isFunction(handler)) {
+			if (elem.addEventListener) {
+				// DOM Level 2
+				elem.addEventListener((name.substr(0,2) === 'on') ? name.substr(2) : name, handler);
+			} else {
+				// DOM Level 0
+				elem[name] = handler;
+			}
+		}
+
+		else if (isString(handler)) {
+			// inline functions are DOM Level 0
 			/*jslint evil:true */
-			handler = new Function("event", handler);
+			elem[name] = new Function("event", handler);
 			/*jslint evil:false */
 		}
-	
-		if (isFunction(handler)) {
-			elem[name] = handler;
-		}
 	}
 
 	/**
 					} else if (name === "class") {
 						elem.className = value;
 
-					} else if (EVTS[name]) {
+					} else if (name.substr(0,2) === 'on') {
 						addHandler(elem, name, value);
 
 						// also set duplicated events

duel-js/target/duel.min.js

-var duel=function(x){function y(a){this.value=a}function j(a){switch(typeof a){case "object":return!a?0:z(a)?2:a instanceof y?5:a instanceof Date?4:3;case "function":return 1;case "undefined":return 0;default:return 4}}function p(a){return typeof a==="function"}function n(){this.value=n.FAST?"":[]}function v(a){return a<10?"0"+a:a}function A(a){var b,c;switch(j(a)){case 4:if(a instanceof Date)return a.getUTCFullYear()+"-"+v(a.getUTCMonth()+1)+"-"+v(a.getUTCDate())+" "+v(a.getUTCHours())+":"+v(a.getUTCMinutes())+
-":"+v(a.getUTCSeconds())+" Z";return""+a;case 0:return"";case 2:b=new n;for(var e=0,d=a.length;e<d;e++)c?b.append(", "):c=!0,b.append(A(a[e]));return b.toString();case 3:b=new n;b.append("{");for(e in a)a.hasOwnProperty(e)&&(c?b.append(", "):c=!0,b.append(e,"=",A(a[e])));b.append("}");return b.toString()}return a}function q(a){z(a)||(a=["",a]);this.value=a}function s(a,b){switch(j(b)){case 2:if(b[0]==="")for(var c=1,e=b.length;c<e;c++)s(a,b[c]);else a.push(b);break;case 3:c=a[1];if(j(c)===3)for(e in b)b.hasOwnProperty(e)&&
-(c[e]=b[e]);else a.splice(1,0,b);break;case 4:c=a.length-1;c>0&&j(a[c])===4?a[c]=""+a[c]+b:b!==""&&a.push(""+b);break;case 0:break;default:a.push(b)}}function t(a,b,c,e,d,f){var h=j(a[1])===3;if(a.length===(h?3:2))return l(a[a.length-1],b,c,e,d,f);for(var g=[""],h=h?2:1,i=a.length;h<i;h++)s(g,l(a[h],b,c,e,d,f));return g}function D(a,b,c,e,d,f){for(var h=1,g=a.length;h<g;h++){var i=a[h],k=i[1].test;if(j(i[1])===3&&k&&(p(k)&&(k=k(b,c,e,d)),!k))continue;return t(i,b,c,e,d,f)}return null}function M(a){j(a)!==
-2&&(a=["",a]);var b=function(b){try{var e=l(a,b,0,1,null);return new q(e)}catch(d){return new q("["+d+"]")}};b.getView=function(){return a};return b}function N(a){if(typeof a!=="string")return a;return a.replace(/[&<>]/g,function(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";default:return a}})}function O(a){if(typeof a!=="string")return a;return a.replace(/[&<>"]/g,function(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";
-default:return a}})}function E(a,b){var c=b[0]||"",e=b.length,d=1,f,h=P[c];if(c.charAt(0)==="!")b[0]==="!DOCTYPE"?a.append("<!DOCTYPE ",b[1],">"):a.append("<\!--",b[1],"--\>");else{if(c){a.append("<",c);f=b[d];if(j(f)===3){for(var g in f)if(f.hasOwnProperty(g)){a.append(" ",g);var i=f[g];j(i)!==0&&a.append('="',O(i),'"')}d++}h&&a.append(" /");a.append(">")}for(;d<e;d++)f=b[d],z(f)?E(a,f):a.append(N(f));c&&!h&&a.append("</",c,">")}}function F(a){try{var b=new n;E(b,a);return b.toString()}catch(c){return"["+
-c+"]"}}function r(a){if(a){if(a.charAt(0)==="!")return m.createComment(a==="!"?"":a.substr(1)+" ")}else{if(m.createDocumentFragment)return m.createDocumentFragment();a=""}if(a.toLowerCase()==="style"&&m.createStyleSheet)return m.createStyleSheet();return m.createElement(a)}function w(a,b){if(b){var c=(a.tagName||"").toLowerCase();if(a.nodeType===8)b.nodeType===3&&(a.nodeValue+=b.nodeValue);else if(c==="table"&&a.tBodies)if(b.tagName)if((c=b.tagName.toLowerCase())&&c!=="tbody"&&c!=="thead"){var e=
-a.tBodies.length>0?a.tBodies[a.tBodies.length-1]:null;e||(e=r(c==="th"?"thead":"tbody"),a.appendChild(e));e.appendChild(b)}else a.canHaveChildren!==!1&&a.appendChild(b);else{if(b.nodeType===11)for(;b.firstChild;)w(a,b.removeChild(b.firstChild))}else if(c==="style"&&m.createStyleSheet)a.cssText=b;else if(a.canHaveChildren!==!1)a.appendChild(b);else if(c==="object"&&b.tagName&&b.tagName.toLowerCase()==="param"){try{a.appendChild(b)}catch(d){}try{if(a.object)a.object[b.name]=b.value}catch(f){}}}}function G(a,
-b,c){typeof c==="string"&&(c=new Function("event",c));p(c)&&(a[b]=c)}function H(a,b){if(b.name&&m.attachEvent&&!a.parentNode)try{var c=r("<"+a.tagName+" name='"+b.name+"'>");a.tagName===c.tagName&&(a=c)}catch(e){}for(var d in b)if(b.hasOwnProperty(d)){var c=b[d],f=j(c);if(d)f===0&&(c="",f=4),d=Q[d.toLowerCase()]||d,d==="style"?typeof a.style.cssText!=="undefined"?a.style.cssText=c:a.style=c:d==="class"?a.className=c:R[d]?(G(a,d,c),u[d]&&G(a,u[d],c)):f===4?(a.setAttribute(d,c),u[d]&&a.setAttribute(u[d],
-c)):(a[d]=c,u[d]&&(a[u[d]]=c))}return a}function I(a){return!!a&&a.nodeType===3&&(!a.nodeValue||!/\S/.exec(a.nodeValue))}function J(a,b){if(a&&a.nodeType===3&&b.exec(a.nodeValue))a.nodeValue=a.nodeValue.replace(b,"")}function B(a){if(a){for(;I(a.firstChild);)a.removeChild(a.firstChild);for(J(a.firstChild,S);I(a.lastChild);)a.removeChild(a.lastChild);J(a.lastChild,T)}}function K(a,b){var c=a[b];if(c){try{delete a[b]}catch(e){a[b]=void 0}if(!p(c))try{c=new Function(""+c)}catch(d){c=null}}return c}function L(a){if(a){var b=
-K(a,"$init");b&&b.call(a);(b=K(a,"$load"))?setTimeout(function(){b.call(a);b=a=null},0):b=a=null}}function C(a,b){for(var c=1,e=b.length;c<e;c++){var d=b[c];switch(j(d)){case 2:var f=d[0],d=C(r(f),d);if(f==="html")return B(d),L(d),d;w(a,d);break;case 4:d!==""&&w(a,m.createTextNode(""+d));break;case 3:a.nodeType===1&&(a=H(a,d));break;case 5:var f=w,h=a;var g=d,d=r("div");d.innerHTML=""+g;B(d);if(d.childNodes.length===1)d=d.firstChild;else{for(g=r("");d.firstChild;)g.appendChild(d.firstChild);d=g}f(h,
-d)}}B(a);L(a);if(a.nodeType===11&&a.childNodes.length===1)a=a.firstChild;return a}var m=x.document;y.prototype.toString=function(){return this.value};var z=Array.isArray||function(a){return a instanceof Array};n.FAST=!x.ScriptEngineMajorVersion;n.prototype.append=function(a,b,c){n.FAST?(this.value+=a,b!==null&&b!==void 0&&(this.value+=b,c!==null&&c!==void 0&&(this.value+=c))):this.value.push.apply(this.value,arguments)};n.prototype.clear=function(){this.value=n.FAST?"":[]};n.prototype.toString=function(){return n.FAST?
-this.value:this.value.join("")};var l;l=function(a,b,c,e,d,f){switch(j(a)){case 1:return A(a(b,c,e,d));case 2:var h=a[0]||"";switch(h){case "$for":a:{var g=a[1]||{},h=[""],i;if(g.hasOwnProperty("count")){i=g.count;p(i)&&(i=i(b,c,e,d));g.hasOwnProperty("data")?(g=g.data,p(g)&&(g=g(b,c,e,d))):g=b;for(b=0;b<i;b++)s(h,t(a,g,b,i,null,f))}else{if(g.hasOwnProperty("in")){var k=g["in"];p(k)&&(k=k(b,c,e,d));if(j(k)===3){g=[];for(i in k)k.hasOwnProperty(i)&&g.push(i);b=0;for(i=g.length;b<i;b++)s(h,t(a,k[g[b]],
-b,i,g[b],f));a=h;break a}g=k}else g=g.each,p(g)&&(g=g(b,c,e,d));b=j(g);if(b===2){b=0;for(i=g.length;b<i;b++)s(h,t(a,g[b],b,i,null,f))}else b!==0&&(h=t(a,g,0,1,null,f))}a=h}return a;case "$xor":return D(a,b,c,e,d,f);case "$if":return D(["$xor",a],b,c,e,d,f);case "$call":f=a[1]||{};if(f.view){h=l(f.view,b,c,e,d);g=f.hasOwnProperty("data")?l(f.data,b,c,e,d):b;i=f.hasOwnProperty("index")?l(f.index,b,c,e,d):c;k=f.hasOwnProperty("count")?l(f.count,b,c,e,d):e;b=f.hasOwnProperty("key")?l(f.key,b,c,e,d):d;
-c={};for(e=a.length-1;e>=2;e--)d=a[e],f=d[1]||{},f.hasOwnProperty("name")&&(c[f.name]=d);a=h&&p(h.getView)?l(h.getView(),g,i,k,b,c):null}else a=null;return a;case "$part":return h=(a[1]||{}).name||"",h=f&&f.hasOwnProperty(h)?f[h]:a,t(h,b,c,e,d)}h=[h];g=1;for(i=a.length;g<i;g++)s(h,l(a[g],b,c,e,d,f));return h;case 3:f={};for(h in a)a.hasOwnProperty(h)&&(f[h]=l(a[h],b,c,e,d));return f}return a};var o=x.duel=function(a){return p(a)&&p(a.getView)?a:M(a)};o.raw=o.raw=function(a){return new y(a)};var P=
-{area:!0,base:!0,basefont:!0,br:!0,col:!0,frame:!0,hr:!0,img:!0,input:!0,isindex:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,wbr:!0};q.prototype.toString=function(){return F(this.value)};o.write=o.write=function(a,b,c,e,d){a=o(a).getView();a=l(a,b,c,e,d);m.write(F(a))};var Q={rowspan:"rowSpan",colspan:"colSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",tabindex:"tabIndex",accesskey:"accessKey",hidefocus:"hideFocus",usemap:"useMap",maxlength:"maxLength",readonly:"readOnly",contenteditable:"contentEditable"},
-u={enctype:"encoding",onscroll:"DOMMouseScroll"},R={onblur:!0,onchange:!0,onclick:!0,ondblclick:!0,onerror:!0,onfocus:!0,onkeydown:!0,onkeypress:!0,onkeyup:!0,onload:!0,onmousedown:!0,onmouseenter:!0,onmouseleave:!0,onmousemove:!0,onmouseout:!0,onmouseover:!0,onmouseup:!0,onresize:!0,onscroll:!0,onselect:!0,onsubmit:!0,onunload:!0},S=/^[\r\n]+/,T=/[\r\n]+$/;q.prototype.toDOM=q.prototype.toDOM=function(){try{return C(r(this.value[0]),this.value)}catch(a){return m.createTextNode("["+a+"]")}};q.prototype.reload=
-q.prototype.reload=function(){var a=m;try{var b=this.toDOM();a.replaceChild(b,a.documentElement);if(a.createStyleSheet){for(var c=b.firstChild;c&&(c.tagName||"")!=="HEAD";)c=c.nextSibling;for(var e=c&&c.firstChild;e;){if((e.tagName||"")==="LINK")e.href=e.href;e=e.nextSibling}}}catch(d){a=a.open("text/html"),a.write(this.toString()),a.close()}};o.attr=o.attr=function(a,b,c,e,d,f){j(a)===4&&(a=m.getElementById(a));a&&(b=l(b,c,e,d,f),H(a,b))};o.replace=o.replace=function(a,b,c,e,d,f){j(a)===4&&(a=m.getElementById(a));
-if(a&&a.parentNode){b=o(b).getView();b=l(b,c,e,d,f);try{b=C(r(b[0]),b)}catch(h){b=m.createTextNode("["+h+"]")}a.parentNode.replaceChild(b,a)}};return o}(window);
+var duel=function(w){function x(a){this.value=a}function j(a){switch(typeof a){case "object":return!a?0:y(a)?2:a instanceof x?5:a instanceof Date?4:3;case "function":return 1;case "undefined":return 0;default:return 4}}function p(a){return typeof a==="function"}function n(){this.value=n.FAST?"":[]}function z(a){var b,c;switch(j(a)){case 4:return""+a;case 0:return"";case 2:b=new n;for(var e=0,d=a.length;e<d;e++)c?b.append(", "):c=!0,b.append(z(a[e]));return b.toString();case 3:b=new n;b.append("{");
+for(e in a)a.hasOwnProperty(e)&&(c?b.append(", "):c=!0,b.append(e,"=",z(a[e])));b.append("}");return b.toString()}return a}function q(a){y(a)||(a=["",a]);this.value=a}function s(a,b){switch(j(b)){case 2:if(b[0]==="")for(var c=1,e=b.length;c<e;c++)s(a,b[c]);else a.push(b);break;case 3:c=a[1];if(j(c)===3)for(e in b)b.hasOwnProperty(e)&&(c[e]=b[e]);else a.splice(1,0,b);break;case 4:c=a.length-1;c>0&&j(a[c])===4?a[c]=""+a[c]+b:b!==""&&a.push(""+b);break;case 0:break;default:a.push(b)}}function t(a,b,
+c,e,d,f){var h=j(a[1])===3;if(a.length===(h?3:2))return l(a[a.length-1],b,c,e,d,f);for(var g=[""],h=h?2:1,i=a.length;h<i;h++)s(g,l(a[h],b,c,e,d,f));return g}function C(a,b,c,e,d,f){for(var h=1,g=a.length;h<g;h++){var i=a[h],k=i[1].test;if(j(i[1])===3&&k&&(p(k)&&(k=k(b,c,e,d)),!k))continue;return t(i,b,c,e,d,f)}return null}function L(a){j(a)!==2&&(a=["",a]);var b=function(b){try{var e=l(a,b,0,1,null);return new q(e)}catch(d){return new q("["+d+"]")}};b.getView=function(){return a};return b}function M(a){if(typeof a!==
+"string")return a;return a.replace(/[&<>]/g,function(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";default:return a}})}function N(a){if(typeof a!=="string")return a;return a.replace(/[&<>"]/g,function(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";default:return a}})}function D(a,b){var c=b[0]||"",e=b.length,d=1,f,h=O[c];if(c.charAt(0)==="!")b[0]==="!DOCTYPE"?a.append("<!DOCTYPE ",b[1],">"):a.append("<\!--",
+b[1],"--\>");else{if(c){a.append("<",c);f=b[d];if(j(f)===3){for(var g in f)if(f.hasOwnProperty(g)){a.append(" ",g);var i=f[g];j(i)!==0&&a.append('="',N(i),'"')}d++}h&&a.append(" /");a.append(">")}for(;d<e;d++)f=b[d],y(f)?D(a,f):a.append(M(f));c&&!h&&a.append("</",c,">")}}function E(a){try{var b=new n;D(b,a);return b.toString()}catch(c){return"["+c+"]"}}function r(a){if(a){if(a.charAt(0)==="!")return m.createComment(a==="!"?"":a.substr(1)+" ")}else{if(m.createDocumentFragment)return m.createDocumentFragment();
+a=""}if(a.toLowerCase()==="style"&&m.createStyleSheet)return m.createStyleSheet();return m.createElement(a)}function v(a,b){if(b){var c=(a.tagName||"").toLowerCase();if(a.nodeType===8)b.nodeType===3&&(a.nodeValue+=b.nodeValue);else if(c==="table"&&a.tBodies)if(b.tagName)if((c=b.tagName.toLowerCase())&&c!=="tbody"&&c!=="thead"){var e=a.tBodies.length>0?a.tBodies[a.tBodies.length-1]:null;e||(e=r(c==="th"?"thead":"tbody"),a.appendChild(e));e.appendChild(b)}else a.canHaveChildren!==!1&&a.appendChild(b);
+else{if(b.nodeType===11)for(;b.firstChild;)v(a,b.removeChild(b.firstChild))}else if(c==="style"&&m.createStyleSheet)a.cssText=b;else if(a.canHaveChildren!==!1)a.appendChild(b);else if(c==="object"&&b.tagName&&b.tagName.toLowerCase()==="param"){try{a.appendChild(b)}catch(d){}try{if(a.object)a.object[b.name]=b.value}catch(f){}}}}function F(a,b,c){p(c)?a.addEventListener?a.addEventListener(b.substr(0,2)==="on"?b.substr(2):b,c):a[b]=c:typeof c==="string"&&(a[b]=new Function("event",c))}function G(a,b){if(b.name&&
+m.attachEvent&&!a.parentNode)try{var c=r("<"+a.tagName+" name='"+b.name+"'>");a.tagName===c.tagName&&(a=c)}catch(e){}for(var d in b)if(b.hasOwnProperty(d)){var c=b[d],f=j(c);if(d)f===0&&(c="",f=4),d=P[d.toLowerCase()]||d,d==="style"?typeof a.style.cssText!=="undefined"?a.style.cssText=c:a.style=c:d==="class"?a.className=c:d.substr(0,2)==="on"?(F(a,d,c),u[d]&&F(a,u[d],c)):f===4?(a.setAttribute(d,c),u[d]&&a.setAttribute(u[d],c)):(a[d]=c,u[d]&&(a[u[d]]=c))}return a}function H(a){return!!a&&a.nodeType===
+3&&(!a.nodeValue||!/\S/.exec(a.nodeValue))}function I(a,b){if(a&&a.nodeType===3&&b.exec(a.nodeValue))a.nodeValue=a.nodeValue.replace(b,"")}function A(a){if(a){for(;H(a.firstChild);)a.removeChild(a.firstChild);for(I(a.firstChild,Q);H(a.lastChild);)a.removeChild(a.lastChild);I(a.lastChild,R)}}function J(a,b){var c=a[b];if(c){try{delete a[b]}catch(e){a[b]=void 0}if(!p(c))try{c=new Function(""+c)}catch(d){c=null}}return c}function K(a){if(a){var b=J(a,"$init");b&&b.call(a);(b=J(a,"$load"))?setTimeout(function(){b.call(a);
+b=a=null},0):b=a=null}}function B(a,b){for(var c=1,e=b.length;c<e;c++){var d=b[c];switch(j(d)){case 2:var f=d[0],d=B(r(f),d);if(f==="html")return A(d),K(d),d;v(a,d);break;case 4:d!==""&&v(a,m.createTextNode(""+d));break;case 3:a.nodeType===1&&(a=G(a,d));break;case 5:var f=v,h=a;var g=d,d=r("div");d.innerHTML=""+g;A(d);if(d.childNodes.length===1)d=d.firstChild;else{for(g=r("");d.firstChild;)g.appendChild(d.firstChild);d=g}f(h,d)}}A(a);K(a);if(a.nodeType===11&&a.childNodes.length===1)a=a.firstChild;
+return a}var m=w.document;x.prototype.toString=function(){return this.value};var y=Array.isArray||function(a){return a instanceof Array};n.FAST=!w.ScriptEngineMajorVersion;n.prototype.append=function(a,b,c){n.FAST?(this.value+=a,b!==null&&b!==void 0&&(this.value+=b,c!==null&&c!==void 0&&(this.value+=c))):this.value.push.apply(this.value,arguments)};n.prototype.clear=function(){this.value=n.FAST?"":[]};n.prototype.toString=function(){return n.FAST?this.value:this.value.join("")};var l;l=function(a,
+b,c,e,d,f){switch(j(a)){case 1:return z(a(b,c,e,d));case 2:var h=a[0]||"";switch(h){case "$for":a:{var g=a[1]||{},h=[""],i;if(g.hasOwnProperty("count")){i=g.count;p(i)&&(i=i(b,c,e,d));g.hasOwnProperty("data")?(g=g.data,p(g)&&(g=g(b,c,e,d))):g=b;for(b=0;b<i;b++)s(h,t(a,g,b,i,null,f))}else{if(g.hasOwnProperty("in")){var k=g["in"];p(k)&&(k=k(b,c,e,d));if(j(k)===3){g=[];for(i in k)k.hasOwnProperty(i)&&g.push(i);b=0;for(i=g.length;b<i;b++)s(h,t(a,k[g[b]],b,i,g[b],f));a=h;break a}g=k}else g=g.each,p(g)&&
+(g=g(b,c,e,d));b=j(g);if(b===2){b=0;for(i=g.length;b<i;b++)s(h,t(a,g[b],b,i,null,f))}else b!==0&&(h=t(a,g,0,1,null,f))}a=h}return a;case "$xor":return C(a,b,c,e,d,f);case "$if":return C(["$xor",a],b,c,e,d,f);case "$call":f=a[1]||{};if(f.view){h=l(f.view,b,c,e,d);g=f.hasOwnProperty("data")?l(f.data,b,c,e,d):b;i=f.hasOwnProperty("index")?l(f.index,b,c,e,d):c;k=f.hasOwnProperty("count")?l(f.count,b,c,e,d):e;b=f.hasOwnProperty("key")?l(f.key,b,c,e,d):d;c={};for(e=a.length-1;e>=2;e--)d=a[e],f=d[1]||{},
+f.hasOwnProperty("name")&&(c[f.name]=d);a=h&&p(h.getView)?l(h.getView(),g,i,k,b,c):null}else a=null;return a;case "$part":return h=(a[1]||{}).name||"",h=f&&f.hasOwnProperty(h)?f[h]:a,t(h,b,c,e,d)}h=[h];g=1;for(i=a.length;g<i;g++)s(h,l(a[g],b,c,e,d,f));return h;case 3:f={};for(h in a)a.hasOwnProperty(h)&&(f[h]=l(a[h],b,c,e,d));return f}return a};var o=w.duel=function(a){return p(a)&&p(a.getView)?a:L(a)};o.raw=o.raw=function(a){return new x(a)};var O={area:!0,base:!0,basefont:!0,br:!0,col:!0,frame:!0,
+hr:!0,img:!0,input:!0,isindex:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,wbr:!0};q.prototype.toString=function(){return E(this.value)};o.write=o.write=function(a,b,c,e,d){a=o(a).getView();a=l(a,b,c,e,d);m.write(E(a))};var P={rowspan:"rowSpan",colspan:"colSpan",cellpadding:"cellPadding",cellspacing:"cellSpacing",tabindex:"tabIndex",accesskey:"accessKey",hidefocus:"hideFocus",usemap:"useMap",maxlength:"maxLength",readonly:"readOnly",contenteditable:"contentEditable"},u={enctype:"encoding",onscroll:"DOMMouseScroll"},
+Q=/^[\r\n]+/,R=/[\r\n]+$/;q.prototype.toDOM=q.prototype.toDOM=function(){try{return B(r(this.value[0]),this.value)}catch(a){return m.createTextNode("["+a+"]")}};q.prototype.reload=q.prototype.reload=function(){var a=m;try{var b=this.toDOM();a.replaceChild(b,a.documentElement);if(a.createStyleSheet){for(var c=b.firstChild;c&&(c.tagName||"")!=="HEAD";)c=c.nextSibling;for(var e=c&&c.firstChild;e;){if((e.tagName||"")==="LINK")e.href=e.href;e=e.nextSibling}}}catch(d){a=a.open("text/html"),a.write(this.toString()),
+a.close()}};o.attr=o.attr=function(a,b,c,e,d,f){j(a)===4&&(a=m.getElementById(a));a&&(b=l(b,c,e,d,f),G(a,b))};o.replace=o.replace=function(a,b,c,e,d,f){j(a)===4&&(a=m.getElementById(a));if(a&&a.parentNode){b=o(b).getView();b=l(b,c,e,d,f);try{b=B(r(b[0]),b)}catch(h){b=m.createTextNode("["+h+"]")}a.parentNode.replaceChild(b,a)}};return o}(window);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.