1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ddff105aef47/ Changeset: ddff105aef47 User: carlfeberhard Date: 2013-04-03 23:15:05 Summary: update handlebars.runtime.js 1.0.beta.6 -> 1.0.rc1 Affected #: 1 file diff -r ed15e6865e1e8d0648cd307f7026ac284da7553a -r ddff105aef47f4686480e9fdae22a5b0dd94fcf1 static/scripts/libs/handlebars.runtime.js --- a/static/scripts/libs/handlebars.runtime.js +++ b/static/scripts/libs/handlebars.runtime.js @@ -1,7 +1,11 @@ // lib/handlebars/base.js -var Handlebars = {}; -Handlebars.VERSION = "1.0.beta.6"; +/*jshint eqnull:true*/ +this.Handlebars = {}; + +(function(Handlebars) { + +Handlebars.VERSION = "1.0.rc.1"; Handlebars.helpers = {}; Handlebars.partials = {}; @@ -40,25 +44,36 @@ return inverse(this); } else if(type === "[object Array]") { if(context.length > 0) { - for(var i=0, j=context.length; i<j; i++) { - ret = ret + fn(context[i]); - } + return Handlebars.helpers.each(context, options); } else { - ret = inverse(this); + return inverse(this); } - return ret; } else { return fn(context); } }); +Handlebars.K = function() {}; + +Handlebars.createFrame = Object.create || function(object) { + Handlebars.K.prototype = object; + var obj = new Handlebars.K(); + Handlebars.K.prototype = null; + return obj; +}; + Handlebars.registerHelper('each', function(context, options) { var fn = options.fn, inverse = options.inverse; - var ret = ""; + var ret = "", data; + + if (options.data) { + data = Handlebars.createFrame(options.data); + } if(context && context.length > 0) { for(var i=0, j=context.length; i<j; i++) { - ret = ret + fn(context[i]); + if (data) { data.index = i; } + ret = ret + fn(context[i], { data: data }); } } else { ret = inverse(this); @@ -92,6 +107,8 @@ Handlebars.registerHelper('log', function(context) { Handlebars.log(context); }); + +}(this.Handlebars)); ; // lib/handlebars/utils.js Handlebars.Exception = function(message) { @@ -103,7 +120,7 @@ this.message = tmp.message; }; -Handlebars.Exception.prototype = new Error; +Handlebars.Exception.prototype = new Error(); // Build out our basic SafeString type Handlebars.SafeString = function(string) { @@ -115,6 +132,7 @@ (function() { var escape = { + "&": "&", "<": "<", ">": ">", '"': """, @@ -122,7 +140,7 @@ "`": "`" }; - var badChars = /&(?!\w+;)|[<>"'`]/g; + var badChars = /[&<>"'`]/g; var possible = /[&<>"'`]/; var escapeChar = function(chr) { @@ -204,7 +222,7 @@ }, noop: function() { return ""; }, invokePartial: function(partial, name, context, helpers, partials, data) { - options = { helpers: helpers, partials: partials, data: data }; + var options = { helpers: helpers, partials: partials, data: data }; if(partial === undefined) { throw new Handlebars.Exception("The partial " + name + " could not be found"); @@ -213,7 +231,7 @@ } else if (!Handlebars.compile) { throw new Handlebars.Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); } else { - partials[name] = Handlebars.compile(partial); + partials[name] = Handlebars.compile(partial, {data: data !== undefined}); return partials[name](context, options); } } Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.