Permalink
Browse files

demo fixes for dumb browsers

  • Loading branch information...
1 parent bdba5bd commit cb76206ee32c3a508852e5e847f9b708d4c57e0a akdubya committed Oct 26, 2010
Showing with 66 additions and 5 deletions.
  1. +2 −2 benchmark/index.html
  2. +1 −0 docs/index.dust.html
  3. +1 −1 docs/index.js
  4. +2 −2 index.html
  5. +60 −0 vendor/ecma.js
View
@@ -74,15 +74,15 @@
<script src="../vendor/jquery.min.js"></script>
<script src="uubench.js"></script>
+ <script src="../lib/dust.js"></script>
<script src="../lib/parser.js"></script>
<script src="../lib/compiler.js"></script>
- <script src="../lib/dust.js"></script>
<script src="suites/dust_suite.js"></script>
<script src="suites/mustache_suite.js"></script>
<script src="suites/handlebars_suite.js"></script>
<script src="suites/jquery_suite.js"></script>
<script src="http://github.com/wycats/handlebars.js/raw/master/lib/handlebars.js"></script>
- <script src="http://github.com/janl/mustache.js/raw/master/mustache.js"</script>
+ <script src="http://github.com/janl/mustache.js/raw/master/mustache.js"></script>
<script src="http://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
View
@@ -4,6 +4,7 @@
<title>dust</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{#inline names="index" ext="css"/}
+ <script src="vendor/ecma.js"></script>
<script src="vendor/jquery.min.js"></script>
<script src="vendor/jsdump.js"></script>
<script src="vendor/beautify.js"></script>
View
@@ -93,7 +93,7 @@ function runSuite() {
});
}
});
- coreSetup(suite, dustExamples.slice(1));
+ coreSetup(suite, dustExamples.slice(1), dust);
suite.run();
}
View
@@ -199,7 +199,7 @@
code .string, code .regexp { color: #669933 }
code .class, code .special { }
code .number { color: #eddd3d }
-code .comment { color: grey }</style><script src="vendor/jquery.min.js"></script><script src="vendor/jsdump.js"></script><script src="vendor/beautify.js"></script><script src="lib/dust.js"></script><script src="lib/parser.js"></script><script src="lib/compiler.js"></script><script src="test/examples.js"></script><script src="test/uutest.js"></script><script src="test/core.js"></script><script type="text/javascript">(function(){dust.register("select",body_0);var blocks=null;function body_2(chk,ctx){return chk.reference(ctx.getPath(true,[]),ctx,"h",[]);}function body_1(chk,ctx){return chk.write("<option ").reference(ctx.get("selected"),ctx,"h",[]).write(" value=\"").helper("idx",ctx,{"block":body_2},null).write("\">").reference(ctx.get("name"),ctx,"h",[]).write("</option>");}function body_0(chk,ctx){ctx=ctx.shiftBlocks(blocks);return chk.write("<select style=\"clear: both;\">").section(ctx.get("examples"),ctx,{"block":body_1},null).write("</select>");}})();</script><script type="text/javascript">dustExamples.forEach(function(ex) {
+code .comment { color: grey }</style><script src="vendor/ecma.js"></script><script src="vendor/jquery.min.js"></script><script src="vendor/jsdump.js"></script><script src="vendor/beautify.js"></script><script src="lib/dust.js"></script><script src="lib/parser.js"></script><script src="lib/compiler.js"></script><script src="test/examples.js"></script><script src="test/uutest.js"></script><script src="test/core.js"></script><script type="text/javascript">(function(){dust.register("select",body_0);var blocks=null;function body_2(chk,ctx){return chk.reference(ctx.getPath(true,[]),ctx,"h",[]);}function body_1(chk,ctx){return chk.write("<option ").reference(ctx.get("selected"),ctx,"h",[]).write(" value=\"").helper("idx",ctx,{"block":body_2},null).write("\">").reference(ctx.get("name"),ctx,"h",[]).write("</option>");}function body_0(chk,ctx){ctx=ctx.shiftBlocks(blocks);return chk.write("<select style=\"clear: both;\">").section(ctx.get("examples"),ctx,{"block":body_1},null).write("</select>");}})();</script><script type="text/javascript">dustExamples.forEach(function(ex) {
dust.loadSource(dust.compile(ex.source, ex.name));
});
@@ -294,7 +294,7 @@
});
}
});
- coreSetup(suite, dustExamples.slice(1));
+ coreSetup(suite, dustExamples.slice(1), dust);
suite.run();
}
View
@@ -0,0 +1,60 @@
+if (!Array.prototype.forEach) {
+ Array.prototype.forEach = function(fun /*, thisp */) {
+ "use strict";
+
+ if (this === void 0 || this === null)
+ throw new TypeError();
+
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (typeof fun !== "function")
+ throw new TypeError();
+
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++) {
+ if (i in t)
+ fun.call(thisp, t[i], i, t);
+ }
+ };
+}
+
+if (!Array.prototype.map) {
+ Array.prototype.map = function(fun /*, thisp */) {
+ "use strict";
+
+ if (this === void 0 || this === null)
+ throw new TypeError();
+
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (typeof fun !== "function")
+ throw new TypeError();
+
+ var res = new Array(len);
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++) {
+ if (i in t)
+ res[i] = fun.call(thisp, t[i], i, t);
+ }
+
+ return res;
+ };
+}
+
+if (!String.prototype.trim) {
+ String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g,"");
+ }
+}
+
+if (!String.prototype.trimLeft) {
+ String.prototype.trimLeft = function() {
+ return this.replace(/^\s+/,"");
+ }
+}
+
+if (!String.prototype.trimRight) {
+ String.prototype.trimRight = function() {
+ return this.replace(/\s+$/,"");
+ }
+}

0 comments on commit cb76206

Please sign in to comment.