Skip to content

Commit

Permalink
Commit 74 (v0.9.74 - Beta)
Browse files Browse the repository at this point in the history
Updates and new documentation topics:

- Important updates and improvements to $.views.settings APIs:
  settings.allowCode(), settings.delimiters(), settings.debugMode() plus
  new settings.advanced(). See new documentation at www.jsviews.com/#settings

- Support for error handling and debugging improved and extended, with
  some small changes to APIs - including for $.views.settings.debugMode,
  with full documention at www.jsviews.com/#onerror

- {{>}} is now equivalent to {{>#data}}

Minor breaking changes:

- JsRender no longer uses the (0, eval)('this') expression
  to get the window object. This means that it can now be minified
  by the Visual Studio minifier, in spite of it not correctly minifying
  this expression. See BorisMoore/jsviews#323

Bug fixes:

- Several small bug fixes

- This update also includes a security fix
  • Loading branch information
BorisMoore committed Mar 20, 2016
1 parent 11ebdd8 commit f984e13
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 299 deletions.
230 changes: 133 additions & 97 deletions jsrender-node.js

Large diffs are not rendered by default.

247 changes: 142 additions & 105 deletions jsrender.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions jsrender.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jsrender.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsrender",
"version": "v0.9.73",
"version": "v0.9.74",
"description": "Best-of-breed templating in browser or on Node.js (with Express 4, Hapi and Browserify integration)",
"main": "./jsrender-node.js",
"browser": "./jsrender.js",
Expand Down
24 changes: 0 additions & 24 deletions test/perf-compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,6 @@ <h3>Perf comparison</h3>
ret = tmpl_JsRender.render( movie );
});

test( "JsRender: Debug mode off - <em>$.views.settings.debugMode(false)</em>", times * 500, 1,
function() {
ret = tmpl_JsRender.render( movie );
},
function() {
$.views.settings.debugMode(false);
},
function() {
$.views.settings.debugMode(true);
}
);

// Test html encoding perf
$( "#results" ).append( "<tr><td colspan='2'>________________________________________________________</td></tr>" );
$( "#results" ).append( "<tr><td colspan='2'><b>Render to string, with HTML encoding</b></td></tr>");
Expand All @@ -157,18 +145,6 @@ <h3>Perf comparison</h3>
ret = tmpl_JsRenderEncode.render( movie );
});

test( "JsRender: Debug mode off - <em>$.views.settings.debugMode(false)</em>", times * 50, 1,
function() {
ret = tmpl_JsRenderEncode.render( movie );
},
function() {
$.views.settings.debugMode(false);
},
function() {
$.views.settings.debugMode(true);
}
);

// Test full features perf
$( "#results" ).append( "<tr><td colspan='2'>________________________________________________________</td></tr>" );
$( "#results" ).append( "<tr><td colspan='2'><b>Render and insert in DOM</b></td></tr>");
Expand Down
196 changes: 133 additions & 63 deletions test/unit-tests/tests-jsrender-no-jquery.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions test/unit-tests/tests-jsrender-with-jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var person = { name: "Jo" },
people = [{ name: "Jo" },{ name: "Bill" }],
towns = [{ name: "Seattle" },{ name: "Paris" },{ name: "Delhi" }];

var tmplString = "A_{{:name}}_B";
var tmplString = "A_{{:name}}_B";

module("api");

Expand Down Expand Up @@ -102,7 +102,7 @@ test("templates", function() {
equal($.render.my_tmpl(person), "A_Jo_B", 'Compile a template and then render it: $.templates("my_tmpl", tmplString); $.render.my_tmpl(data);');

$.templates({ myTmpl2: tmplString });
equal($.render.myTmpl2(person), "A_Jo_B", 'Compile and register templates: $.templates({ "my_tmpl", tmplString, ... }); $.render.my_tmpl(data);');
equal($.render.myTmpl2(person), "A_Jo_B", 'Compile and register templates: $.templates({ "my_tmpl", tmplString, ... }); $.render.my_tmpl(data);');

equal($.templates.myTmpl2.render(person), "A_Jo_B", 'Get named template: $.templates.my_tmpl.render(data);');

Expand Down Expand Up @@ -149,7 +149,7 @@ test("templates", function() {
ok($.templates.cloned2 !== tmpl2 && $.templates.cloned2.tmplName === "cloned2", '$.templates({ cloned: {markup: "#my_tmpl" } }) will clone the cached template');

$.templates("my_tmpl", null);
equal($.templates.my_tmpl, undefined, 'Remove a named template: $.templates("my_tmpl", null);');
equal($.templates.my_tmpl, undefined, 'Remove a named template: $.templates("my_tmpl", null);');

$.templates({
"scriptTmpl": {
Expand All @@ -161,7 +161,7 @@ test("templates", function() {
debug:true
}
});
equal($.templates.tmplFromString.fn.toString().indexOf("debugger;") > 0 && $.templates.scriptTmpl.fn.toString().indexOf("debugger;") > 0, true, 'Debug a template: set debug:true on object');
equal($.templates.tmplFromString.fn.toString().indexOf("debugger;") > 0 && $.templates.scriptTmpl.fn.toString().indexOf("debugger;") > 0, true, 'Debug a template: set debug:true on object');

// reset
$("#my_tmpl")[0].removeAttribute("data-jsv-tmpl");
Expand Down Expand Up @@ -234,7 +234,7 @@ test("helpers", 3, function() {
equal($.views.helpers.concat === concat, true, 'concatFunction === $.views.helpers.concat');

$.views.helpers("concat2", null);
equal($.views.helpers.concat2, undefined, 'Remove a registered helper: $.views.helpers({ concat: null })');
equal($.views.helpers.concat2, undefined, 'Remove a registered helper: $.views.helpers({ concat: null })');
});

test("template encapsulation", 1, function() {
Expand Down
2 changes: 1 addition & 1 deletion tmplify/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JsRender tmplify submodule v0.9.73 (Beta): http://jsviews.com/#jsrender */
/*! JsRender tmplify submodule v0.9.74 (Beta): http://jsviews.com/#jsrender */
/*! Browserify transform for JsRender templates */
/*
* Copyright 2016, Boris Moore
Expand Down

0 comments on commit f984e13

Please sign in to comment.