Commits

Stephen McKamey committed 88c8110

- changing DOCTYPE to be more typical and less trendy

  • Participants
  • Parent commits 1d3d509

Comments (0)

Files changed (13)

 	 * @param {Array} node The result tree
 	 */
 	function renderComment(buffer, node) {
-		if (node[0] === '!doctype') {
+		if (node[0] === '!DOCTYPE') {
 			// emit doctype
-			buffer.append('<!doctype ', node[1], '>');
+			buffer.append('<!DOCTYPE ', node[1], '>');
 		} else {
 			// emit HTML comment
 			buffer.append('<!--', node[1], '-->');

build/duel.min.js

 ":"+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++){if(c)b.append(", ");else c=true;b.append(z(a[e]))}return b.toString();case 3:b=new n;b.append("{");for(e in a)if(a.hasOwnProperty(e)){if(c)b.append(", ");else c=true;b.append(e,"=",z(a[e]))}b.append("}");return b.toString()}return a}function q(a){if(j(a)!==2)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){if(b.hasOwnProperty(e))c[e]=b[e]}else a.splice(1,0,b);break;case 4:c=a.length-1;if(c>0&&j(a[c])===4)a[c]=""+a[c]+b;else 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);var g=[""];h=h?2:1;for(var 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){if(p(k))k=
 k(b,c,e,d);if(!k)continue}return t(i,b,c,e,d,f)}return null}function L(a){if(j(a)!==2)a=["",a];var b=function(c){try{var e=l(a,c,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(b){switch(b){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";default:return b}})}function N(a){if(typeof a!=="string")return a;return a.replace(/[&<>"]/g,function(b){switch(b){case "&":return"&amp;";
-case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";default:return b}})}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];j(f)===2?D(a,f):a.append(M(f))}c&&!h&&a.append("</",c,
+case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";default:return b}})}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];j(f)===2?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 w(a,b){if(b){var c=(a.tagName||"").toLowerCase();if(a.nodeType===8){if(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;if(!e){e=r(c==="th"?"thead":"tbody");a.appendChild(e)}e.appendChild(b)}else a.canHaveChildren!==false&&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!==false)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){if(typeof c==="string")c=new Function("event",c);if(p(c))a[b]=c}function G(a,b){if(b.name&&m.attachEvent&&!a.parentNode)try{var c=r("<"+a.tagName+" name='"+b.name+"'>");if(a.tagName===c.tagName)a=c}catch(e){}for(var d in b)if(b.hasOwnProperty(d)){c=b[d];var f=j(c);if(d){if(f===0){c="";f=4}d=P[d.toLowerCase()]||d;if(d==="style")if(typeof a.style.cssText!=="undefined")a.style.cssText=c;else a.style=c;else if(d==="class")a.className=c;else if(Q[d]){F(a,d,c);u[d]&&
 	 * @param {Array} node The result tree
 	 */
 	function renderComment(buffer, node) {
-		if (node[0] === '!doctype') {
+		if (node[0] === '!DOCTYPE') {
 			// emit doctype
-			buffer.append('<!doctype ', node[1], '>');
+			buffer.append('<!DOCTYPE ', node[1], '>');
 		} else {
 			// emit HTML comment
 			buffer.append('<!--', node[1], '-->');

src/org/duelengine/duel/HTMLFormatter.java

 	public HTMLFormatter writeDocType(Appendable output, String value)
 		throws IOException {
 
-		final String OPEN = "<!doctype";
+		final String OPEN = "<!DOCTYPE";
 		final char CLOSE = '>';
 
 		output.append(OPEN);

src/org/duelengine/duel/codegen/ClientCodeGen.java

 			this.writeComment(output, ((CodeCommentNode)node).getValue());
 
 		} else if (node instanceof DocTypeNode) {
-			this.writeSpecialElement(output, "!doctype", ((DocTypeNode)node).getValue(), depth, preMode);
+			this.writeSpecialElement(output, "!DOCTYPE", ((DocTypeNode)node).getValue(), depth, preMode);
 
 		} else if (node != null) {
 			throw new UnsupportedOperationException("Node not yet implemented: "+node.getClass());

src/org/duelengine/duel/codegen/ScriptTranslator.java

 			return new CodeVariableReferenceExpression(Object.class, ident);
 		}
 
-		// mark as potential to fail at runtime based upon data but
-		// pure assignments do not need to first check for existence
+		// mark as potential to fail at runtime based upon data, unless
+		// pure assignments which do not need to first check for existence
 		if (!(node.getParent().getType() == Token.ASSIGN &&
 			((InfixExpression)node.getParent()).getLeft() == node)) {
 

src/org/duelengine/duel/parsing/DuelLexer.java

 						if ((value != null) && (value.length() >= 7) &&
 							value.substring(0, 7).equalsIgnoreCase("doctype")) {
 							value = value.substring(7).trim();
-							begin = "<!doctype";
+							begin = "<!DOCTYPE";
 						}
 						break;
 				}

test/js/domTests.js

 
 	var view = duel(
 		["",
-		 	["!doctype",
+		 	["!DOCTYPE",
 		 	 	"html"],
 	 	 	"\n",
 			["html",

test/js/renderTests.js

 
 	var view = duel(
 		["",
-		 	["!doctype",
+		 	["!DOCTYPE",
 		 	 	"html"],
 	 	 	"\n",
 			["html",
 	var actual = view().toString();
 
 	var expected = 
-		'<!doctype html>\n'+
+		'<!DOCTYPE html>\n'+
 		'<html>'+
 		'<body>'+
 		'Lorem ipsum.'+

test/org/duelengine/duel/codegen/ClientCodeGenTests.java

 		String expected =
 			"/*global duel */\n\n"+
 			"var foo = duel([\"\",\n"+
-			"\t[\"!doctype\",\n"+
+			"\t[\"!DOCTYPE\",\n"+
 			"\t\t\"html\"\n"+
 			"\t],\n"+
 			"\t[\"html\",\n"+

test/org/duelengine/duel/codegen/CodeDOMBuilderTests.java

 						new CodeThisReferenceExpression(),
 						"write",
 						new CodeVariableReferenceExpression(DuelContext.class, "context"),
-						new CodePrimitiveExpression("<!doctype html><html><head><title>The head.</title></head><body><h1>The body.</h1></body></html>")))
+						new CodePrimitiveExpression("<!DOCTYPE html><html><head><title>The head.</title></head><body><h1>The body.</h1></body></html>")))
 				).withOverride().withThrows(IOException.class)
 			);
 

test/org/duelengine/duel/parsing/DuelLexerTests.java

 	@Test
 	public void doctypeHTML5Test() {
 
-		String input = "<!doctype html>\r\n<html></html>";
+		String input = "<!DOCTYPE html>\r\n<html></html>";
 
 		Object[] expected = {
-				DuelToken.block(new BlockValue("<!doctype", ">", "html")),
+				DuelToken.block(new BlockValue("<!DOCTYPE", ">", "html")),
 				DuelToken.literal("\n"),
 				DuelToken.elemBegin("html"),
 				DuelToken.elemEnd("html")
 			"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" />";
 
 		Object[] expected = {
-				DuelToken.block(new BlockValue("<!doctype", ">", "html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"")),
+				DuelToken.block(new BlockValue("<!DOCTYPE", ">", "html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"")),
 				DuelToken.literal("\n"),
 				DuelToken.elemBegin("html"),
 				DuelToken.attrName("xmlns"),
 		String input = "<!DocType>";
 
 		Object[] expected = {
-				DuelToken.block(new BlockValue("<!doctype", ">", ""))
+				DuelToken.block(new BlockValue("<!DOCTYPE", ">", ""))
 			};
 
 		Object[] actual = new DuelLexer(input).toList().toArray();

test/org/duelengine/duel/parsing/DuelParserTests.java

 			DuelToken.elemBegin("view"),
 			DuelToken.attrName("name"),
 			DuelToken.attrValue("foo"),
-			DuelToken.block(new BlockValue("<!doctype", ">", "html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"")),
+			DuelToken.block(new BlockValue("<!DOCTYPE", ">", "html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"")),
 			DuelToken.literal("\n"),
 			DuelToken.elemBegin("html"),
 			DuelToken.attrName("xmlns"),