Remove yet more 2s

This commit is contained in:
David Greenspan
2013-12-06 01:33:28 -08:00
parent 99a8a7b9a7
commit 18113d2194
6 changed files with 35 additions and 35 deletions

View File

@@ -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"));
}

View File

@@ -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

View File

@@ -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);
}
};

View File

@@ -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;

View File

@@ -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

View File

@@ -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;