Skip to content

Commit 08009b6

Browse files
committed
Update JavaScript Templates to 2.4.1
1 parent e9a1a96 commit 08009b6

File tree

1 file changed

+9
-8
lines changed
  • vendor/assets/javascripts/jquery-fileupload/vendor

1 file changed

+9
-8
lines changed

vendor/assets/javascripts/jquery-fileupload/vendor/tmpl.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* JavaScript Templates 2.1.0
2+
* JavaScript Templates 2.4.1
33
* https://github.com/blueimp/JavaScript-Templates
44
*
55
* Copyright 2011, Sebastian Tschan
@@ -12,7 +12,7 @@
1212
* http://ejohn.org/blog/javascript-micro-templating/
1313
*/
1414

15-
/*jslint evil: true, regexp: true */
15+
/*jslint evil: true, regexp: true, unparam: true */
1616
/*global document, define */
1717

1818
(function ($) {
@@ -34,21 +34,21 @@
3434
tmpl.load = function (id) {
3535
return document.getElementById(id).innerHTML;
3636
};
37-
tmpl.regexp = /([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;
37+
tmpl.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;
3838
tmpl.func = function (s, p1, p2, p3, p4, p5) {
39-
if (p1) { // whitespace, quote and backspace in interpolation context
39+
if (p1) { // whitespace, quote and backspace in HTML context
4040
return {
4141
"\n": "\\n",
4242
"\r": "\\r",
4343
"\t": "\\t",
4444
" " : " "
45-
}[s] || "\\" + s;
45+
}[p1] || "\\" + p1;
4646
}
4747
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
4848
if (p2 === "=") {
4949
return "'+_e(" + p3 + ")+'";
5050
}
51-
return "'+(" + p3 + "||'')+'";
51+
return "'+(" + p3 + "==null?'':" + p3 + ")+'";
5252
}
5353
if (p4) { // evaluation start tag: {%
5454
return "';";
@@ -66,15 +66,16 @@
6666
"'" : "'"
6767
};
6868
tmpl.encode = function (s) {
69-
return String(s || "").replace(
69+
/*jshint eqnull:true */
70+
return (s == null ? "" : "" + s).replace(
7071
tmpl.encReg,
7172
function (c) {
7273
return tmpl.encMap[c] || "";
7374
}
7475
);
7576
};
7677
tmpl.arg = "o";
77-
tmpl.helper = ",print=function(s,e){_s+=e&&(s||'')||_e(s);}" +
78+
tmpl.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}" +
7879
",include=function(s,d){_s+=tmpl(s,d);}";
7980
if (typeof define === "function" && define.amd) {
8081
define(function () {

0 commit comments

Comments
 (0)