That went well. (rollback changes to backbone, backbone-relational, and handlebars.runtime to not break every possible thing)

This commit is contained in:
Carl Eberhard
2013-04-02 14:41:29 -04:00
parent 6a1acc2288
commit c8cfcc2fb3
6 changed files with 1435 additions and 1727 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+13 -31
View File
@@ -1,11 +1,7 @@
// lib/handlebars/base.js
var Handlebars = {};
/*jshint eqnull:true*/
this.Handlebars = {};
(function(Handlebars) {
Handlebars.VERSION = "1.0.rc.1";
Handlebars.VERSION = "1.0.beta.6";
Handlebars.helpers = {};
Handlebars.partials = {};
@@ -44,36 +40,25 @@ Handlebars.registerHelper('blockHelperMissing', function(context, options) {
return inverse(this);
} else if(type === "[object Array]") {
if(context.length > 0) {
return Handlebars.helpers.each(context, options);
for(var i=0, j=context.length; i<j; i++) {
ret = ret + fn(context[i]);
}
} else {
return inverse(this);
ret = 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 = "", data;
if (options.data) {
data = Handlebars.createFrame(options.data);
}
var ret = "";
if(context && context.length > 0) {
for(var i=0, j=context.length; i<j; i++) {
if (data) { data.index = i; }
ret = ret + fn(context[i], { data: data });
ret = ret + fn(context[i]);
}
} else {
ret = inverse(this);
@@ -107,8 +92,6 @@ Handlebars.registerHelper('with', function(context, options) {
Handlebars.registerHelper('log', function(context) {
Handlebars.log(context);
});
}(this.Handlebars));
;
// lib/handlebars/utils.js
Handlebars.Exception = function(message) {
@@ -120,7 +103,7 @@ Handlebars.Exception = function(message) {
this.message = tmp.message;
};
Handlebars.Exception.prototype = new Error();
Handlebars.Exception.prototype = new Error;
// Build out our basic SafeString type
Handlebars.SafeString = function(string) {
@@ -132,7 +115,6 @@ Handlebars.SafeString.prototype.toString = function() {
(function() {
var escape = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
@@ -140,7 +122,7 @@ Handlebars.SafeString.prototype.toString = function() {
"`": "&#x60;"
};
var badChars = /[&<>"'`]/g;
var badChars = /&(?!\w+;)|[<>"'`]/g;
var possible = /[&<>"'`]/;
var escapeChar = function(chr) {
@@ -222,7 +204,7 @@ Handlebars.VM = {
},
noop: function() { return ""; },
invokePartial: function(partial, name, context, helpers, partials, data) {
var options = { helpers: helpers, partials: partials, data: data };
options = { helpers: helpers, partials: partials, data: data };
if(partial === undefined) {
throw new Handlebars.Exception("The partial " + name + " could not be found");
@@ -231,7 +213,7 @@ Handlebars.VM = {
} 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, {data: data !== undefined});
partials[name] = Handlebars.compile(partial);
return partials[name](context, options);
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
this.Handlebars={};(function(c){c.VERSION="1.0.rc.1";c.helpers={};c.partials={};c.registerHelper=function(e,f,d){if(d){f.not=d}this.helpers[e]=f};c.registerPartial=function(d,e){this.partials[d]=e};c.registerHelper("helperMissing",function(d){if(arguments.length===2){return undefined}else{throw new Error("Could not find property '"+d+"'")}});var a=Object.prototype.toString,b="[object Function]";c.registerHelper("blockHelperMissing",function(g,f){var d=f.inverse||function(){},i=f.fn;var e="";var h=a.call(g);if(h===b){g=g.call(this)}if(g===true){return i(this)}else{if(g===false||g==null){return d(this)}else{if(h==="[object Array]"){if(g.length>0){return c.helpers.each(g,f)}else{return d(this)}}else{return i(g)}}}});c.K=function(){};c.createFrame=Object.create||function(d){c.K.prototype=d;var e=new c.K();c.K.prototype=null;return e};c.registerHelper("each",function(k,g){var l=g.fn,d=g.inverse;var f="",m;if(g.data){m=c.createFrame(g.data)}if(k&&k.length>0){for(var h=0,e=k.length;h<e;h++){if(m){m.index=h}f=f+l(k[h],{data:m})}}else{f=d(this)}return f});c.registerHelper("if",function(e,d){var f=a.call(e);if(f===b){e=e.call(this)}if(!e||c.Utils.isEmpty(e)){return d.inverse(this)}else{return d.fn(this)}});c.registerHelper("unless",function(f,e){var g=e.fn,d=e.inverse;e.fn=d;e.inverse=g;return c.helpers["if"].call(this,f,e)});c.registerHelper("with",function(e,d){return d.fn(e)});c.registerHelper("log",function(d){c.log(d)})}(this.Handlebars));Handlebars.Exception=function(b){var a=Error.prototype.constructor.apply(this,arguments);for(var c in a){if(a.hasOwnProperty(c)){this[c]=a[c]}}this.message=a.message};Handlebars.Exception.prototype=new Error();Handlebars.SafeString=function(a){this.string=a};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};(function(){var c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var d=/[&<>"'`]/g;var b=/[&<>"'`]/;var a=function(e){return c[e]||"&amp;"};Handlebars.Utils={escapeExpression:function(e){if(e instanceof Handlebars.SafeString){return e.toString()}else{if(e==null||e===false){return""}}if(!b.test(e)){return e}return e.replace(d,a)},isEmpty:function(e){if(typeof e==="undefined"){return true}else{if(e===null){return true}else{if(e===false){return true}else{if(Object.prototype.toString.call(e)==="[object Array]"&&e.length===0){return true}else{return false}}}}}}})();Handlebars.VM={template:function(a){var b={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(d,e,f){var c=this.programs[d];if(f){return Handlebars.VM.program(e,f)}else{if(c){return c}else{c=this.programs[d]=Handlebars.VM.program(e);return c}}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(d,c){c=c||{};return a.call(b,Handlebars,d,c.helpers,c.partials,c.data)}},programWithDepth:function(b,d,c){var a=Array.prototype.slice.call(arguments,2);return function(f,e){e=e||{};return b.apply(this,[f,e.data||d].concat(a))}},program:function(a,b){return function(d,c){c=c||{};return a(d,c.data||b)}},noop:function(){return""},invokePartial:function(a,c,e,f,d,g){var b={helpers:f,partials:d,data:g};if(a===undefined){throw new Handlebars.Exception("The partial "+c+" could not be found")}else{if(a instanceof Function){return a(e,b)}else{if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+c+" could not be compiled when running in runtime-only mode")}else{d[c]=Handlebars.compile(a,{data:g!==undefined});return d[c](e,b)}}}}};Handlebars.template=Handlebars.VM.template;
var Handlebars={};Handlebars.VERSION="1.0.beta.6";Handlebars.helpers={};Handlebars.partials={};Handlebars.registerHelper=function(b,c,a){if(a){c.not=a}this.helpers[b]=c};Handlebars.registerPartial=function(a,b){this.partials[a]=b};Handlebars.registerHelper("helperMissing",function(a){if(arguments.length===2){return undefined}else{throw new Error("Could not find property '"+a+"'")}});var toString=Object.prototype.toString,functionType="[object Function]";Handlebars.registerHelper("blockHelperMissing",function(f,d){var a=d.inverse||function(){},h=d.fn;var c="";var g=toString.call(f);if(g===functionType){f=f.call(this)}if(f===true){return h(this)}else{if(f===false||f==null){return a(this)}else{if(g==="[object Array]"){if(f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+h(f[e])}}else{c=a(this)}return c}else{return h(f)}}}});Handlebars.registerHelper("each",function(f,d){var g=d.fn,a=d.inverse;var c="";if(f&&f.length>0){for(var e=0,b=f.length;e<b;e++){c=c+g(f[e])}}else{c=a(this)}return c});Handlebars.registerHelper("if",function(b,a){var c=toString.call(b);if(c===functionType){b=b.call(this)}if(!b||Handlebars.Utils.isEmpty(b)){return a.inverse(this)}else{return a.fn(this)}});Handlebars.registerHelper("unless",function(c,b){var d=b.fn,a=b.inverse;b.fn=a;b.inverse=d;return Handlebars.helpers["if"].call(this,c,b)});Handlebars.registerHelper("with",function(b,a){return a.fn(b)});Handlebars.registerHelper("log",function(a){Handlebars.log(a)});Handlebars.Exception=function(b){var a=Error.prototype.constructor.apply(this,arguments);for(var c in a){if(a.hasOwnProperty(c)){this[c]=a[c]}}this.message=a.message};Handlebars.Exception.prototype=new Error;Handlebars.SafeString=function(a){this.string=a};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};(function(){var c={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};var d=/&(?!\w+;)|[<>"'`]/g;var b=/[&<>"'`]/;var a=function(e){return c[e]||"&amp;"};Handlebars.Utils={escapeExpression:function(e){if(e instanceof Handlebars.SafeString){return e.toString()}else{if(e==null||e===false){return""}}if(!b.test(e)){return e}return e.replace(d,a)},isEmpty:function(e){if(typeof e==="undefined"){return true}else{if(e===null){return true}else{if(e===false){return true}else{if(Object.prototype.toString.call(e)==="[object Array]"&&e.length===0){return true}else{return false}}}}}}})();Handlebars.VM={template:function(a){var b={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(d,e,f){var c=this.programs[d];if(f){return Handlebars.VM.program(e,f)}else{if(c){return c}else{c=this.programs[d]=Handlebars.VM.program(e);return c}}},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(d,c){c=c||{};return a.call(b,Handlebars,d,c.helpers,c.partials,c.data)}},programWithDepth:function(b,d,c){var a=Array.prototype.slice.call(arguments,2);return function(f,e){e=e||{};return b.apply(this,[f,e.data||d].concat(a))}},program:function(a,b){return function(d,c){c=c||{};return a(d,c.data||b)}},noop:function(){return""},invokePartial:function(a,b,d,e,c,f){options={helpers:e,partials:c,data:f};if(a===undefined){throw new Handlebars.Exception("The partial "+b+" could not be found")}else{if(a instanceof Function){return a(d,options)}else{if(!Handlebars.compile){throw new Handlebars.Exception("The partial "+b+" could not be compiled when running in runtime-only mode")}else{c[b]=Handlebars.compile(a);return c[b](d,options)}}}}};Handlebars.template=Handlebars.VM.template;