From 23288b7fb15455b972fcafbc81633d2d0c0d7408 Mon Sep 17 00:00:00 2001 From: Wing Date: Tue, 17 Jun 2014 17:08:08 +0800 Subject: [PATCH 01/92] fix test --- test/test.js | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/test/test.js b/test/test.js index 00e3044..a8ea313 100644 --- a/test/test.js +++ b/test/test.js @@ -53,21 +53,24 @@ it('String template', function () { expect( - tmpl('{%=o.value%}', data), + tmpl('{%=o.value%}', data) + ).to.be( 'value' ); }); it('Load template by id', function () { expect( - tmpl('template', data), + tmpl('template', data) + ).to.be( 'value' ); }); it('Retun function when called without data parameter', function () { expect( - tmpl('{%=o.value%}')(data), + tmpl('{%=o.value%}')(data) + ).to.be( 'value' ); }); @@ -85,49 +88,56 @@ it('Escape HTML special characters with {%=o.prop%}', function () { expect( - tmpl('{%=o.special%}', data), + tmpl('{%=o.special%}', data) + ).to.be( '<>&"'' ); }); it('Allow HTML special characters with {%#o.prop%}', function () { expect( - tmpl('{%#o.special%}', data), + tmpl('{%#o.special%}', data) + ).to.be( '<>&"\'\x00' ); }); it('Function call', function () { expect( - tmpl('{%=o.func()%}', data), + tmpl('{%=o.func()%}', data) + ).to.be( 'value' ); }); it('Dot notation', function () { expect( - tmpl('{%=o.deep.value%}', data), + tmpl('{%=o.deep.value%}', data) + ).to.be( 'value' ); }); it('Handle single quotes', function () { expect( - tmpl('\'single quotes\'{%=": \'"%}', data), - '\'single quotes\': \'' + tmpl('\'single quotes\'{%=": \'"%}', data) + ).to.be( + '\'single quotes\': '' ); }); it('Handle double quotes', function () { expect( - tmpl('"double quotes"{%=": \\""%}', data), + tmpl('"double quotes"{%=": \\""%}', data) + ).to.be( '"double quotes": "' ); }); it('Handle backslashes', function () { expect( - tmpl('\\backslashes\\{%=": \\\\"%}', data), + tmpl('\\backslashes\\{%=": \\\\"%}', data) + ).to.be( '\\backslashes\\: \\' ); }); @@ -177,14 +187,16 @@ it('Escape HTML special characters with print(data)', function () { expect( - tmpl('{% print(o.special); %}', data), + tmpl('{% print(o.special); %}', data) + ).to.be( '<>&"'' ); }); it('Allow HTML special characters with print(data, true)', function () { expect( - tmpl('{% print(o.special, true); %}', data), + tmpl('{% print(o.special, true); %}', data) + ).to.be( '<>&"\'\x00' ); }); @@ -219,14 +231,16 @@ it('Include template', function () { expect( - tmpl('{% include("template", {value: "value"}); %}', data), + tmpl('{% include("template", {value: "value"}); %}', data) + ).to.be( 'value' ); }); it('If condition', function () { expect( - tmpl('{% if (o.value) { %}true{% } else { %}false{% } %}', data), + tmpl('{% if (o.value) { %}true{% } else { %}false{% } %}', data) + ).to.be( 'true' ); }); From 579867916dcb4a3c8a6c7a7faa9945f3286a0ccd Mon Sep 17 00:00:00 2001 From: Wing Date: Tue, 17 Jun 2014 17:18:46 +0800 Subject: [PATCH 02/92] use .to.eql() instead of .to.be() --- test/test.js | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/test/test.js b/test/test.js index a8ea313..d005e54 100644 --- a/test/test.js +++ b/test/test.js @@ -54,7 +54,7 @@ it('String template', function () { expect( tmpl('{%=o.value%}', data) - ).to.be( + ).to.eql( 'value' ); }); @@ -62,7 +62,7 @@ it('Load template by id', function () { expect( tmpl('template', data) - ).to.be( + ).to.eql( 'value' ); }); @@ -70,7 +70,7 @@ it('Retun function when called without data parameter', function () { expect( tmpl('{%=o.value%}')(data) - ).to.be( + ).to.eql( 'value' ); }); @@ -89,7 +89,7 @@ it('Escape HTML special characters with {%=o.prop%}', function () { expect( tmpl('{%=o.special%}', data) - ).to.be( + ).to.eql( '<>&"'' ); }); @@ -97,7 +97,7 @@ it('Allow HTML special characters with {%#o.prop%}', function () { expect( tmpl('{%#o.special%}', data) - ).to.be( + ).to.eql( '<>&"\'\x00' ); }); @@ -105,7 +105,7 @@ it('Function call', function () { expect( tmpl('{%=o.func()%}', data) - ).to.be( + ).to.eql( 'value' ); }); @@ -113,7 +113,7 @@ it('Dot notation', function () { expect( tmpl('{%=o.deep.value%}', data) - ).to.be( + ).to.eql( 'value' ); }); @@ -121,7 +121,7 @@ it('Handle single quotes', function () { expect( tmpl('\'single quotes\'{%=": \'"%}', data) - ).to.be( + ).to.eql( '\'single quotes\': '' ); }); @@ -129,7 +129,7 @@ it('Handle double quotes', function () { expect( tmpl('"double quotes"{%=": \\""%}', data) - ).to.be( + ).to.eql( '"double quotes": "' ); }); @@ -137,7 +137,7 @@ it('Handle backslashes', function () { expect( tmpl('\\backslashes\\{%=": \\\\"%}', data) - ).to.be( + ).to.eql( '\\backslashes\\: \\' ); }); @@ -151,7 +151,7 @@ '{%=o.zeroValue%}', data ) - ).to.be( + ).to.eql( 'false0' ); }); @@ -165,7 +165,7 @@ '{%#o.zeroValue%}', data ) - ).to.be( + ).to.eql( 'false0' ); }); @@ -176,7 +176,7 @@ '\n\r\t{%=o.value%} \n\r\t{%=o.value%} ', data ) - ).to.be( + ).to.eql( '\n\r\tvalue \n\r\tvalue ' ); }); @@ -188,7 +188,7 @@ it('Escape HTML special characters with print(data)', function () { expect( tmpl('{% print(o.special); %}', data) - ).to.be( + ).to.eql( '<>&"'' ); }); @@ -196,7 +196,7 @@ it('Allow HTML special characters with print(data, true)', function () { expect( tmpl('{% print(o.special, true); %}', data) - ).to.be( + ).to.eql( '<>&"\'\x00' ); }); @@ -210,7 +210,7 @@ '{% print(o.zeroValue); %}', data ) - ).to.be( + ).to.eql( 'false0' ); }); @@ -224,7 +224,7 @@ '{% print(o.zeroValue, true); %}', data ) - ).to.be( + ).to.eql( 'false0' ); }); @@ -232,7 +232,7 @@ it('Include template', function () { expect( tmpl('{% include("template", {value: "value"}); %}', data) - ).to.be( + ).to.eql( 'value' ); }); @@ -240,7 +240,7 @@ it('If condition', function () { expect( tmpl('{% if (o.value) { %}true{% } else { %}false{% } %}', data) - ).to.be( + ).to.eql( 'true' ); }); @@ -251,7 +251,7 @@ '{% if (o.undefinedValue) { %}false{% } else { %}true{% } %}', data ) - ).to.be( + ).to.eql( 'true' ); }); @@ -263,7 +263,7 @@ '{%=o.list[i]%}{% } %}', data ) - ).to.be( + ).to.eql( '12345' ); }); @@ -275,7 +275,7 @@ 'print(o.list[i]);} %}', data ) - ).to.be( + ).to.eql( '12345' ); }); @@ -287,7 +287,7 @@ 'include("template", {value: o.list[i]});} %}', data ).replace(/[\r\n]/g, '') - ).to.be( + ).to.eql( '12345' ); }); @@ -298,7 +298,7 @@ '{% if (o.list.length % 5 === 0) { %}5 list items{% } %}', data ).replace(/[\r\n]/g, '') - ).to.be( + ).to.eql( '5 list items' ); }); From f660d4121f7a9ad40c3b2801fb04e3838027243f Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 2 Jul 2014 20:27:09 +0100 Subject: [PATCH 03/92] Revert "use .to.eql() instead of .to.be()" This reverts commit 579867916dcb4a3c8a6c7a7faa9945f3286a0ccd. --- test/test.js | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/test/test.js b/test/test.js index d005e54..a8ea313 100644 --- a/test/test.js +++ b/test/test.js @@ -54,7 +54,7 @@ it('String template', function () { expect( tmpl('{%=o.value%}', data) - ).to.eql( + ).to.be( 'value' ); }); @@ -62,7 +62,7 @@ it('Load template by id', function () { expect( tmpl('template', data) - ).to.eql( + ).to.be( 'value' ); }); @@ -70,7 +70,7 @@ it('Retun function when called without data parameter', function () { expect( tmpl('{%=o.value%}')(data) - ).to.eql( + ).to.be( 'value' ); }); @@ -89,7 +89,7 @@ it('Escape HTML special characters with {%=o.prop%}', function () { expect( tmpl('{%=o.special%}', data) - ).to.eql( + ).to.be( '<>&"'' ); }); @@ -97,7 +97,7 @@ it('Allow HTML special characters with {%#o.prop%}', function () { expect( tmpl('{%#o.special%}', data) - ).to.eql( + ).to.be( '<>&"\'\x00' ); }); @@ -105,7 +105,7 @@ it('Function call', function () { expect( tmpl('{%=o.func()%}', data) - ).to.eql( + ).to.be( 'value' ); }); @@ -113,7 +113,7 @@ it('Dot notation', function () { expect( tmpl('{%=o.deep.value%}', data) - ).to.eql( + ).to.be( 'value' ); }); @@ -121,7 +121,7 @@ it('Handle single quotes', function () { expect( tmpl('\'single quotes\'{%=": \'"%}', data) - ).to.eql( + ).to.be( '\'single quotes\': '' ); }); @@ -129,7 +129,7 @@ it('Handle double quotes', function () { expect( tmpl('"double quotes"{%=": \\""%}', data) - ).to.eql( + ).to.be( '"double quotes": "' ); }); @@ -137,7 +137,7 @@ it('Handle backslashes', function () { expect( tmpl('\\backslashes\\{%=": \\\\"%}', data) - ).to.eql( + ).to.be( '\\backslashes\\: \\' ); }); @@ -151,7 +151,7 @@ '{%=o.zeroValue%}', data ) - ).to.eql( + ).to.be( 'false0' ); }); @@ -165,7 +165,7 @@ '{%#o.zeroValue%}', data ) - ).to.eql( + ).to.be( 'false0' ); }); @@ -176,7 +176,7 @@ '\n\r\t{%=o.value%} \n\r\t{%=o.value%} ', data ) - ).to.eql( + ).to.be( '\n\r\tvalue \n\r\tvalue ' ); }); @@ -188,7 +188,7 @@ it('Escape HTML special characters with print(data)', function () { expect( tmpl('{% print(o.special); %}', data) - ).to.eql( + ).to.be( '<>&"'' ); }); @@ -196,7 +196,7 @@ it('Allow HTML special characters with print(data, true)', function () { expect( tmpl('{% print(o.special, true); %}', data) - ).to.eql( + ).to.be( '<>&"\'\x00' ); }); @@ -210,7 +210,7 @@ '{% print(o.zeroValue); %}', data ) - ).to.eql( + ).to.be( 'false0' ); }); @@ -224,7 +224,7 @@ '{% print(o.zeroValue, true); %}', data ) - ).to.eql( + ).to.be( 'false0' ); }); @@ -232,7 +232,7 @@ it('Include template', function () { expect( tmpl('{% include("template", {value: "value"}); %}', data) - ).to.eql( + ).to.be( 'value' ); }); @@ -240,7 +240,7 @@ it('If condition', function () { expect( tmpl('{% if (o.value) { %}true{% } else { %}false{% } %}', data) - ).to.eql( + ).to.be( 'true' ); }); @@ -251,7 +251,7 @@ '{% if (o.undefinedValue) { %}false{% } else { %}true{% } %}', data ) - ).to.eql( + ).to.be( 'true' ); }); @@ -263,7 +263,7 @@ '{%=o.list[i]%}{% } %}', data ) - ).to.eql( + ).to.be( '12345' ); }); @@ -275,7 +275,7 @@ 'print(o.list[i]);} %}', data ) - ).to.eql( + ).to.be( '12345' ); }); @@ -287,7 +287,7 @@ 'include("template", {value: o.list[i]});} %}', data ).replace(/[\r\n]/g, '') - ).to.eql( + ).to.be( '12345' ); }); @@ -298,7 +298,7 @@ '{% if (o.list.length % 5 === 0) { %}5 list items{% } %}', data ).replace(/[\r\n]/g, '') - ).to.eql( + ).to.be( '5 list items' ); }); From cee60f051c44ca5a2bbd7f196c965d1850c9e0c8 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 2 Jul 2014 20:35:34 +0100 Subject: [PATCH 04/92] Updated test file version for last merge. --- test/test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index a8ea313..3c34a08 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates Test 2.4.1 + * JavaScript Templates Test 2.4.2 * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -9,7 +9,7 @@ * http://www.opensource.org/licenses/MIT */ -/*global beforeEach, afterEach, describe, it, expect, require */ +/*global beforeEach, afterEach, describe, it, require */ (function (context, expect, tmpl) { 'use strict'; From c8440fb09103d36f3baab7b339fbe73202c1e53c Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 2 Jul 2014 20:35:45 +0100 Subject: [PATCH 05/92] Added .jshintrc file. --- .jshintrc | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..4ad82e6 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,81 @@ +{ + "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : true, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "immed" : true, // true: Require immediate invocations to be wrapped in parens + // e.g. `(function () { } ());` + "indent" : 4, // {int} Number of spaces to use for indentation + "latedef" : true, // true: Require variables/functions to be defined before being used + "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : true, // true: Prohibit use of empty blocks + "nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : "single", // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "trailing" : true, // true: Prohibit trailing whitespaces + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : false, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements" + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment + "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : false, // Web Browser (window, document, etc) + "couch" : false, // CouchDB + "devel" : false, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jquery" : false, // jQuery + "mootools" : false, // MooTools + "node" : false, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "rhino" : false, // Rhino + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Legacy + "nomen" : true, // true: Prohibit dangling `_` in variables + "onevar" : true, // true: Allow only one `var` statement per function + "passfail" : false, // true: Stop on first error + "white" : true, // true: Check against strict whitespace and indentation rules + + // Custom Globals + "globals" : {} // additional predefined global variables +} From 79eb7881cf841cf136bcb4bcb7e225b42a32c5c7 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 2 Jul 2014 20:36:12 +0100 Subject: [PATCH 06/92] Updated devDependencies. --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 156d586..4955d38 100644 --- a/package.json +++ b/package.json @@ -31,13 +31,13 @@ } ], "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-uglify": "~0.2.7", - "grunt-contrib-jshint": "~0.7.1", - "grunt-bump-build-git": "~1.0.0", + "grunt": "~0.4.5", + "grunt-contrib-uglify": "~0.5.0", + "grunt-contrib-jshint": "~0.10.0", + "grunt-bump-build-git": "~1.1.1", "grunt-simple-mocha": "~0.4.0", - "grunt-mocha": "~0.4.1", - "expect.js": "0.2.0" + "grunt-mocha": "~0.4.11", + "expect.js": "0.3.1" }, "scripts": { "test": "grunt test" From b75e882ec0e353ce2d8bfdb2ea755060d2012368 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Wed, 2 Jul 2014 20:39:56 +0100 Subject: [PATCH 07/92] Patched tests release. --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index b55c220..5bdc0f4 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "blueimp-tmpl", - "version": "2.5.3", + "version": "2.5.4", "title": "JavaScript Templates", "description": "< 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.", "keywords": [ diff --git a/package.json b/package.json index 4955d38..938c1d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blueimp-tmpl", - "version": "2.5.3", + "version": "2.5.4", "title": "JavaScript Templates", "description": "< 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.", "keywords": [ From 68aa5d3e6823c7cf0e3494aef8d3185cca4b7a60 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Sun, 14 Sep 2014 00:05:00 +0100 Subject: [PATCH 08/92] Use https for the demo. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index de42e76..853710f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # JavaScript Templates ## Demo -[JavaScript Templates Demo](http://blueimp.github.io/JavaScript-Templates/) +[JavaScript Templates Demo](https://blueimp.github.io/JavaScript-Templates/) ## Description < 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers. @@ -62,7 +62,7 @@ document.getElementById("result").innerHTML = tmpl("tmpl-demo", data); The following is an example how to use the JavaScript Templates engine on the server-side with [node.js](http://nodejs.org/). -Create a new directory and add the **tmpl.js** file. Or alternatively, install the **blueimp-tmpl** package with [npm](http://npmjs.org/): +Create a new directory and add the **tmpl.js** file. Or alternatively, install the **blueimp-tmpl** package with [npm](https://www.npmjs.org/): ```sh npm install blueimp-tmpl @@ -291,7 +291,7 @@ Use **include(str, obj)** to include content from a different template: ```html
-{% include('tmpl-link', {name: "Website", url: "http://example.org/"}); %} +{% include('tmpl-link', {name: "Website", url: "https://example.org/"}); %}
``` @@ -319,7 +319,7 @@ Use **include(str, obj)** to include content from a different template: The JavaScript Templates project comes with a compilation script, that allows you to compile your templates into JavaScript code and combine them with a minimal Templates runtime into one minified JavaScript file. The compilation script is built for [node.js](http://nodejs.org/) and also requires [UglifyJS](https://github.com/mishoo/UglifyJS). -To use it, first install both the JavaScript Templates project and UglifyJS via [npm](http://npmjs.org/): +To use it, first install both the JavaScript Templates project and UglifyJS via [npm](https://www.npmjs.org/): ```sh npm install uglify-js @@ -338,7 +338,7 @@ The files given as command line arguments to **tmpl.js** can either be pure temp The generated file can be included in your project as a replacement for the original **tmpl.js** runtime. It provides you with the same API and provides a **tmpl(id, data)** function that accepts the id of one of your templates as first and a data object as optional second parameter. ## Tests -The JavaScript Templates project comes with [Unit Tests](http://en.wikipedia.org/wiki/Unit_testing). +The JavaScript Templates project comes with [Unit Tests](https://en.wikipedia.org/wiki/Unit_testing). There are two different ways to run the tests: * Open test/index.html in your browser or From 587fd7c683e5df40597a19bf162abd8081abdcb4 Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Sun, 14 Sep 2014 22:58:41 +0100 Subject: [PATCH 09/92] Use the https version of the test resources. --- test/index.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/index.html b/test/index.html index 5827909..a83c7c3 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ - + - + diff --git a/js/compile.js b/js/compile.js index 84ff2ce..0bf0144 100755 --- a/js/compile.js +++ b/js/compile.js @@ -1,6 +1,6 @@ #!/usr/bin/env node /* - * JavaScript Templates Compiler 2.4.0 + * JavaScript Templates Compiler * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -53,7 +53,7 @@ if (index > 1) { stats = fs.statSync(file); if (!stats.isFile()) { - console.error(file + ' is not a file.'); + console.error(file + " is not a file."); return; } content = fs.readFileSync(file, "utf8"); @@ -74,7 +74,7 @@ } }); if (!list.length) { - console.error('Missing input file.'); + console.error("Missing input file."); return; } // Combine the generated functions as cache of the minimal runtime: diff --git a/js/demo.js b/js/demo.js index afcedc2..2862415 100644 --- a/js/demo.js +++ b/js/demo.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates Demo JS 2.4.0 + * JavaScript Templates Demo * https://github.com/blueimp/JavaScript-Templates * * Copyright 2013, Sebastian Tschan diff --git a/js/runtime.js b/js/runtime.js index c4121fd..cb4c27e 100644 --- a/js/runtime.js +++ b/js/runtime.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates Runtime 2.4.1 + * JavaScript Templates Runtime * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -9,10 +9,10 @@ * http://www.opensource.org/licenses/MIT */ -/*jslint sloppy: true */ /*global define */ (function ($) { + "use strict"; var tmpl = function (id, data) { var f = tmpl.cache[id]; return data ? f(data, tmpl) : function (data) { diff --git a/js/tmpl.js b/js/tmpl.js index 9380053..90b9e42 100644 --- a/js/tmpl.js +++ b/js/tmpl.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates 2.4.1 + * JavaScript Templates * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -12,7 +12,7 @@ * http://ejohn.org/blog/javascript-micro-templating/ */ -/*jslint evil: true, regexp: true, unparam: true */ +/*jshint evil: true */ /*global document, define */ (function ($) { @@ -21,7 +21,7 @@ var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] || tmpl(tmpl.load(str)) : new Function( - tmpl.arg + ',tmpl', + tmpl.arg + ",tmpl", "var _e=tmpl.encode" + tmpl.helper + ",_s='" + str.replace(tmpl.regexp, tmpl.func) + "';return _s;" diff --git a/test/index.html b/test/index.html index 9bdd78b..5be1e78 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ JavaScript Templates Demo - +

JavaScript Templates Demo

-

< 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies.
-Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.

+

1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies.
+Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.