Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Further fix needed for #287

  • Loading branch information...
commit a2c35d230794d1d54729d93edc037d2622ccddf7 1 parent 7da2a15
@SteveSanderson SteveSanderson authored
View
14 build/output/knockout-latest.debug.js
@@ -541,6 +541,20 @@ ko.utils.domNodeDisposal = new (function () {
// so notify it to tear down any resources associated with the node & descendants here.
if ((typeof jQuery == "function") && (typeof jQuery['cleanData'] == "function"))
jQuery['cleanData']([node]);
+
+ // Also clear any immediate-child comment nodes, as these wouldn't have been found by
+ // node.getElementsByTagName("*") in cleanNode() (comment nodes aren't elements)
+ if (cleanableNodeTypesWithDescendants[node.nodeType])
+ cleanImmediateCommentTypeChildren(node);
+ }
+
+ function cleanImmediateCommentTypeChildren(nodeWithChildren) {
+ var child, nextChild = nodeWithChildren.firstChild;
+ while (child = nextChild) {
+ nextChild = child.nextSibling;
+ if (child.nodeType === 8)
+ cleanSingleNode(child);
+ }
}
return {
View
52 build/output/knockout-latest.js
@@ -9,35 +9,35 @@ d={},e={};d[/Firefox\/2/i.test(navigator.userAgent)?"KeyboardEvent":"UIEvents"]=
/^__RequestVerificationToken(_.*)?$/],q:function(a,b){for(var e=0,c=a.length;e<c;e++)b(a[e])},i:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var e=0,c=a.length;e<c;e++)if(a[e]===b)return e;return-1},Ya:function(a,b,e){for(var c=0,f=a.length;c<f;c++)if(b.call(e,a[c]))return a[c];return p},ba:function(b,e){var c=a.a.i(b,e);0<=c&&b.splice(c,1)},ya:function(b){for(var b=b||[],e=[],c=0,f=b.length;c<f;c++)0>a.a.i(e,b[c])&&e.push(b[c]);return e},
U:function(a,b){for(var a=a||[],e=[],c=0,f=a.length;c<f;c++)e.push(b(a[c]));return e},aa:function(a,b){for(var a=a||[],e=[],c=0,f=a.length;c<f;c++)b(a[c])&&e.push(a[c]);return e},H:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var e=0,c=b.length;e<c;e++)a.push(b[e]);return a},extend:function(a,b){for(var e in b)b.hasOwnProperty(e)&&(a[e]=b[e]);return a},ha:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},yb:function(b){for(var b=a.a.M(b),e=document.createElement("div"),
c=0,f=b.length;c<f;c++)e.appendChild(b[c]);return e},oa:function(b,e){a.a.ha(b);if(e)for(var c=0,f=e.length;c<f;c++)b.appendChild(e[c])},Ka:function(b,e){var c=b.nodeType?[b]:b;if(0<c.length){for(var f=c[0],h=f.parentNode,d=0,g=e.length;d<g;d++)h.insertBefore(e[d],f);d=0;for(g=c.length;d<g;d++)a.removeNode(c[d])}},Ma:function(a,b){0<=navigator.userAgent.indexOf("MSIE 6")?a.setAttribute("selected",b):a.selected=b},w:function(a){return(a||"").replace(c,"")},Hb:function(b,e){for(var c=[],f=(b||"").split(e),
-d=0,h=f.length;d<h;d++){var g=a.a.w(f[d]);""!==g&&c.push(g)}return c},Gb:function(a,b){a=a||"";return b.length>a.length?r:a.substring(0,b.length)===b},ab:function(a,b){for(var e="return ("+a+")",c=0;c<b;c++)e="with(sc["+c+"]) { "+e+" } ";return new Function("sc",e)},jb:function(a,b){if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a!=p;){if(a==b)return o;a=a.parentNode}return r},ga:function(b){return a.a.jb(b,document)},s:function(a,e,c){if("undefined"!=typeof jQuery){if(b(a,
+h=0,d=f.length;h<d;h++){var g=a.a.w(f[h]);""!==g&&c.push(g)}return c},Gb:function(a,b){a=a||"";return b.length>a.length?r:a.substring(0,b.length)===b},ab:function(a,b){for(var e="return ("+a+")",c=0;c<b;c++)e="with(sc["+c+"]) { "+e+" } ";return new Function("sc",e)},jb:function(a,b){if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a!=p;){if(a==b)return o;a=a.parentNode}return r},ga:function(b){return a.a.jb(b,document)},s:function(a,e,c){if("undefined"!=typeof jQuery){if(b(a,
e))var f=c,c=function(a,b){var e=this.checked;if(b)this.checked=b.bb!==o;f.call(this,a);this.checked=e};jQuery(a).bind(e,c)}else"function"==typeof a.addEventListener?a.addEventListener(e,c,r):"undefined"!=typeof a.attachEvent?a.attachEvent("on"+e,function(b){c.call(a,b)}):l(Error("Browser doesn't support addEventListener or attachEvent"))},ta:function(a,c){(!a||!a.nodeType)&&l(Error("element must be a DOM node when calling triggerEvent"));if("undefined"!=typeof jQuery){var f=[];b(a,c)&&f.push({bb:a.checked});
jQuery(a).trigger(c,f)}else if("function"==typeof document.createEvent)"function"==typeof a.dispatchEvent?(f=document.createEvent(e[c]||"HTMLEvents"),f.initEvent(c,o,o,window,0,0,0,0,0,r,r,r,r,0,a),a.dispatchEvent(f)):l(Error("The supplied element doesn't support dispatchEvent"));else if("undefined"!=typeof a.fireEvent){if("click"==c&&"INPUT"==a.tagName&&("checkbox"==a.type.toLowerCase()||"radio"==a.type.toLowerCase()))a.checked=a.checked!==o;a.fireEvent("on"+c)}else l(Error("Browser doesn't support triggering events"))},
-d:function(b){return a.W(b)?b():b},ib:function(b,e){return 0<=a.a.i((b.className||"").split(/\s+/),e)},Ra:function(b,e,c){var f=a.a.ib(b,e);if(c&&!f)b.className=(b.className||"")+" "+e;else if(f&&!c){for(var c=(b.className||"").split(/\s+/),f="",d=0;d<c.length;d++)c[d]!=e&&(f+=c[d]+" ");b.className=a.a.w(f)}},Na:function(b,e){var c=a.a.d(e);if(c===p||c===m)c="";"innerText"in b?b.innerText=c:b.textContent=c;if(9<=j)b.style.display=b.style.display},Cb:function(b,e){for(var b=a.a.d(b),e=a.a.d(e),c=[],
-f=b;f<=e;f++)c.push(f);return c},M:function(a){for(var b=[],e=0,c=a.length;e<c;e++)b.push(a[e]);return b},rb:6===j,sb:7===j,ob:j,Da:function(b,e){for(var c=a.a.M(b.getElementsByTagName("INPUT")).concat(a.a.M(b.getElementsByTagName("TEXTAREA"))),f="string"==typeof e?function(a){return a.name===e}:function(a){return e.test(a.name)},d=[],h=c.length-1;0<=h;h--)f(c[h])&&d.push(c[h]);return d},zb:function(b){return"string"==typeof b&&(b=a.a.w(b))?window.JSON&&window.JSON.parse?window.JSON.parse(b):(new Function("return "+
-b))():p},qa:function(b){("undefined"==typeof JSON||"undefined"==typeof JSON.stringify)&&l(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js"));return JSON.stringify(a.a.d(b))},Ab:function(b,e,c){var c=c||{},f=c.params||{},d=c.includeFields||this.Ca,h=b;if("object"==typeof b&&"FORM"==b.tagName)for(var h=b.action,g=d.length-1;0<=g;g--)for(var j=
-a.a.Da(b,d[g]),i=j.length-1;0<=i;i--)f[j[i].name]=j[i].value;var e=a.a.d(e),v=document.createElement("FORM");v.style.display="none";v.action=h;v.method="post";for(var A in e)b=document.createElement("INPUT"),b.name=A,b.value=a.a.qa(a.a.d(e[A])),v.appendChild(b);for(A in f)b=document.createElement("INPUT"),b.name=A,b.value=f[A],v.appendChild(b);document.body.appendChild(v);c.submitter?c.submitter(v):v.submit();setTimeout(function(){v.parentNode.removeChild(v)},0)}}};a.b("utils",a.a);a.b("utils.arrayForEach",
+d:function(b){return a.W(b)?b():b},ib:function(b,e){return 0<=a.a.i((b.className||"").split(/\s+/),e)},Ra:function(b,e,c){var f=a.a.ib(b,e);if(c&&!f)b.className=(b.className||"")+" "+e;else if(f&&!c){for(var c=(b.className||"").split(/\s+/),f="",h=0;h<c.length;h++)c[h]!=e&&(f+=c[h]+" ");b.className=a.a.w(f)}},Na:function(b,e){var c=a.a.d(e);if(c===p||c===m)c="";"innerText"in b?b.innerText=c:b.textContent=c;if(9<=j)b.style.display=b.style.display},Cb:function(b,e){for(var b=a.a.d(b),e=a.a.d(e),c=[],
+f=b;f<=e;f++)c.push(f);return c},M:function(a){for(var b=[],e=0,c=a.length;e<c;e++)b.push(a[e]);return b},rb:6===j,sb:7===j,ob:j,Da:function(b,e){for(var c=a.a.M(b.getElementsByTagName("INPUT")).concat(a.a.M(b.getElementsByTagName("TEXTAREA"))),f="string"==typeof e?function(a){return a.name===e}:function(a){return e.test(a.name)},h=[],d=c.length-1;0<=d;d--)f(c[d])&&h.push(c[d]);return h},zb:function(b){return"string"==typeof b&&(b=a.a.w(b))?window.JSON&&window.JSON.parse?window.JSON.parse(b):(new Function("return "+
+b))():p},qa:function(b){("undefined"==typeof JSON||"undefined"==typeof JSON.stringify)&&l(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js"));return JSON.stringify(a.a.d(b))},Ab:function(b,e,c){var c=c||{},f=c.params||{},h=c.includeFields||this.Ca,d=b;if("object"==typeof b&&"FORM"==b.tagName)for(var d=b.action,g=h.length-1;0<=g;g--)for(var j=
+a.a.Da(b,h[g]),i=j.length-1;0<=i;i--)f[j[i].name]=j[i].value;var e=a.a.d(e),v=document.createElement("FORM");v.style.display="none";v.action=d;v.method="post";for(var A in e)b=document.createElement("INPUT"),b.name=A,b.value=a.a.qa(a.a.d(e[A])),v.appendChild(b);for(A in f)b=document.createElement("INPUT"),b.name=A,b.value=f[A],v.appendChild(b);document.body.appendChild(v);c.submitter?c.submitter(v):v.submit();setTimeout(function(){v.parentNode.removeChild(v)},0)}}};a.b("utils",a.a);a.b("utils.arrayForEach",
a.a.q);a.b("utils.arrayFirst",a.a.Ya);a.b("utils.arrayFilter",a.a.aa);a.b("utils.arrayGetDistinctValues",a.a.ya);a.b("utils.arrayIndexOf",a.a.i);a.b("utils.arrayMap",a.a.U);a.b("utils.arrayPushAll",a.a.H);a.b("utils.arrayRemoveItem",a.a.ba);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",a.a.Ca);a.b("utils.getFormFields",a.a.Da);a.b("utils.postJson",a.a.Ab);a.b("utils.parseJson",a.a.zb);a.b("utils.registerEventHandler",a.a.s);a.b("utils.stringifyJson",a.a.qa);a.b("utils.range",
-a.a.Cb);a.b("utils.toggleDomNodeCssClass",a.a.Ra);a.b("utils.triggerEvent",a.a.ta);a.b("utils.unwrapObservable",a.a.d);Function.prototype.bind||(Function.prototype.bind=function(a){var c=this,d=Array.prototype.slice.call(arguments),a=d.shift();return function(){return c.apply(a,d.concat(Array.prototype.slice.call(arguments)))}});a.a.e=new function(){var b=0,c="__ko__"+(new Date).getTime(),d={};return{get:function(b,c){var d=a.a.e.getAll(b,r);return d===m?m:d[c]},set:function(b,c,d){d===m&&a.a.e.getAll(b,
-r)===m||(a.a.e.getAll(b,o)[c]=d)},getAll:function(a,f){var h=a[c];if(!(h&&"null"!==h)){if(!f)return;h=a[c]="ko"+b++;d[h]={}}return d[h]},clear:function(a){var b=a[c];b&&(delete d[b],a[c]=p)}}};a.b("utils.domData",a.a.e);a.b("utils.domData.clear",a.a.e.clear);a.a.D=new function(){function b(b,e){var c=a.a.e.get(b,d);c===m&&e&&(c=[],a.a.e.set(b,d,c));return c}function c(e){var c=b(e,r);if(c)for(var c=c.slice(0),f=0;f<c.length;f++)c[f](e);a.a.e.clear(e);"function"==typeof jQuery&&"function"==typeof jQuery.cleanData&&
-jQuery.cleanData([e])}var d="__ko_domNodeDisposal__"+(new Date).getTime(),e={1:o,8:o,9:o},f={1:o,9:o};return{va:function(a,e){"function"!=typeof e&&l(Error("Callback must be a function"));b(a,o).push(e)},Ja:function(e,c){var f=b(e,r);f&&(a.a.ba(f,c),0==f.length&&a.a.e.set(e,d,m))},K:function(b){if(e[b.nodeType]&&(c(b),f[b.nodeType])){var d=[];a.a.H(d,b.getElementsByTagName("*"));for(var b=0,i=d.length;b<i;b++)c(d[b])}},removeNode:function(b){a.K(b);b.parentNode&&b.parentNode.removeChild(b)}}};a.K=
-a.a.D.K;a.removeNode=a.a.D.removeNode;a.b("cleanNode",a.K);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.D);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.D.va);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.D.Ja);(function(){a.a.ma=function(b){var c;if("undefined"!=typeof jQuery){if((c=jQuery.clean([b]))&&c[0]){for(b=c[0];b.parentNode&&11!==b.parentNode.nodeType;)b=b.parentNode;b.parentNode&&b.parentNode.removeChild(b)}}else{var d=a.a.w(b).toLowerCase();c=document.createElement("div");
-d=d.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!d.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!d.indexOf("<td")||!d.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];b="ignored<div>"+d[1]+b+d[2]+"</div>";for("function"==typeof window.innerShiv?c.appendChild(window.innerShiv(b)):c.innerHTML=b;d[0]--;)c=c.lastChild;c=a.a.M(c.lastChild.childNodes)}return c};a.a.Z=function(b,c){a.a.ha(b);if(c!==p&&c!==m)if("string"!=typeof c&&(c=c.toString()),"undefined"!=
-typeof jQuery)jQuery(b).html(c);else for(var d=a.a.ma(c),e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b("utils.parseHtmlFragment",a.a.ma);a.b("utils.setHtml",a.a.Z);a.r=function(){function b(){return(4294967296*(1+Math.random())|0).toString(16).substring(1)}function c(b,f){if(b)if(8==b.nodeType){var d=a.r.Ha(b.nodeValue);d!=p&&f.push({hb:b,wb:d})}else if(1==b.nodeType)for(var d=0,g=b.childNodes,i=g.length;d<i;d++)c(g[d],f)}var d={};return{ka:function(a){"function"!=typeof a&&l(Error("You can only pass a function to ko.memoization.memoize()"));
-var c=b()+b();d[c]=a;return"<\!--[ko_memo:"+c+"]--\>"},Sa:function(a,b){var c=d[a];c===m&&l(Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized."));try{return c.apply(p,b||[]),o}finally{delete d[a]}},Ta:function(b,f){var d=[];c(b,d);for(var g=0,i=d.length;g<i;g++){var j=d[g].hb,k=[j];f&&a.a.H(k,f);a.r.Sa(d[g].wb,k);j.nodeValue="";j.parentNode&&j.parentNode.removeChild(j)}},Ha:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:p}}}();a.b("memoization",a.r);a.b("memoization.memoize",
-a.r.ka);a.b("memoization.unmemoize",a.r.Sa);a.b("memoization.parseMemoText",a.r.Ha);a.b("memoization.unmemoizeDomNodeAndDescendants",a.r.Ta);a.Ba={throttle:function(b,c){b.throttleEvaluation=c;var d=p;return a.j({read:b,write:function(a){clearTimeout(d);d=setTimeout(function(){b(a)},c)}})},notify:function(b,c){b.equalityComparer="always"==c?B(r):a.v.fn.equalityComparer;return b}};a.b("extenders",a.Ba);a.Pa=function(b,c,d){this.target=b;this.ca=c;this.gb=d;a.l(this,"dispose",this.z)};a.Pa.prototype.z=
-function(){this.qb=o;this.gb()};a.S=function(){this.u={};a.a.extend(this,a.S.fn);a.l(this,"subscribe",this.ra);a.l(this,"extend",this.extend);a.l(this,"getSubscriptionsCount",this.mb)};a.S.fn={ra:function(b,c,d){var d=d||"change",b=c?b.bind(c):b,e=new a.Pa(this,b,function(){a.a.ba(this.u[d],e)}.bind(this));this.u[d]||(this.u[d]=[]);this.u[d].push(e);return e},notifySubscribers:function(b,c){c=c||"change";this.u[c]&&a.a.q(this.u[c].slice(0),function(a){a&&a.qb!==o&&a.ca(b)})},mb:function(){var a=0,
-c;for(c in this.u)this.u.hasOwnProperty(c)&&(a+=this.u[c].length);return a},extend:function(b){var c=this;if(b)for(var d in b){var e=a.Ba[d];"function"==typeof e&&(c=e(c,b[d]))}return c}};a.Fa=function(a){return"function"==typeof a.ra&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.S);a.b("isSubscribable",a.Fa);a.V=function(){var b=[];return{Za:function(a){b.push({ca:a,za:[]})},end:function(){b.pop()},Ia:function(c){a.Fa(c)||l(Error("Only subscribable things can act as dependencies"));
-if(0<b.length){var d=b[b.length-1];0<=a.a.i(d.za,c)||(d.za.push(c),d.ca(c))}}}}();var E={undefined:o,"boolean":o,number:o,string:o};a.v=function(b){function c(){if(0<arguments.length){if(!c.equalityComparer||!c.equalityComparer(d,arguments[0]))c.G(),d=arguments[0],c.F();return this}a.V.Ia(c);return d}var d=b;a.S.call(c);c.F=function(){c.notifySubscribers(d)};c.G=function(){c.notifySubscribers(d,"beforeChange")};a.a.extend(c,a.v.fn);a.l(c,"valueHasMutated",c.F);a.l(c,"valueWillMutate",c.G);return c};
-a.v.fn={A:a.v,equalityComparer:function(a,c){return a===p||typeof a in E?a===c:r}};a.W=function(b){return b===p||b===m||b.A===m?r:b.A===a.v?o:a.W(b.A)};a.Q=function(b){return"function"==typeof b&&b.A===a.v?o:"function"==typeof b&&b.A===a.j&&b.nb?o:r};a.b("observable",a.v);a.b("isObservable",a.W);a.b("isWriteableObservable",a.Q);a.R=function(b){0==arguments.length&&(b=[]);b!==p&&b!==m&&!("length"in b)&&l(Error("The argument passed when initializing an observable array must be an array, or null, or undefined."));
-var c=new a.v(b);a.a.extend(c,a.R.fn);a.l(c,"remove",c.remove);a.l(c,"removeAll",c.Db);a.l(c,"destroy",c.fa);a.l(c,"destroyAll",c.fb);a.l(c,"indexOf",c.indexOf);a.l(c,"replace",c.replace);return c};a.R.fn={remove:function(a){for(var c=this(),d=[],e="function"==typeof a?a:function(c){return c===a},f=0;f<c.length;f++){var h=c[f];e(h)&&(0===d.length&&this.G(),d.push(h),c.splice(f,1),f--)}d.length&&this.F();return d},Db:function(b){if(b===m){var c=this(),d=c.slice(0);this.G();c.splice(0,c.length);this.F();
-return d}return!b?[]:this.remove(function(c){return 0<=a.a.i(b,c)})},fa:function(a){var c=this(),d="function"==typeof a?a:function(c){return c===a};this.G();for(var e=c.length-1;0<=e;e--)d(c[e])&&(c[e]._destroy=o);this.F()},fb:function(b){return b===m?this.fa(B(o)):!b?[]:this.fa(function(c){return 0<=a.a.i(b,c)})},indexOf:function(b){var c=this();return a.a.i(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.G(),this()[d]=c,this.F())}};a.a.q("pop,push,reverse,shift,sort,splice,unshift".split(","),
-function(b){a.R.fn[b]=function(){var a=this();this.G();a=a[b].apply(a,arguments);this.F();return a}});a.a.q(["slice"],function(b){a.R.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b("observableArray",a.R);a.j=function(b,c,d){function e(){a.a.q(s,function(a){a.z()});s=[]}function f(){var a=g.throttleEvaluation;a&&0<=a?(clearTimeout(z),z=setTimeout(h,a)):h()}function h(){if(k&&u())w();else{try{var b=a.a.U(s,function(a){return a.target});a.V.Za(function(c){var e;0<=(e=a.a.i(b,c))?
-b[e]=m:s.push(c.ra(f))});for(var e=n.call(c),d=b.length-1;0<=d;d--)b[d]&&s.splice(d,1)[0].z();g.notifySubscribers(j,"beforeChange");j=e}finally{a.V.end()}g.notifySubscribers(j);k=o}}function g(){if(0<arguments.length)i.apply(g,arguments);else return k||h(),a.V.Ia(g),j}function i(){"function"===typeof t?t.apply(c,arguments):l(Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."))}var j,k=r,n=b;n&&"object"==
-typeof n?(d=n,n=d.read):(d=d||{},n||(n=d.read));"function"!=typeof n&&l(Error("Pass a function that returns the value of the ko.computed"));var t=d.write;c||(c=d.owner);var s=[],w=e,q="object"==typeof d.disposeWhenNodeIsRemoved?d.disposeWhenNodeIsRemoved:p,u=d.disposeWhen||B(r);if(q){w=function(){a.a.D.Ja(q,arguments.callee);e()};a.a.D.va(q,w);var y=u,u=function(){return!a.a.ga(q)||y()}}var z=p;g.lb=function(){return s.length};g.nb="function"===typeof d.write;g.z=function(){w()};a.S.call(g);a.a.extend(g,
-a.j.fn);d.deferEvaluation!==o&&h();a.l(g,"dispose",g.z);a.l(g,"getDependenciesCount",g.lb);return g};a.j.fn={A:a.j};a.j.A=a.v;a.b("dependentObservable",a.j);a.b("computed",a.j);(function(){function b(a,f,h){h=h||new d;a=f(a);if(!("object"==typeof a&&a!==p&&a!==m&&!(a instanceof Date)))return a;var g=a instanceof Array?[]:{};h.save(a,g);c(a,function(c){var d=f(a[c]);switch(typeof d){case "boolean":case "number":case "string":case "function":g[c]=d;break;case "object":case "undefined":var k=h.get(d);
-g[c]=k!==m?k:b(d,f,h)}});return g}function c(a,b){if(a instanceof Array)for(var c=0;c<a.length;c++)b(c);else for(c in a)b(c)}function d(){var b=[],c=[];this.save=function(d,g){var i=a.a.i(b,d);0<=i?c[i]=g:(b.push(d),c.push(g))};this.get=function(d){d=a.a.i(b,d);return 0<=d?c[d]:m}}a.Qa=function(c){0==arguments.length&&l(Error("When calling ko.toJS, pass the object you want to convert."));return b(c,function(b){for(var c=0;a.W(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b){b=a.Qa(b);return a.a.qa(b)}})();
-a.b("toJS",a.Qa);a.b("toJSON",a.toJSON);(function(){a.h={p:function(b){return"OPTION"==b.tagName?b.__ko__hasDomDataOptionValue__===o?a.a.e.get(b,a.c.options.la):b.getAttribute("value"):"SELECT"==b.tagName?0<=b.selectedIndex?a.h.p(b.options[b.selectedIndex]):m:b.value},T:function(b,c){if("OPTION"==b.tagName)switch(typeof c){case "string":a.a.e.set(b,a.c.options.la,m);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.e.set(b,a.c.options.la,c),b.__ko__hasDomDataOptionValue__=
-o,b.value="number"===typeof c?c:""}else if("SELECT"==b.tagName)for(var d=b.options.length-1;0<=d;d--){if(a.h.p(b.options[d])==c){b.selectedIndex=d;break}}else{if(c===p||c===m)c="";b.value=c}}}})();a.b("selectExtensions",a.h);a.b("selectExtensions.readValue",a.h.p);a.b("selectExtensions.writeValue",a.h.T);a.k=function(){function b(a,b){for(var e=p;a!=e;)e=a,a=a.replace(c,function(a,c){return b[c]});return a}var c=/\@ko_token_(\d+)\@/g,d=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,
+a.a.Cb);a.b("utils.toggleDomNodeCssClass",a.a.Ra);a.b("utils.triggerEvent",a.a.ta);a.b("utils.unwrapObservable",a.a.d);Function.prototype.bind||(Function.prototype.bind=function(a){var c=this,d=Array.prototype.slice.call(arguments),a=d.shift();return function(){return c.apply(a,d.concat(Array.prototype.slice.call(arguments)))}});a.a.e=new function(){var b=0,c="__ko__"+(new Date).getTime(),d={};return{get:function(b,c){var h=a.a.e.getAll(b,r);return h===m?m:h[c]},set:function(b,c,h){h===m&&a.a.e.getAll(b,
+r)===m||(a.a.e.getAll(b,o)[c]=h)},getAll:function(a,f){var h=a[c];if(!(h&&"null"!==h)){if(!f)return;h=a[c]="ko"+b++;d[h]={}}return d[h]},clear:function(a){var b=a[c];b&&(delete d[b],a[c]=p)}}};a.b("utils.domData",a.a.e);a.b("utils.domData.clear",a.a.e.clear);a.a.D=new function(){function b(b,e){var c=a.a.e.get(b,d);c===m&&e&&(c=[],a.a.e.set(b,d,c));return c}function c(e){var d=b(e,r);if(d)for(var d=d.slice(0),i=0;i<d.length;i++)d[i](e);a.a.e.clear(e);"function"==typeof jQuery&&"function"==typeof jQuery.cleanData&&
+jQuery.cleanData([e]);if(f[e.nodeType])for(d=e.firstChild;e=d;)d=e.nextSibling,8===e.nodeType&&c(e)}var d="__ko_domNodeDisposal__"+(new Date).getTime(),e={1:o,8:o,9:o},f={1:o,9:o};return{va:function(a,e){"function"!=typeof e&&l(Error("Callback must be a function"));b(a,o).push(e)},Ja:function(e,c){var f=b(e,r);f&&(a.a.ba(f,c),0==f.length&&a.a.e.set(e,d,m))},K:function(b){if(e[b.nodeType]&&(c(b),f[b.nodeType])){var d=[];a.a.H(d,b.getElementsByTagName("*"));for(var b=0,i=d.length;b<i;b++)c(d[b])}},
+removeNode:function(b){a.K(b);b.parentNode&&b.parentNode.removeChild(b)}}};a.K=a.a.D.K;a.removeNode=a.a.D.removeNode;a.b("cleanNode",a.K);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.D);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.D.va);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.D.Ja);(function(){a.a.ma=function(b){var c;if("undefined"!=typeof jQuery){if((c=jQuery.clean([b]))&&c[0]){for(b=c[0];b.parentNode&&11!==b.parentNode.nodeType;)b=b.parentNode;b.parentNode&&
+b.parentNode.removeChild(b)}}else{var d=a.a.w(b).toLowerCase();c=document.createElement("div");d=d.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!d.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!d.indexOf("<td")||!d.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];b="ignored<div>"+d[1]+b+d[2]+"</div>";for("function"==typeof window.innerShiv?c.appendChild(window.innerShiv(b)):c.innerHTML=b;d[0]--;)c=c.lastChild;c=a.a.M(c.lastChild.childNodes)}return c};
+a.a.Z=function(b,c){a.a.ha(b);if(c!==p&&c!==m)if("string"!=typeof c&&(c=c.toString()),"undefined"!=typeof jQuery)jQuery(b).html(c);else for(var d=a.a.ma(c),e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b("utils.parseHtmlFragment",a.a.ma);a.b("utils.setHtml",a.a.Z);a.r=function(){function b(){return(4294967296*(1+Math.random())|0).toString(16).substring(1)}function c(b,f){if(b)if(8==b.nodeType){var d=a.r.Ha(b.nodeValue);d!=p&&f.push({hb:b,wb:d})}else if(1==b.nodeType)for(var d=0,g=b.childNodes,i=g.length;d<
+i;d++)c(g[d],f)}var d={};return{ka:function(a){"function"!=typeof a&&l(Error("You can only pass a function to ko.memoization.memoize()"));var c=b()+b();d[c]=a;return"<\!--[ko_memo:"+c+"]--\>"},Sa:function(a,b){var c=d[a];c===m&&l(Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized."));try{return c.apply(p,b||[]),o}finally{delete d[a]}},Ta:function(b,f){var d=[];c(b,d);for(var g=0,i=d.length;g<i;g++){var j=d[g].hb,k=[j];f&&a.a.H(k,f);a.r.Sa(d[g].wb,k);j.nodeValue="";j.parentNode&&
+j.parentNode.removeChild(j)}},Ha:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:p}}}();a.b("memoization",a.r);a.b("memoization.memoize",a.r.ka);a.b("memoization.unmemoize",a.r.Sa);a.b("memoization.parseMemoText",a.r.Ha);a.b("memoization.unmemoizeDomNodeAndDescendants",a.r.Ta);a.Ba={throttle:function(b,c){b.throttleEvaluation=c;var d=p;return a.j({read:b,write:function(a){clearTimeout(d);d=setTimeout(function(){b(a)},c)}})},notify:function(b,c){b.equalityComparer="always"==c?B(r):a.v.fn.equalityComparer;
+return b}};a.b("extenders",a.Ba);a.Pa=function(b,c,d){this.target=b;this.ca=c;this.gb=d;a.l(this,"dispose",this.z)};a.Pa.prototype.z=function(){this.qb=o;this.gb()};a.S=function(){this.u={};a.a.extend(this,a.S.fn);a.l(this,"subscribe",this.ra);a.l(this,"extend",this.extend);a.l(this,"getSubscriptionsCount",this.mb)};a.S.fn={ra:function(b,c,d){var d=d||"change",b=c?b.bind(c):b,e=new a.Pa(this,b,function(){a.a.ba(this.u[d],e)}.bind(this));this.u[d]||(this.u[d]=[]);this.u[d].push(e);return e},notifySubscribers:function(b,
+c){c=c||"change";this.u[c]&&a.a.q(this.u[c].slice(0),function(a){a&&a.qb!==o&&a.ca(b)})},mb:function(){var a=0,c;for(c in this.u)this.u.hasOwnProperty(c)&&(a+=this.u[c].length);return a},extend:function(b){var c=this;if(b)for(var d in b){var e=a.Ba[d];"function"==typeof e&&(c=e(c,b[d]))}return c}};a.Fa=function(a){return"function"==typeof a.ra&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.S);a.b("isSubscribable",a.Fa);a.V=function(){var b=[];return{Za:function(a){b.push({ca:a,za:[]})},
+end:function(){b.pop()},Ia:function(c){a.Fa(c)||l(Error("Only subscribable things can act as dependencies"));if(0<b.length){var d=b[b.length-1];0<=a.a.i(d.za,c)||(d.za.push(c),d.ca(c))}}}}();var E={undefined:o,"boolean":o,number:o,string:o};a.v=function(b){function c(){if(0<arguments.length){if(!c.equalityComparer||!c.equalityComparer(d,arguments[0]))c.G(),d=arguments[0],c.F();return this}a.V.Ia(c);return d}var d=b;a.S.call(c);c.F=function(){c.notifySubscribers(d)};c.G=function(){c.notifySubscribers(d,
+"beforeChange")};a.a.extend(c,a.v.fn);a.l(c,"valueHasMutated",c.F);a.l(c,"valueWillMutate",c.G);return c};a.v.fn={A:a.v,equalityComparer:function(a,c){return a===p||typeof a in E?a===c:r}};a.W=function(b){return b===p||b===m||b.A===m?r:b.A===a.v?o:a.W(b.A)};a.Q=function(b){return"function"==typeof b&&b.A===a.v?o:"function"==typeof b&&b.A===a.j&&b.nb?o:r};a.b("observable",a.v);a.b("isObservable",a.W);a.b("isWriteableObservable",a.Q);a.R=function(b){0==arguments.length&&(b=[]);b!==p&&b!==m&&!("length"in
+b)&&l(Error("The argument passed when initializing an observable array must be an array, or null, or undefined."));var c=new a.v(b);a.a.extend(c,a.R.fn);a.l(c,"remove",c.remove);a.l(c,"removeAll",c.Db);a.l(c,"destroy",c.fa);a.l(c,"destroyAll",c.fb);a.l(c,"indexOf",c.indexOf);a.l(c,"replace",c.replace);return c};a.R.fn={remove:function(a){for(var c=this(),d=[],e="function"==typeof a?a:function(c){return c===a},f=0;f<c.length;f++){var h=c[f];e(h)&&(0===d.length&&this.G(),d.push(h),c.splice(f,1),f--)}d.length&&
+this.F();return d},Db:function(b){if(b===m){var c=this(),d=c.slice(0);this.G();c.splice(0,c.length);this.F();return d}return!b?[]:this.remove(function(c){return 0<=a.a.i(b,c)})},fa:function(a){var c=this(),d="function"==typeof a?a:function(c){return c===a};this.G();for(var e=c.length-1;0<=e;e--)d(c[e])&&(c[e]._destroy=o);this.F()},fb:function(b){return b===m?this.fa(B(o)):!b?[]:this.fa(function(c){return 0<=a.a.i(b,c)})},indexOf:function(b){var c=this();return a.a.i(c,b)},replace:function(a,c){var d=
+this.indexOf(a);0<=d&&(this.G(),this()[d]=c,this.F())}};a.a.q("pop,push,reverse,shift,sort,splice,unshift".split(","),function(b){a.R.fn[b]=function(){var a=this();this.G();a=a[b].apply(a,arguments);this.F();return a}});a.a.q(["slice"],function(b){a.R.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b("observableArray",a.R);a.j=function(b,c,d){function e(){a.a.q(s,function(a){a.z()});s=[]}function f(){var a=g.throttleEvaluation;a&&0<=a?(clearTimeout(z),z=setTimeout(h,a)):h()}function h(){if(k&&
+u())w();else{try{var b=a.a.U(s,function(a){return a.target});a.V.Za(function(c){var e;0<=(e=a.a.i(b,c))?b[e]=m:s.push(c.ra(f))});for(var e=n.call(c),d=b.length-1;0<=d;d--)b[d]&&s.splice(d,1)[0].z();g.notifySubscribers(j,"beforeChange");j=e}finally{a.V.end()}g.notifySubscribers(j);k=o}}function g(){if(0<arguments.length)i.apply(g,arguments);else return k||h(),a.V.Ia(g),j}function i(){"function"===typeof t?t.apply(c,arguments):l(Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."))}
+var j,k=r,n=b;n&&"object"==typeof n?(d=n,n=d.read):(d=d||{},n||(n=d.read));"function"!=typeof n&&l(Error("Pass a function that returns the value of the ko.computed"));var t=d.write;c||(c=d.owner);var s=[],w=e,q="object"==typeof d.disposeWhenNodeIsRemoved?d.disposeWhenNodeIsRemoved:p,u=d.disposeWhen||B(r);if(q){w=function(){a.a.D.Ja(q,arguments.callee);e()};a.a.D.va(q,w);var y=u,u=function(){return!a.a.ga(q)||y()}}var z=p;g.lb=function(){return s.length};g.nb="function"===typeof d.write;g.z=function(){w()};
+a.S.call(g);a.a.extend(g,a.j.fn);d.deferEvaluation!==o&&h();a.l(g,"dispose",g.z);a.l(g,"getDependenciesCount",g.lb);return g};a.j.fn={A:a.j};a.j.A=a.v;a.b("dependentObservable",a.j);a.b("computed",a.j);(function(){function b(a,f,h){h=h||new d;a=f(a);if(!("object"==typeof a&&a!==p&&a!==m&&!(a instanceof Date)))return a;var g=a instanceof Array?[]:{};h.save(a,g);c(a,function(c){var d=f(a[c]);switch(typeof d){case "boolean":case "number":case "string":case "function":g[c]=d;break;case "object":case "undefined":var k=
+h.get(d);g[c]=k!==m?k:b(d,f,h)}});return g}function c(a,b){if(a instanceof Array)for(var c=0;c<a.length;c++)b(c);else for(c in a)b(c)}function d(){var b=[],c=[];this.save=function(d,g){var i=a.a.i(b,d);0<=i?c[i]=g:(b.push(d),c.push(g))};this.get=function(d){d=a.a.i(b,d);return 0<=d?c[d]:m}}a.Qa=function(c){0==arguments.length&&l(Error("When calling ko.toJS, pass the object you want to convert."));return b(c,function(b){for(var c=0;a.W(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b){b=a.Qa(b);
+return a.a.qa(b)}})();a.b("toJS",a.Qa);a.b("toJSON",a.toJSON);(function(){a.h={p:function(b){return"OPTION"==b.tagName?b.__ko__hasDomDataOptionValue__===o?a.a.e.get(b,a.c.options.la):b.getAttribute("value"):"SELECT"==b.tagName?0<=b.selectedIndex?a.h.p(b.options[b.selectedIndex]):m:b.value},T:function(b,c){if("OPTION"==b.tagName)switch(typeof c){case "string":a.a.e.set(b,a.c.options.la,m);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.e.set(b,
+a.c.options.la,c),b.__ko__hasDomDataOptionValue__=o,b.value="number"===typeof c?c:""}else if("SELECT"==b.tagName)for(var d=b.options.length-1;0<=d;d--){if(a.h.p(b.options[d])==c){b.selectedIndex=d;break}}else{if(c===p||c===m)c="";b.value=c}}}})();a.b("selectExtensions",a.h);a.b("selectExtensions.readValue",a.h.p);a.b("selectExtensions.writeValue",a.h.T);a.k=function(){function b(a,b){for(var e=p;a!=e;)e=a,a=a.replace(c,function(a,c){return b[c]});return a}var c=/\@ko_token_(\d+)\@/g,d=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,
e=["true","false"];return{C:[],Y:function(c){var e=a.a.w(c);if(3>e.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-1));for(var c=[],d=p,i,j=0;j<e.length;j++){var k=e.charAt(j);if(d===p)switch(k){case '"':case "'":case "/":d=j,i=k}else if(k==i&&"\\"!==e.charAt(j-1)){k=e.substring(d,j+1);c.push(k);var n="@ko_token_"+(c.length-1)+"@",e=e.substring(0,d)+n+e.substring(j+1),j=j-(k.length-n.length),d=p}}i=d=p;for(var t=0,s=p,j=0;j<e.length;j++){k=e.charAt(j);if(d===p)switch(k){case "{":d=j;
s=k;i="}";break;case "(":d=j;s=k;i=")";break;case "[":d=j,s=k,i="]"}k===s?t++:k===i&&(t--,0===t&&(k=e.substring(d,j+1),c.push(k),n="@ko_token_"+(c.length-1)+"@",e=e.substring(0,d)+n+e.substring(j+1),j-=k.length-n.length,d=p))}i=[];e=e.split(",");d=0;for(j=e.length;d<j;d++)t=e[d],s=t.indexOf(":"),0<s&&s<t.length-1?(k=t.substring(s+1),i.push({key:b(t.substring(0,s),c),value:b(k,c)})):i.push({unknown:b(t,c)});return i},ia:function(b){for(var c="string"===typeof b?a.k.Y(b):b,g=[],b=[],i,j=0;i=c[j];j++)if(0<
g.length&&g.push(","),i.key){var k;a:{k=i.key;var n=a.a.w(k);switch(n.length&&n.charAt(0)){case "'":case '"':break a;default:k="'"+n+"'"}}i=i.value;g.push(k);g.push(":");g.push(i);n=a.a.w(i);if(0<=a.a.i(e,a.a.w(n).toLowerCase())?0:n.match(d)!==p)0<b.length&&b.push(", "),b.push(k+" : function(__ko_value) { "+i+" = __ko_value; }")}else i.unknown&&g.push(i.unknown);c=g.join("");0<b.length&&(c=c+", '_ko_property_writers' : { "+b.join("")+" } ");return c},ub:function(b,c){for(var e=0;e<b.length;e++)if(a.a.w(b[e].key)==
View
14 src/utils.domNodeDisposal.js
@@ -33,6 +33,20 @@ ko.utils.domNodeDisposal = new (function () {
// so notify it to tear down any resources associated with the node & descendants here.
if ((typeof jQuery == "function") && (typeof jQuery['cleanData'] == "function"))
jQuery['cleanData']([node]);
+
+ // Also clear any immediate-child comment nodes, as these wouldn't have been found by
+ // node.getElementsByTagName("*") in cleanNode() (comment nodes aren't elements)
+ if (cleanableNodeTypesWithDescendants[node.nodeType])
+ cleanImmediateCommentTypeChildren(node);
+ }
+
+ function cleanImmediateCommentTypeChildren(nodeWithChildren) {
+ var child, nextChild = nodeWithChildren.firstChild;
+ while (child = nextChild) {
+ nextChild = child.nextSibling;
+ if (child.nodeType === 8)
+ cleanSingleNode(child);
+ }
}
return {
Please sign in to comment.
Something went wrong with that request. Please try again.