diff --git a/packages/spacebars/compile_tests.js b/packages/spacebars/compile_tests.js index 2e7bb9a195..35a73564de 100644 --- a/packages/spacebars/compile_tests.js +++ b/packages/spacebars/compile_tests.js @@ -107,7 +107,7 @@ Tinytest.add("spacebars - compiler output", function (test) { function() { var self = this; return function() { - return Spacebars.include(UI.If2, { + return Spacebars.include(UI.If, { __content: UI.block(function() { var self = this; return "aaa"; @@ -147,7 +147,7 @@ Tinytest.add("spacebars - compiler output", function (test) { return function() { return Spacebars.include(Template["foo"] || self.lookup("foo"), { data: function() { - return Spacebars.call2(Spacebars.dot(self.lookup("bar"), "baz")); + return Spacebars.call(Spacebars.dot(self.lookup("bar"), "baz")); } }); }; @@ -159,7 +159,7 @@ Tinytest.add("spacebars - compiler output", function (test) { return function() { return Spacebars.include(Template["foo"] || self.lookup("foo"), { x: function() { - return Spacebars.call2(Spacebars.dot(self.lookup("bar"), "baz")); + return Spacebars.call(Spacebars.dot(self.lookup("bar"), "baz")); } }); }; @@ -178,7 +178,7 @@ Tinytest.add("spacebars - compiler output", function (test) { return "aaa"; }), data: function() { - return Spacebars.call2(self.lookup("bar"), self.lookup("baz")); + return Spacebars.call(self.lookup("bar"), self.lookup("baz")); } }); }; @@ -194,7 +194,7 @@ Tinytest.add("spacebars - compiler output", function (test) { return "aaa"; }), data: function() { - return Spacebars.call2( + return Spacebars.call( Spacebars.dot(self.lookup("p"), "q"), Spacebars.dot(self.lookup("r"), "s")); } diff --git a/packages/spacebars/spacebars.js b/packages/spacebars/spacebars.js index 46dc9ec6f7..475461df3e 100644 --- a/packages/spacebars/spacebars.js +++ b/packages/spacebars/spacebars.js @@ -576,10 +576,10 @@ var optimize = function (tree) { var builtInComponents = { 'content': '__content', 'elseContent': '__elseContent', - 'if': 'UI.If2', - 'unless': 'UI.Unless2', - 'with': 'UI.With2', - 'each': 'UI.Each2' + 'if': 'UI.If', + 'unless': 'UI.Unless', + 'with': 'UI.With', + 'each': 'UI.Each' }; var replaceSpecials = function (node) { @@ -609,7 +609,7 @@ var replaceSpecials = function (node) { } else if (tag.type === 'INCLUSION' || tag.type === 'BLOCKOPEN') { // XXX handle more stuff var path = tag.path; - var compCode = codeGenPath2(path); + var compCode = codeGenPath(path); if (path.length === 1) { var compName = path[0]; @@ -674,7 +674,7 @@ var codeGenInclusionArgs = function (tag) { break; case 'PATH': var path = argValue; - argCode = codeGenPath2(path); + argCode = codeGenPath(path); // a single-segment path will compile to something like // `self.lookup("foo")` which never establishes any dependencies, // while `Spacebars.dot(self.lookup("foo"), "bar")` may establish @@ -682,7 +682,7 @@ var codeGenInclusionArgs = function (tag) { // // In the multi-positional-arg construct, don't wrap pos args here. if (! ((path.length === 1) || (numPosArgs > 1))) - argCode = 'function () { return Spacebars.call2(' + argCode + '); }'; + argCode = 'function () { return Spacebars.call(' + argCode + '); }'; break; default: // can't get here @@ -708,7 +708,7 @@ var codeGenInclusionArgs = function (tag) { // checked at parse time); call first // argument as a function on the others args = (args || {}); - args.data = 'function () { return Spacebars.call2(' + posArgs.join(', ') + '); }'; + args.data = 'function () { return Spacebars.call(' + posArgs.join(', ') + '); }'; } if (args) @@ -899,7 +899,7 @@ Spacebars.mustacheImpl = function (value/*, args*/) { } } - return Spacebars.call2.apply(null, args); + return Spacebars.call.apply(null, args); }; Spacebars.mustache = function (value/*, args*/) { @@ -944,7 +944,7 @@ Spacebars.makeRaw = function (value) { // evaluating the args themselves (by calling them if they are // functions). Otherwise, simply return `value` (and assert that // there are no args). -Spacebars.call2 = function (value/*, args*/) { +Spacebars.call = function (value/*, args*/) { if (typeof value === 'function') { // evaluate arguments if they are functions (by calling them) var newArgs = []; @@ -963,8 +963,8 @@ Spacebars.call2 = function (value/*, args*/) { }; var codeGenMustache = function (tag, mustacheType) { - var nameCode = codeGenPath2(tag.path); - var argCode = codeGenArgs2(tag.args); + var nameCode = codeGenPath(tag.path); + var argCode = codeGenArgs(tag.args); var mustache = (mustacheType || 'mustache'); return 'Spacebars.' + mustache + '(' + nameCode + @@ -1034,7 +1034,7 @@ Spacebars._beautify = beautify; // (i.e. it may invalidate the current computation). // // No code is generated to call the result if it's a function. -var codeGenPath2 = function (path) { +var codeGenPath = function (path) { var code = 'self.lookup(' + toJSLiteral(path[0]) + ')'; if (path.length > 1) { @@ -1047,7 +1047,7 @@ var codeGenPath2 = function (path) { // returns: array of source strings, or null if no // args at all. -var codeGenArgs2 = function (tagArgs) { +var codeGenArgs = function (tagArgs) { var kwArgs = null; // source -> source var args = null; // [source] @@ -1064,7 +1064,7 @@ var codeGenArgs2 = function (tagArgs) { argCode = toJSLiteral(argValue); break; case 'PATH': - argCode = codeGenPath2(argValue); + argCode = codeGenPath(argValue); break; default: // can't get here diff --git a/packages/ui/attrs.js b/packages/ui/attrs.js index 64e580acc5..9def157164 100644 --- a/packages/ui/attrs.js +++ b/packages/ui/attrs.js @@ -22,12 +22,12 @@ // AttributeHandlers can't influence how attributes appear in rendered HTML, // only how they are updated after materialization as DOM. -AttributeHandler2 = function (name, value) { +AttributeHandler = function (name, value) { this.name = name; this.value = value; }; -_extend(AttributeHandler2.prototype, { +_extend(AttributeHandler.prototype, { update: function (element, oldValue, value) { if (value === null) { if (oldValue !== null) @@ -38,10 +38,10 @@ _extend(AttributeHandler2.prototype, { } }); -AttributeHandler2.extend = function (options) { +AttributeHandler.extend = function (options) { var curType = this; var subType = function AttributeHandlerSubtype(/*arguments*/) { - AttributeHandler2.apply(this, arguments); + AttributeHandler.apply(this, arguments); }; subType.prototype = new curType; subType.extend = curType.extend; @@ -51,7 +51,7 @@ AttributeHandler2.extend = function (options) { }; // Value of a ClassHandler is either a string or an array. -var ClassHandler2 = AttributeHandler2.extend({ +var ClassHandler = AttributeHandler.extend({ update: function (element, oldValue, value) { var oldClasses = oldValue ? _.compact(oldValue.split(' ')) : []; var newClasses = value ? _.compact(value.split(' ')) : []; @@ -74,7 +74,7 @@ var ClassHandler2 = AttributeHandler2.extend({ } }); -var SelectedHandler2 = AttributeHandler2.extend({ +var SelectedHandler = AttributeHandler.extend({ update: function (element, oldValue, value) { if (value == null) { if (oldValue != null) @@ -86,14 +86,14 @@ var SelectedHandler2 = AttributeHandler2.extend({ }); // XXX make it possible for users to register attribute handlers! -makeAttributeHandler2 = function (name, value) { +makeAttributeHandler = function (name, value) { // XXX will need one for 'style' on IE, though modern browsers // seem to handle setAttribute ok. if (name === 'class') { - return new ClassHandler2(name, value); + return new ClassHandler(name, value); } else if (name === 'selected') { - return new SelectedHandler2(name, value); + return new SelectedHandler(name, value); } else { - return new AttributeHandler2(name, value); + return new AttributeHandler(name, value); } }; diff --git a/packages/ui/components.js b/packages/ui/components.js index aa04732e18..ac42dc35ac 100644 --- a/packages/ui/components.js +++ b/packages/ui/components.js @@ -1,5 +1,5 @@ -UI.If2 = Component.extend({ +UI.If = Component.extend({ kind: 'If', init: function () { // XXX this probably deserves a better explanation if this code is @@ -48,7 +48,7 @@ var getCondition = function (self) { }); }; -UI.Unless2 = Component.extend({ +UI.Unless = Component.extend({ kind: 'Unless', init: function () { this.condition = this.data; @@ -63,7 +63,7 @@ UI.Unless2 = Component.extend({ } }); -UI.With2 = Component.extend({ +UI.With = Component.extend({ kind: 'With', init: function () { this.condition = this.data; diff --git a/packages/ui/each.js b/packages/ui/each.js index ae9a5bd220..b81416a1cc 100644 --- a/packages/ui/each.js +++ b/packages/ui/each.js @@ -1,4 +1,4 @@ -UI.Each2 = Component.extend({ +UI.Each = Component.extend({ typeName: 'Each', init: function () { // don't keep `this.data` around so that `{{..}}` skips over this diff --git a/packages/ui/render.js b/packages/ui/render.js index a66058676b..4d98bf6a79 100644 --- a/packages/ui/render.js +++ b/packages/ui/render.js @@ -216,7 +216,7 @@ var updateAttributes = function(elem, newAttrs, handlers) { if (value !== null) { // make new handler checkAttributeName(k); - handler = makeAttributeHandler2(k, value); + handler = makeAttributeHandler(k, value); if (handlers) handlers[k] = handler; oldValue = null;