summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortomhuda <tomhuda@tilde.io>2012-02-17 16:51:35 -0800
committertomhuda <tomhuda@tilde.io>2012-02-17 16:51:35 -0800
commit24e04bad949405dae145d40fbea6a97bafb1c78d (patch)
tree62e41811b18e5c9e5746234400c00c3f56d0fabf
parente6079ca5e255ee18b88752e6f94438e07582931d (diff)
downloadhandlebars.js-24e04bad949405dae145d40fbea6a97bafb1c78d.zip
handlebars.js-24e04bad949405dae145d40fbea6a97bafb1c78d.tar.gz
handlebars.js-24e04bad949405dae145d40fbea6a97bafb1c78d.tar.bz2
JSHint the library and fix a few bugs
-rw-r--r--.jshintrc50
-rw-r--r--lib/handlebars/base.js2
-rw-r--r--lib/handlebars/compiler/compiler.js9
3 files changed, 58 insertions, 3 deletions
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..4fc2003
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,50 @@
+{
+ "predef": [
+ "console",
+ "Ember",
+ "DS",
+ "Handlebars",
+ "Metamorph",
+ "ember_assert",
+ "ember_warn",
+ "ember_deprecate",
+ "ember_deprecateFunc",
+ "require",
+ "equal",
+ "test",
+ "testBoth",
+ "raises",
+ "deepEqual",
+ "start",
+ "stop",
+ "ok",
+ "strictEqual",
+ "module"
+ ],
+
+ "node" : true,
+ "es5" : true,
+ "browser" : true,
+
+ "boss" : true,
+ "curly": false,
+ "debug": false,
+ "devel": false,
+ "eqeqeq": true,
+ "evil": true,
+ "forin": false,
+ "immed": false,
+ "laxbreak": false,
+ "newcap": true,
+ "noarg": true,
+ "noempty": false,
+ "nonew": false,
+ "nomen": false,
+ "onevar": false,
+ "plusplus": false,
+ "regexp": false,
+ "undef": true,
+ "sub": true,
+ "strict": false,
+ "white": false
+}
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js
index ceb071d..36ec257 100644
--- a/lib/handlebars/base.js
+++ b/lib/handlebars/base.js
@@ -1,4 +1,6 @@
// BEGIN(BROWSER)
+
+/*jshint eqnull:true*/
var Handlebars = {};
Handlebars.VERSION = "1.0.beta.5";
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 336b60d..2cdc7c0 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -1,6 +1,8 @@
var Handlebars = require("./base");
// BEGIN(BROWSER)
+
+/*jshint eqnull:true*/
Handlebars.Compiler = function() {};
Handlebars.JavaScriptCompiler = function() {};
@@ -139,7 +141,7 @@ Handlebars.JavaScriptCompiler = function() {};
compileProgram: function(program) {
var result = new this.compiler().compile(program, this.options);
- var guid = this.guid++;
+ var guid = this.guid++, depth;
this.usePartial = this.usePartial || result.usePartial;
@@ -643,7 +645,7 @@ Handlebars.JavaScriptCompiler = function() {};
},
invokePartial: function(context) {
- params = [this.nameLookup('partials', context, 'partial'), "'" + context + "'", this.popStack(), "helpers", "partials"];
+ var params = [this.nameLookup('partials', context, 'partial'), "'" + context + "'", this.popStack(), "helpers", "partials"];
if (this.options.data) {
params.push("data");
@@ -682,7 +684,8 @@ Handlebars.JavaScriptCompiler = function() {};
if(guid == null) { return "self.noop"; }
var child = this.environment.children[guid],
- depths = child.depths.list;
+ depths = child.depths.list, depth;
+
var programParams = [child.index, child.name, "data"];
for(var i=0, l = depths.length; i<l; i++) {