Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Trim down some unnecessarily long string literals

  • Loading branch information...
commit afbbf248869900141f8634dd9a9dc0ae12b09066 1 parent df9acea
@SteveSanderson SteveSanderson authored
View
4 src/binding/defaultBindings.js
@@ -59,7 +59,7 @@ ko.bindingHandlers['event'] = {
ko.bindingHandlers['submit'] = {
'init': function (element, valueAccessor, allBindingsAccessor, viewModel) {
if (typeof valueAccessor() != "function")
- throw new Error("The value for a submit binding must be a function to invoke on submit");
+ throw new Error("The value for a submit binding must be a function");
ko.utils.registerEventHandler(element, "submit", function (event) {
var handlerReturnValue;
var value = valueAccessor();
@@ -267,7 +267,7 @@ ko.bindingHandlers['options'] = {
}
}
};
-ko.bindingHandlers['options'].optionValueDomDataKey = '__ko.bindingHandlers.options.optionValueDomData__';
+ko.bindingHandlers['options'].optionValueDomDataKey = '__ko.optionValueDomData__';
ko.bindingHandlers['selectedOptions'] = {
getSelectedValuesFromSelectNode: function (selectNode) {
View
6 src/templating/templateEngine.js
@@ -27,11 +27,11 @@
ko.templateEngine = function () { };
ko.templateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options) {
- throw "Override renderTemplateSource in your ko.templateEngine subclass";
+ throw "Override renderTemplateSource";
};
ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script) {
- throw "Override createJavaScriptEvaluatorBlock in your ko.templateEngine subclass";
+ throw "Override createJavaScriptEvaluatorBlock";
};
ko.templateEngine.prototype['makeTemplateSource'] = function(template) {
@@ -45,7 +45,7 @@ ko.templateEngine.prototype['makeTemplateSource'] = function(template) {
// Anonymous template
return new ko.templateSources.anonymousTemplate(template);
} else
- throw new Error("Unrecognised template type: " + template);
+ throw new Error("Unknown template type: " + template);
};
ko.templateEngine.prototype['renderTemplate'] = function (template, bindingContext, options) {
View
42 src/utils.js
@@ -398,25 +398,29 @@ ko.utils = new (function () {
})();
ko.exportSymbol('ko.utils', ko.utils);
-ko.exportSymbol('ko.utils.arrayForEach', ko.utils.arrayForEach);
-ko.exportSymbol('ko.utils.arrayFirst', ko.utils.arrayFirst);
-ko.exportSymbol('ko.utils.arrayFilter', ko.utils.arrayFilter);
-ko.exportSymbol('ko.utils.arrayGetDistinctValues', ko.utils.arrayGetDistinctValues);
-ko.exportSymbol('ko.utils.arrayIndexOf', ko.utils.arrayIndexOf);
-ko.exportSymbol('ko.utils.arrayMap', ko.utils.arrayMap);
-ko.exportSymbol('ko.utils.arrayPushAll', ko.utils.arrayPushAll);
-ko.exportSymbol('ko.utils.arrayRemoveItem', ko.utils.arrayRemoveItem);
-ko.exportSymbol('ko.utils.extend', ko.utils.extend);
-ko.exportSymbol('ko.utils.fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost);
-ko.exportSymbol('ko.utils.getFormFields', ko.utils.getFormFields);
-ko.exportSymbol('ko.utils.postJson', ko.utils.postJson);
-ko.exportSymbol('ko.utils.parseJson', ko.utils.parseJson);
-ko.exportSymbol('ko.utils.registerEventHandler', ko.utils.registerEventHandler);
-ko.exportSymbol('ko.utils.stringifyJson', ko.utils.stringifyJson);
-ko.exportSymbol('ko.utils.range', ko.utils.range);
-ko.exportSymbol('ko.utils.toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass);
-ko.exportSymbol('ko.utils.triggerEvent', ko.utils.triggerEvent);
-ko.exportSymbol('ko.utils.unwrapObservable', ko.utils.unwrapObservable);
+ko.utils.arrayForEach([
+ ['arrayForEach', ko.utils.arrayForEach],
+ ['arrayFirst', ko.utils.arrayFirst],
+ ['arrayFilter', ko.utils.arrayFilter],
+ ['arrayGetDistinctValues', ko.utils.arrayGetDistinctValues],
+ ['arrayIndexOf', ko.utils.arrayIndexOf],
+ ['arrayMap', ko.utils.arrayMap],
+ ['arrayPushAll', ko.utils.arrayPushAll],
+ ['arrayRemoveItem', ko.utils.arrayRemoveItem],
+ ['extend', ko.utils.extend],
+ ['fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost],
+ ['getFormFields', ko.utils.getFormFields],
+ ['postJson', ko.utils.postJson],
+ ['parseJson', ko.utils.parseJson],
+ ['registerEventHandler', ko.utils.registerEventHandler],
+ ['stringifyJson', ko.utils.stringifyJson],
+ ['range', ko.utils.range],
+ ['toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass],
+ ['triggerEvent', ko.utils.triggerEvent],
+ ['unwrapObservable', ko.utils.unwrapObservable]
+], function(item) {
+ ko.exportSymbol('ko.utils.' + item[0], item[1]);
+});
if (!Function.prototype['bind']) {
// Function.prototype.bind is a standard part of ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf)
Please sign in to comment.
Something went wrong with that request. Please try again.