From 1d12b5fa3c110034213a50b4a36325cafcc7621c Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Wed, 14 Dec 2011 00:55:50 +0000 Subject: [PATCH] Update version header to 2.0.0rc and rebuild --- build/output/knockout-latest.debug.js | 59 ++++++++++-------- build/output/knockout-latest.js | 87 +++++++++++++-------------- build/version-header.js | 2 +- 3 files changed, 77 insertions(+), 71 deletions(-) diff --git a/build/output/knockout-latest.debug.js b/build/output/knockout-latest.debug.js index 6b6d78d02..fb075af8f 100644 --- a/build/output/knockout-latest.debug.js +++ b/build/output/knockout-latest.debug.js @@ -1,4 +1,4 @@ -// Knockout JavaScript library v1.3.0rc +// Knockout JavaScript library v2.0.0rc // (c) Steven Sanderson - http://knockoutjs.com/ // License: MIT (http://www.opensource.org/licenses/mit-license.php) @@ -414,25 +414,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) @@ -1935,7 +1939,10 @@ ko.bindingHandlers['event'] = { var allBindings = allBindingsAccessor(); try { - handlerReturnValue = handlerFunction.apply(viewModel, arguments); + // Take all the event args, and prefix with the viewmodel + var argsForHandler = ko.utils.makeArray(arguments); + argsForHandler.unshift(viewModel); + handlerReturnValue = handlerFunction.apply(viewModel, argsForHandler); } finally { if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true. if (event.preventDefault) @@ -1961,7 +1968,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(); @@ -2169,7 +2176,7 @@ ko.bindingHandlers['options'] = { } } }; -ko.bindingHandlers['options'].optionValueDomDataKey = '__ko.bindingHandlers.options.optionValueDomData__'; +ko.bindingHandlers['options'].optionValueDomDataKey = '__ko.optionValueDomData__'; ko.bindingHandlers['selectedOptions'] = { getSelectedValuesFromSelectNode: function (selectNode) { @@ -2473,11 +2480,11 @@ ko.exportSymbol('ko.allowedVirtualElementBindings', ko.virtualElements.allowedBi 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) { @@ -2491,7 +2498,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) { diff --git a/build/output/knockout-latest.js b/build/output/knockout-latest.js index 145763a22..51d09720a 100644 --- a/build/output/knockout-latest.js +++ b/build/output/knockout-latest.js @@ -1,4 +1,4 @@ -// Knockout JavaScript library v1.3.0rc +// Knockout JavaScript library v2.0.0rc // (c) Steven Sanderson - http://knockoutjs.com/ // License: MIT (http://www.opensource.org/licenses/mit-license.php) @@ -6,67 +6,67 @@ function c(a){throw a;}var l=void 0,m=!0,o=null,p=!1,r=window.ko={};r.b=function(a,b){for(var d=a.split("."),e=window,f=0;f",b[0];);return 4r.a.k(e,a[b])&&e.push(a[b]);return e},aa:function(a,e){for(var a=a||[],b=[],f=0,d=a.length;fr.a.k(e,a[b])&&e.push(a[b]);return e},ba:function(a,e){for(var a=a||[],b=[],f=0,d=a.length;fa.length?p:a.substring(0,e.length)===e},gb:function(a){for(var e=Array.prototype.slice.call(arguments,1),b="return ("+a+")",f=0;f",""]||!d.indexOf("",""]||(!d.indexOf("",""]||[0,"",""];a="ignored
"+ -d[1]+a+d[2]+"
";for("function"==typeof window.innerShiv?b.appendChild(window.innerShiv(a)):b.innerHTML=a;d[0]--;)b=b.lastChild;b=r.a.ja(b.lastChild.childNodes)}return b};r.a.Y=function(a,b){r.a.U(a);if(b!==o&&b!==l)if("string"!=typeof b&&(b=b.toString()),"undefined"!=typeof jQuery)jQuery(a).html(b);else for(var d=r.a.ma(b),e=0;e";for("function"==typeof window.innerShiv?b.appendChild(window.innerShiv(a)):b.innerHTML=a;d[0]--;)b=b.lastChild;b=r.a.X(b.lastChild.childNodes)}return b};r.a.Z=function(a,b){r.a.U(a);if(b!==o&&b!==l)if("string"!=typeof b&&(b=b.toString()),"undefined"!=typeof jQuery)jQuery(a).html(b);else for(var d=r.a.ma(b),e=0;e"},Qa:function(a,b){var h=d[a];h===l&&c(Error("Couldn't find any memo with ID "+ a+". Perhaps it's already been unmemoized."));try{return h.apply(o,b||[]),m}finally{delete d[a]}},Ra:function(a,f){var d=[];b(a,d);for(var g=0,i=d.length;gb;b++)a=a();return a})};r.toJSON=function(a){a=r.Oa(a);return r.a.qa(a)}})();r.b("ko.toJS",r.Oa);r.b("ko.toJSON",r.toJSON); r.h={q:function(a){return"OPTION"==a.tagName?a.__ko__hasDomDataOptionValue__===m?r.a.e.get(a,r.c.options.la):a.getAttribute("value"):"SELECT"==a.tagName?0<=a.selectedIndex?r.h.q(a.options[a.selectedIndex]):l:a.value},S:function(a,b){if("OPTION"==a.tagName)switch(typeof b){case "string":case "number":r.a.e.set(a,r.c.options.la,l);"__ko__hasDomDataOptionValue__"in a&&delete a.__ko__hasDomDataOptionValue__;a.value=b;break;default:r.a.e.set(a,r.c.options.la,b),a.__ko__hasDomDataOptionValue__=m,a.value= ""}else if("SELECT"==a.tagName)for(var d=a.options.length-1;0<=d;d--){if(r.h.q(a.options[d])==b){a.selectedIndex=d;break}}else{if(b===o||b===l)b="";a.value=b}}};r.b("ko.selectExtensions",r.h);r.b("ko.selectExtensions.readValue",r.h.q);r.b("ko.selectExtensions.writeValue",r.h.S); -r.j=function(){function a(a,e){for(var d=o;a!=d;)d=a,a=a.replace(b,function(a,b){return e[b]});return a}var b=/\@ko_token_(\d+)\@/g,d=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,e=["true","false"];return{D:[],X:function(b){var e=r.a.z(b);if(3>e.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-1));for(var b=[],d=o,i,j=0;je.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-1));for(var b=[],d=o,i,j=0;j$/: -/^\s*ko\s+(.*\:.*)\s*$/,g=f?/^<\!--\s*\/ko\s*--\>$/:/^\s*\/ko\s*$/,i={ul:m,ol:m};r.f={C:{},childNodes:function(b){return a(b)?d(b):b.childNodes},ga:function(b){if(a(b))for(var b=r.f.childNodes(b),e=0,d=b.length;e$/:/^\s*\/ko\s*$/,i={ul:m,ol:m};r.f={C:{},childNodes:function(b){return a(b)?d(b):b.childNodes},ha:function(b){if(a(b))for(var b=r.f.childNodes(b),e=0,d=b.length;e"),p)}};r.c.uniqueName.Ya=0; r.c.checked={init:function(a,b,d){r.a.s(a,"click",function(){var e;if("checkbox"==a.type)e=a.checked;else if("radio"==a.type&&a.checked)e=a.value;else return;var f=b();"checkbox"==a.type&&r.a.d(f)instanceof Array?(e=r.a.k(r.a.d(f),a.value),a.checked&&0>e?f.push(a.value):!a.checked&&0<=e&&f.splice(e,1)):r.P(f)?f()!==e&&f(e):(f=d(),f._ko_property_writers&&f._ko_property_writers.checked&&f._ko_property_writers.checked(e))});"radio"==a.type&&!a.name&&r.c.uniqueName.init(a,function(){return m})},update:function(a, b){var d=r.a.d(b());if("checkbox"==a.type)a.checked=d instanceof Array?0<=r.a.k(d,a.value):d;else if("radio"==a.type)a.checked=a.value==d}};r.c.attr={update:function(a,b){var d=r.a.d(b())||{},e;for(e in d)if("string"==typeof e){var f=r.a.d(d[e]);f===p||f===o||f===l?a.removeAttribute(e):a.setAttribute(e,f.toString())}}}; @@ -74,26 +74,25 @@ r.c.hasfocus={init:function(a,b,d){function e(a){var e=b();a!=r.a.d(e)&&(r.P(e)? r.c["with"]={o:function(a){return function(){var b=a();return{"if":b,data:b,templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c["with"].o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c["with"].o(b),d,e,f)}};r.j.D["with"]=p;r.f.C["with"]=m;r.c["if"]={o:function(a){return function(){return{"if":a(),templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c["if"].o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c["if"].o(b),d,e,f)}}; r.j.D["if"]=p;r.f.C["if"]=m;r.c.ifnot={o:function(a){return function(){return{ifnot:a(),templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c.ifnot.o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c.ifnot.o(b),d,e,f)}};r.j.D.ifnot=p;r.f.C.ifnot=m; r.c.foreach={o:function(a){return function(){var b=r.a.d(a());return!b||"number"==typeof b.length?{foreach:b,templateEngine:r.p.M}:{foreach:b.data,includeDestroyed:b.includeDestroyed,afterAdd:b.afterAdd,beforeRemove:b.beforeRemove,afterRender:b.afterRender,templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c.foreach.o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c.foreach.o(b),d,e,f)}};r.j.D.foreach=p;r.f.C.foreach=m;r.b("ko.allowedVirtualElementBindings",r.f.C); -r.t=function(){};r.t.prototype.renderTemplateSource=function(){c("Override renderTemplateSource in your ko.templateEngine subclass")};r.t.prototype.createJavaScriptEvaluatorBlock=function(){c("Override createJavaScriptEvaluatorBlock in your ko.templateEngine subclass")}; -r.t.prototype.makeTemplateSource=function(a){if("string"==typeof a){var b=document.getElementById(a);b||c(Error("Cannot find template with ID "+a));return new r.m.g(b)}if(1==a.nodeType||8==a.nodeType)return new r.m.I(a);c(Error("Unrecognised template type: "+a))};r.t.prototype.renderTemplate=function(a,b,d){return this.renderTemplateSource(this.makeTemplateSource(a),b,d)};r.t.prototype.isTemplateRewritten=function(a){return this.allowTemplateRewriting===p?m:this.W&&this.W[a]?m:this.makeTemplateSource(a).data("isRewritten")}; -r.t.prototype.rewriteTemplate=function(a,b){var d=this.makeTemplateSource(a),e=b(d.text());d.text(e);d.data("isRewritten",m);if("string"==typeof a)this.W=this.W||{},this.W[a]=m};r.b("ko.templateEngine",r.t); -r.Z=function(){function a(a,b,d){for(var a=r.j.X(a),g=r.j.D,i=0;i/g;return{fb:function(a,b){b.isTemplateRewritten(a)||b.rewriteTemplate(a,function(a){return r.Z.tb(a,b)})},tb:function(e,f){return e.replace(b,function(b,e,d,j,k,n,t){return a(t,e,f)}).replace(d,function(b,e){return a(e,"<\!-- ko --\>",f)})},Ta:function(a){return r.r.ka(function(b,d){b.nextSibling&&r.xa(b.nextSibling,a,d)})}}}();r.b("ko.templateRewriting",r.Z);r.b("ko.templateRewriting.applyMemoizedBindingsToNextSibling",r.Z.Ta);r.m={};r.m.g=function(a){this.g=a}; -r.m.g.prototype.text=function(){if(0==arguments.length)return"script"==this.g.tagName.toLowerCase()?this.g.text:this.g.innerHTML;var a=arguments[0];"script"==this.g.tagName.toLowerCase()?this.g.text=a:r.a.Y(this.g,a)};r.m.g.prototype.data=function(a){if(1===arguments.length)return r.a.e.get(this.g,"templateSourceData_"+a);r.a.e.set(this.g,"templateSourceData_"+a,arguments[1])};r.m.I=function(a){this.g=a};r.m.I.prototype=new r.m.g; +r.t=function(){};r.t.prototype.renderTemplateSource=function(){c("Override renderTemplateSource")};r.t.prototype.createJavaScriptEvaluatorBlock=function(){c("Override createJavaScriptEvaluatorBlock")};r.t.prototype.makeTemplateSource=function(a){if("string"==typeof a){var b=document.getElementById(a);b||c(Error("Cannot find template with ID "+a));return new r.m.g(b)}if(1==a.nodeType||8==a.nodeType)return new r.m.I(a);c(Error("Unknown template type: "+a))}; +r.t.prototype.renderTemplate=function(a,b,d){return this.renderTemplateSource(this.makeTemplateSource(a),b,d)};r.t.prototype.isTemplateRewritten=function(a){return this.allowTemplateRewriting===p?m:this.W&&this.W[a]?m:this.makeTemplateSource(a).data("isRewritten")};r.t.prototype.rewriteTemplate=function(a,b){var d=this.makeTemplateSource(a),e=b(d.text());d.text(e);d.data("isRewritten",m);if("string"==typeof a)this.W=this.W||{},this.W[a]=m};r.b("ko.templateEngine",r.t); +r.$=function(){function a(a,b,d){for(var a=r.j.Y(a),g=r.j.D,i=0;i/g;return{fb:function(a,b){b.isTemplateRewritten(a)||b.rewriteTemplate(a,function(a){return r.$.tb(a,b)})},tb:function(e,f){return e.replace(b,function(b,e,d,j,k,n,t){return a(t,e,f)}).replace(d,function(b,e){return a(e,"<\!-- ko --\>",f)})},Ta:function(a){return r.r.ka(function(b,d){b.nextSibling&&r.xa(b.nextSibling,a,d)})}}}();r.b("ko.templateRewriting",r.$);r.b("ko.templateRewriting.applyMemoizedBindingsToNextSibling",r.$.Ta);r.m={};r.m.g=function(a){this.g=a}; +r.m.g.prototype.text=function(){if(0==arguments.length)return"script"==this.g.tagName.toLowerCase()?this.g.text:this.g.innerHTML;var a=arguments[0];"script"==this.g.tagName.toLowerCase()?this.g.text=a:r.a.Z(this.g,a)};r.m.g.prototype.data=function(a){if(1===arguments.length)return r.a.e.get(this.g,"templateSourceData_"+a);r.a.e.set(this.g,"templateSourceData_"+a,arguments[1])};r.m.I=function(a){this.g=a};r.m.I.prototype=new r.m.g; r.m.I.prototype.text=function(){if(0==arguments.length)return r.a.e.get(this.g,"__ko_anon_template__");r.a.e.set(this.g,"__ko_anon_template__",arguments[0])};r.b("ko.templateSources",r.m);r.b("ko.templateSources.domElement",r.m.g);r.b("ko.templateSources.anonymousTemplate",r.m.I); -(function(){function a(a,b,d){for(var g=0;node=a[g];g++)node.parentNode===b&&(1===node.nodeType||8===node.nodeType)&&d(node)}function b(a,b,h,g,i){var i=i||{},j=i.templateEngine||d;r.Z.fb(h,j);h=j.renderTemplate(h,g,i);("number"!=typeof h.length||0a&&c(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));var h=d.data("precompiled");h||(h=d.text()||"",h=jQuery.template(o,"{{ko_with $item.koBindingContext}}"+h+"{{/ko_with}}"),d.data("precompiled",h)); -d=[e.$data];e=jQuery.extend({koBindingContext:e},f.templateOptions);e=jQuery.tmpl(h,d,e);e.appendTo(document.createElement("div"));jQuery.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){document.write("