From 43c47106fb5819ed5966a5aaee60d774e53f4b9c Mon Sep 17 00:00:00 2001 From: BorisMoore Date: Wed, 27 Jan 2021 21:01:47 -0800 Subject: [PATCH] v1.0.11 release Minor bug fix: See https://github.com/BorisMoore/jsviews/issues/452 html comments not working in tables --- jquery.observable.js | 4 +- jquery.observable.min.js | 4 +- jquery.observable.min.js.map | 2 +- jquery.views.js | 10 +- jquery.views.min.js | 6 +- jquery.views.min.js.map | 2 +- jsrender.js | 8 +- jsrender.min.js | 4 +- jsrender.min.js.map | 2 +- jsviews.js | 14 +- jsviews.min.js | 8 +- jsviews.min.js.map | 2 +- package.json | 4 +- test/browserify/bundles/1-bundle.js | 12 +- test/browserify/bundles/10-errors-bundle.js | 30 +-- test/browserify/bundles/11-errors-bundle.js | 44 ++--- test/browserify/bundles/12-nested-bundle.js | 12 +- test/browserify/bundles/2-bundle.js | 12 +- test/browserify/bundles/3-bundle.js | 12 +- test/browserify/bundles/4-bundle.js | 8 +- test/browserify/bundles/5-bundle.js | 8 +- test/browserify/bundles/6-bundle.js | 30 +-- test/browserify/bundles/7-bundle.js | 30 +-- test/browserify/bundles/8-bundle.js | 22 +-- test/browserify/bundles/8B-bundle.js | 32 ++-- test/browserify/bundles/9-bundle.js | 22 +-- test/unit-tests-all-jsviews.html | 2 +- ...nit-tests-all-observable-render-views.html | 2 +- ...nit-tests-all-render-observable-views.html | 2 +- test/unit-tests-jsrender-no-jquery.html | 2 +- test/unit-tests-jsrender-with-jquery.html | 2 +- test/unit-tests-jsviews.html | 2 +- test/unit-tests-multiple-loads.html | 2 +- test/unit-tests/tests-jsobservable.js | 15 +- .../tests-jsrender-amd-scriptloader.js | 21 ++- test/unit-tests/tests-jsrender-no-jquery.js | 57 +++++- test/unit-tests/tests-jsrender-with-jquery.js | 38 +++- .../tests-jsviews-amd-scriptloader.js | 21 ++- test/unit-tests/tests-jsviews.js | 172 +++++++++++------- typescript/jsviews/index.d.ts | 2 +- 40 files changed, 416 insertions(+), 268 deletions(-) diff --git a/jquery.observable.js b/jquery.observable.js index 843b25e..013e0f9 100644 --- a/jquery.observable.js +++ b/jquery.observable.js @@ -1,4 +1,4 @@ -/*! JsObservable v1.0.10: http://jsviews.com/#jsobservable */ +/*! JsObservable v1.0.11: http://jsviews.com/#jsobservable */ /* * Subcomponent of JsViews * Data change events for data-linking @@ -44,7 +44,7 @@ if (!$ || !$.fn) { throw "jquery.observable.js requires jQuery"; // We require jQuery } -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", _ocp = "_ocp", // Observable contextual parameter $observe, $observable, diff --git a/jquery.observable.min.js b/jquery.observable.min.js index 2715e6c..f5139f3 100644 --- a/jquery.observable.min.js +++ b/jquery.observable.min.js @@ -1,3 +1,3 @@ -/*! JsObservable v1.0.10: http://jsviews.com/#jsobservable */ -!function(t,e){var n=e.jQuery;"object"==typeof exports?module.exports=n?t(e,n):function(n){return t(e,n)}:"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):t(e,!1)}(function(t,e){"use strict";var n=e===!1;if(e=e||t.jQuery,!e||!e.fn)throw"jquery.observable.js requires jQuery";var r,i,o="v1.0.10",s=e.views=e.views||n&&t.jsrender&&jsrender.views||{jsviews:o,sub:{settings:{}},settings:{advanced:function(t){return l=c.advanced=c.advanced||{_jsv:!0},t?("_jsv"in t&&(l._jsv=t._jsv),a.advSet(),s.settings):l}}},a=s.sub,c=a.settings,l=c.advanced,f=e.isFunction,p=e.expando,u=e.isArray,h="object";if(s.jsviews!==o)throw"jquery.observable.js requires jsrender.js "+o;if(!e.observe){var d=e.event.special,v=[].slice,_=[].splice,g=[].concat,b=parseInt,y=/\S+/g,m=/^[^.[]*$/,I=a.propChng=a.propChng||"propertyChange",w=a.arrChng=a.arrChng||"arrayChange",j={},x=I+".observe",A=1,k=1,C=1,F=e.data,P={},S=[],T=function(t){return t?t._cId=t._cId||".obs"+k++:""},V=function(t,e){return this._data=e,this._ns=t,this},q=function(t,e){return this._data=e,this._ns=t,this},D=function(t){return u(t)?[t]:t},O=function(t,e,n){t=t?u(t)?t:[t]:[];var r,i,o,s,a=o=e,c=t&&t.length,l=[];for(r=0;r1;)f=f[s.shift()];f&&l._setProperty(f,s[0],e,n,r)}return l},removeProperty:function(t){return this.setProperty(t,P),this},_setProperty:function(t,e,n,r,i){var o,s,a,c,l,p=e?t[e]:t;if(f(p)&&!f(n)){if(i&&!p.set)return;p.set&&(l=t._vw||t,s=p,o=s.set===!0?s:s.set,p=s.call(l))}(p!==n||r&&p!=n)&&(!(p instanceof Date&&n instanceof Date)||p>n||p-1&&(e=u(e)?e:[e],e.length&&this._insert(t,e)),this},_insert:function(t,e){var n=this._data,r=n.length;t>r&&(t=r),_.apply(n,[t,0].concat(e)),this._trigger({change:"insert",index:t,items:e},r)},remove:function(t,e){var n,r=this._data;return void 0===t&&(t=r.length-1),t=b(t),e=e?b(e):0===e?0:1,e>0&&t>-1&&(n=r.slice(t,t+e),(e=n.length)&&this._remove(t,e,n)),this},_remove:function(t,e,n){var r=this._data,i=r.length;r.splice(t,e),this._trigger({change:"remove",index:t,items:n},i)},move:function(t,e,n){return n=n?b(n):0===n?0:1,t=b(t),e=b(e),n>0&&t>-1&&e>-1&&t!==e&&this._move(t,e,n),this},_move:function(t,e,n){var r,i=this._data,o=i.length,s=t+n-o;s>0&&(n-=s),n&&(r=i.splice(t,n),e>i.length&&(e=i.length),_.apply(i,[e,0].concat(r)),e!==t&&this._trigger({change:"move",oldIndex:t,index:e,items:r},o))},refresh:function(t){function e(){i&&(a.insert(r-i,c),u+=i,n+=i,i=0,c=[])}var n,r,i,o,s,a=this,c=[],l=a._data,f=l.slice(),p=l.length,u=p,h=t.length;for(a._srt=!0,r=i=0;rr&&a.remove(r,u-r),a._srt=void 0,(p||h)&&a._trigger({change:"refresh",oldItems:f},p),a},_trigger:function(t,n,r){c._cchCt++;var i,o,s,a=this;e.hasData(o=a._data)&&(!r&&(s=a._batch)?(t._dly=!0,s.push([a,t,n]),a.async&&!s._go&&s.wait()):(i=o.length,o=e([o]),a._srt?t.refresh=!0:i!==n&&o.triggerHandler(I,{change:"set",path:"length",value:i,oldValue:n}),o.triggerHandler(w+(a._ns?"."+/^\S+/.exec(a._ns)[0]:""),t)))}},d[I]=d[w]={remove:function(t){var n,r,i,o,s,a=t.data;if(a&&(a.off=!0,a=a.cb)&&(n=j[a._cId])){for(i=e._data(this).events[t.type],o=i.length;o--&&!r;)r=(s=i[o].data)&&s.cb&&s.cb._cId===a._cId;r||(--n.len?delete n[F(this).obId]:delete j[a._cId])}}},s.map=function(t){function n(e,n,r,o){var s,a,c=this;c.src&&c.unmap(),n&&(n.map=c),(typeof e===h||f(e))&&(c.src=e,o?c.tgt=t.getTgt(e,n):(r&&(c.tgt=r.tgt||u(r)&&r),c.tgt=c.tgt||[],c.options=n||c.options,(a=c.update())?c=a:(t.obsSrc&&i(c.src).observeAll(c.obs=function(e,n){s||n.refresh||(s=!0,t.obsSrc(c,e,n),s=void 0)},c.srcFlt),t.obsTgt&&i(c.tgt).observeAll(c.obt=function(e,n){s||c.tgt._updt||(s=!0,t.obsTgt(c,e,n),s=void 0)},c.tgtFlt))))}return f(t)&&(t={getTgt:t}),t.baseMap&&(t=e.extend({},t.baseMap,t)),t.map=function(t,e,r,i){return new n(t,e,r,i)},(n.prototype={srcFlt:t.srcFlt||$,tgtFlt:t.tgtFlt||$,update:function(e){var n,r,o=this,s=o.tgt;if(!s._updt&&(s._updt=!0,n=o.options&&o.options.map,i(s).refresh(t.getTgt(o.src,o.options=e||o.options)),s._updt=!1,r=o.options&&o.options.map,r&&n!==r))return r},observe:function(t,n){var r=this,o=r.options;r.obmp&&z(r.obmp),r.obmp=function(){var t=n.fn(n.data,n.view,a)[o.index];e.extend(o.props,t.props),o.args=t.args,r.update()},i._apply(1,n.data,O(t,n.tag,r.obmp),r.obmp,n._ctxCb)},unmap:function(){var t=this;t.src&&t.obs&&i(t.src).unobserveAll(t.obs,t.srcFlt),t.tgt&&t.obt&&i(t.tgt).unobserveAll(t.obt,t.tgtFlt),t.obmp&&z(t.obmp),t.src=void 0},map:n,_def:t}).constructor=n,t},a.advSet=function(){a=this,l=c.advanced,t._jsv=l._jsv?{cbBindings:j}:void 0},a._dp=O,a._gck=T,a._obs=r,c._cchCt=0,l=c.advanced=l||{useViews:!1,_jsv:!1}}return e},window); +/*! JsObservable v1.0.11: http://jsviews.com/#jsobservable */ +!function(t,e){var n=e.jQuery;"object"==typeof exports?module.exports=n?t(e,n):function(n){return t(e,n)}:"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):t(e,!1)}(function(t,e){"use strict";var n=e===!1;if(e=e||t.jQuery,!e||!e.fn)throw"jquery.observable.js requires jQuery";var r,i,o="v1.0.11",s=e.views=e.views||n&&t.jsrender&&jsrender.views||{jsviews:o,sub:{settings:{}},settings:{advanced:function(t){return l=c.advanced=c.advanced||{_jsv:!0},t?("_jsv"in t&&(l._jsv=t._jsv),a.advSet(),s.settings):l}}},a=s.sub,c=a.settings,l=c.advanced,f=e.isFunction,p=e.expando,u=e.isArray,h="object";if(s.jsviews!==o)throw"jquery.observable.js requires jsrender.js "+o;if(!e.observe){var d=e.event.special,v=[].slice,_=[].splice,g=[].concat,b=parseInt,y=/\S+/g,m=/^[^.[]*$/,I=a.propChng=a.propChng||"propertyChange",w=a.arrChng=a.arrChng||"arrayChange",j={},x=I+".observe",A=1,k=1,C=1,F=e.data,P={},S=[],T=function(t){return t?t._cId=t._cId||".obs"+k++:""},V=function(t,e){return this._data=e,this._ns=t,this},q=function(t,e){return this._data=e,this._ns=t,this},D=function(t){return u(t)?[t]:t},O=function(t,e,n){t=t?u(t)?t:[t]:[];var r,i,o,s,a=o=e,c=t&&t.length,l=[];for(r=0;r1;)f=f[s.shift()];f&&l._setProperty(f,s[0],e,n,r)}return l},removeProperty:function(t){return this.setProperty(t,P),this},_setProperty:function(t,e,n,r,i){var o,s,a,c,l,p=e?t[e]:t;if(f(p)&&!f(n)){if(i&&!p.set)return;p.set&&(l=t._vw||t,s=p,o=s.set===!0?s:s.set,p=s.call(l))}(p!==n||r&&p!=n)&&(!(p instanceof Date&&n instanceof Date)||p>n||p-1&&(e=u(e)?e:[e],e.length&&this._insert(t,e)),this},_insert:function(t,e){var n=this._data,r=n.length;t>r&&(t=r),_.apply(n,[t,0].concat(e)),this._trigger({change:"insert",index:t,items:e},r)},remove:function(t,e){var n,r=this._data;return void 0===t&&(t=r.length-1),t=b(t),e=e?b(e):0===e?0:1,e>0&&t>-1&&(n=r.slice(t,t+e),(e=n.length)&&this._remove(t,e,n)),this},_remove:function(t,e,n){var r=this._data,i=r.length;r.splice(t,e),this._trigger({change:"remove",index:t,items:n},i)},move:function(t,e,n){return n=n?b(n):0===n?0:1,t=b(t),e=b(e),n>0&&t>-1&&e>-1&&t!==e&&this._move(t,e,n),this},_move:function(t,e,n){var r,i=this._data,o=i.length,s=t+n-o;s>0&&(n-=s),n&&(r=i.splice(t,n),e>i.length&&(e=i.length),_.apply(i,[e,0].concat(r)),e!==t&&this._trigger({change:"move",oldIndex:t,index:e,items:r},o))},refresh:function(t){function e(){i&&(a.insert(r-i,c),u+=i,n+=i,i=0,c=[])}var n,r,i,o,s,a=this,c=[],l=a._data,f=l.slice(),p=l.length,u=p,h=t.length;for(a._srt=!0,r=i=0;rr&&a.remove(r,u-r),a._srt=void 0,(p||h)&&a._trigger({change:"refresh",oldItems:f},p),a},_trigger:function(t,n,r){c._cchCt++;var i,o,s,a=this;e.hasData(o=a._data)&&(!r&&(s=a._batch)?(t._dly=!0,s.push([a,t,n]),a.async&&!s._go&&s.wait()):(i=o.length,o=e([o]),a._srt?t.refresh=!0:i!==n&&o.triggerHandler(I,{change:"set",path:"length",value:i,oldValue:n}),o.triggerHandler(w+(a._ns?"."+/^\S+/.exec(a._ns)[0]:""),t)))}},d[I]=d[w]={remove:function(t){var n,r,i,o,s,a=t.data;if(a&&(a.off=!0,a=a.cb)&&(n=j[a._cId])){for(i=e._data(this).events[t.type],o=i.length;o--&&!r;)r=(s=i[o].data)&&s.cb&&s.cb._cId===a._cId;r||(--n.len?delete n[F(this).obId]:delete j[a._cId])}}},s.map=function(t){function n(e,n,r,o){var s,a,c=this;c.src&&c.unmap(),n&&(n.map=c),(typeof e===h||f(e))&&(c.src=e,o?c.tgt=t.getTgt(e,n):(r&&(c.tgt=r.tgt||u(r)&&r),c.tgt=c.tgt||[],c.options=n||c.options,(a=c.update())?c=a:(t.obsSrc&&i(c.src).observeAll(c.obs=function(e,n){s||n.refresh||(s=!0,t.obsSrc(c,e,n),s=void 0)},c.srcFlt),t.obsTgt&&i(c.tgt).observeAll(c.obt=function(e,n){s||c.tgt._updt||(s=!0,t.obsTgt(c,e,n),s=void 0)},c.tgtFlt))))}return f(t)&&(t={getTgt:t}),t.baseMap&&(t=e.extend({},t.baseMap,t)),t.map=function(t,e,r,i){return new n(t,e,r,i)},(n.prototype={srcFlt:t.srcFlt||$,tgtFlt:t.tgtFlt||$,update:function(e){var n,r,o=this,s=o.tgt;if(!s._updt&&(s._updt=!0,n=o.options&&o.options.map,i(s).refresh(t.getTgt(o.src,o.options=e||o.options)),s._updt=!1,r=o.options&&o.options.map,r&&n!==r))return r},observe:function(t,n){var r=this,o=r.options;r.obmp&&z(r.obmp),r.obmp=function(){var t=n.fn(n.data,n.view,a)[o.index];e.extend(o.props,t.props),o.args=t.args,r.update()},i._apply(1,n.data,O(t,n.tag,r.obmp),r.obmp,n._ctxCb)},unmap:function(){var t=this;t.src&&t.obs&&i(t.src).unobserveAll(t.obs,t.srcFlt),t.tgt&&t.obt&&i(t.tgt).unobserveAll(t.obt,t.tgtFlt),t.obmp&&z(t.obmp),t.src=void 0},map:n,_def:t}).constructor=n,t},a.advSet=function(){a=this,l=c.advanced,t._jsv=l._jsv?{cbBindings:j}:void 0},a._dp=O,a._gck=T,a._obs=r,c._cchCt=0,l=c.advanced=l||{useViews:!1,_jsv:!1}}return e},window); //# sourceMappingURL=jquery.observable.min.js.map diff --git a/jquery.observable.min.js.map b/jquery.observable.min.js.map index d24e3a7..9ba0ca0 100644 --- a/jquery.observable.min.js.map +++ b/jquery.observable.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["jquery.observable.js"],"names":["factory","global","$","jQuery","exports","module","define","amd","setGlobals","fn","$observe","$observable","versionNumber","$views","views","jsrender","jsviews","sub","settings","advanced","value","$subSettingsAdvanced","$subSettings","_jsv","$sub","advSet","$isFunction","isFunction","$expando","expando","$isArray","isArray","OBJECT","observe","$eventSpecial","event","special","slice","splice","concat","PARSEINT","parseInt","rNotWhite","rShallowPath","propertyChangeStr","propChng","arrayChangeStr","arrChng","cbBindingsStore","observeStr","observeObjKey","observeCbKey","observeInnerCbKey","$data","data","remove","asyncBatch","getCbKey","cb","_cId","ObjectObservable","ns","this","_data","_ns","ArrayObservable","wrapArray","dependsPaths","paths","root","callback","i","path","object","rt","nextObj","l","length","out","tagName","linkCtx","call","push","undefined","unshift","_ar","onDataChange","ev","eventArgs","isOb","val","noArray","off","allPath","filter","parentObs","oldValue","ctx","observeAll","_arOk","type","array","prop","_path","target","parents","observe_apply","args","apply","arguments","shift","$observeAll","unobserve","$unobserveAll","namespace","objMap","observeArrayItems","arr","unobs","newAllPath","filterAndObserveAll","obj","nestedArray","newObject","newParentObs","_fltr","nextParentObs","updatedTgt","wrappedCb","change","items","_wrp","isObject","obId","notRemoving","un","hasData","shallowFilter","test","$unobserve","batchTrigger","async","batch","_go","skip","_trigger","innerObserve","unobserveBinding","binding","bindArray","observeOnOff","fullPath","pathStr","isArrayBinding","j","evData","dataOb","boundObOrArr","prntObs","allPth","initialNs","events","el","allowArray","replace","all","inArray","on","cbBindings","len","unbind","relPath","prevAllPath","observeObjects","observeObjectPaths","pths","contextCb","getInnerCb","exprOb","ob","sb","newObj","observePath","prts","obArrAddRemove","arrIndex","dep","obArr","prt","fnProp","isGet","_cxp","depth","nodeType","_inId","join","observable","depends","_vw","_ocp","_tgId","tagCtx","view","_is","_gccb","contentView","parts","split","pth","_cpfn","innerCb","bnd","prm","p","cbId","inId","initNsArr","initNsArrLen","lastArg","pop","m","match","s","wait","setTimeout","trigger","delay","asyncObserve","_batch","set","Object","Array","_apply","prototype","unobserveAll","setProperty","nonStrict","isCpfn","key","pair","tempBatch","multi","self","name","_setProperty","removeProperty","leaf","setter","getter","removeProp","property","Date","ctxPrm","_key","force","_cchCt","previous","triggerHandler","exec","insert","index","_insert","oldLength","numToRemove","_remove","move","oldIndex","newIndex","numToMove","_move","excess","refresh","newItems","insertAdded","k","addedItems","dataLength","newItem","num","oldItems","newLength","_srt","_dly","handleObj","found","map","mapDef","Map","source","options","oldMapOrTarget","unbound","changing","updatedMap","src","unmap","tgt","getTgt","update","obsSrc","obs","srcFlt","obsTgt","obt","_updt","tgtFlt","baseMap","extend","oldMap","newMap","deps","obmp","newTagCtx","props","tag","_ctxCb","_def","constructor","_dp","_gck","_obs","useViews","window"],"mappings":";CAWC,SAASA,EAASC,GAElB,GAAIC,GAAID,EAAOE,MAEQ,iBAAZC,SACVC,OAAOD,QAAUF,EACdF,EAAQC,EAAQC,GAChB,SAASA,GACV,MAAOF,GAAQC,EAAQC,IAEG,kBAAXI,SAAyBA,OAAOC,IACjDD,QAAQ,UAAW,SAASJ,GAC3B,MAAOF,GAAQC,EAAQC,KAGxBF,EAAQC,GAAQ,IAKlB,SAASA,EAAQC,GACjB,YAKA,IAAIM,GAAaN,KAAM,CAIvB,IAFAA,EAAIA,GAAKD,EAAOE,QAEXD,IAAMA,EAAEO,GAEZ,KAAM,sCAGP,IAECC,GAAUC,EAFPC,EAAgB,UAInBC,EAASX,EAAEY,MACVZ,EAAEY,OACFN,GAAcP,EAAOc,UAAYA,SAASD,QAEzCE,QAASJ,EACTK,KACCC,aAEDA,UACCC,SAAU,SAASC,GAElB,MADAC,GAAuBC,EAAaH,SAAWG,EAAaH,WAAaI,MAAM,GACxEH,GAEL,QAAUA,KAAUC,EAAqBE,KAAOH,EAAMG,MACtDC,EAAKC,SACLZ,EAAOK,UAENG,KAIPG,EAAOX,EAAOI,IACdK,EAA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EAAWkJ,EAAI0B,MAEhB1B,EAAI0B,KAAO,WAEV,GAAIC,GAAYxO,EAAQvE,GAAGuE,EAAQ1B,KAAM0B,EAAQ0H,KAAMlL,GAAMyQ,EAAQ7B,MACrElQ,GAAEiT,OAAOlB,EAAQwB,MAAOD,EAAUC,OAClCxB,EAAQtL,KAAO6M,EAAU7M,KACzBkL,EAAIa,UAEL/R,EAAY6N,OAAO,EAAGxJ,EAAQ1B,KAAMa,EAAamP,EAAMtO,EAAQ0O,IAAK7B,EAAI0B,MAAO1B,EAAI0B,KAAMvO,EAAQ2O,SAElGpB,MAAO,WACN,GAAIV,GAAM/N,IACN+N,GAAIS,KAAOT,EAAIe,KAClBjS,EAAYkR,EAAIS,KAAK5D,aAAamD,EAAIe,IAAKf,EAAIgB,QAE5ChB,EAAIW,KAAOX,EAAIkB,KAClBpS,EAAYkR,EAAIW,KAAK9D,aAAamD,EAAIkB,IAAKlB,EAAIoB,QAE5CpB,EAAI0B,MACP5K,EAAWkJ,EAAI0B,MAEhB1B,EAAIS,IAAMnN,QAEX0M,IAAKE,EACL6B,KAAM9B,IACJ+B,YAAc9B,EAEVD,GAGRtQ,EAAKC,OAAS,WACbD,EAAOsC,KACPzC,EAAuBC,EAAaH,SACpClB,EAAOsB,KAAOF,EAAqBE,MAEhCiJ,WAAYxH,GAEZmC,QAEJ3D,EAAKsS,IAAM3P,EACX3C,EAAKuS,KAAOtQ,EACZjC,EAAKwS,KAAOtT,EACZY,EAAayO,OAAS,EACtB1O,EAAuBC,EAAaH,SAAWE,IAC9C4S,UAAU,EACV1S,MAAM,GAIR,MAAOrB,IACJgU","file":"jquery.observable.min.js","sourcesContent":["/*! JsObservable v1.0.10: http://jsviews.com/#jsobservable */\n/*\n * Subcomponent of JsViews\n * Data change events for data-linking\n *\n * Copyright 2021, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take jQuery passed as parameter: require(\"jsobservable\")(jQuery)\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine([\"jquery\"], function($) {\n\t\t\treturn factory(global, $); // Require jQuery\n\t\t});\n\t} else { // Browser using plain ',Je='',Je='',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousSibling;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastChild;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild,\n\t\t\t\t\t\t// since we have removed white space within elCnt. Hence support IE < 9\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\t\ttmpl = currentView.tmpl;\n\t\tlinkMarkup = normalizeLinkTag(linkMarkup, defaultAttr(node));\n\t\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = linkExprStore[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\tlinkExprStore[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup, or for a linkedElement\n\tfunction handler(ev, eventArgs) {\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t\tif (!eventArgs || !eventArgs.refresh) {\n\t\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t}\n\t}\n\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\n\tif (linkCtx.elem.nodeName === \"SELECT\"\n\t\t&& (linkCtx.elem._jsvLkEl // A SELECT which is a linkedElement\n\t\t|| (linkCtxType === \"link\" && !linkCtx.attr && linkCtx.convert !== undefined))) { // A SELECT with a data-link binding (the assign tag {:...}, not another expression such as {on ...} (See https://github.com/BorisMoore/jsviews/issues/444))\n\t\t\tvar source,\n\t\t\t\telem = linkCtx.elem,\n\t\t\t\t$elem = $(elem);\n\t\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\t\tif (elem._jsvLkEl) {\n\t\t\t\t\t\t$elem.val(elem._jsvLkEl.cvtArgs(elem._jsvElse, 1)[elem._jsvInd]); // SELECT is a linkedElement, so set to value of bndArgs(elseIndex)[bindToIndex]\n\t\t\t\t\t} else if (linkCtx.tag) {\n\t\t\t\t\t\t$elem.val(linkCtx.tag.cvtArgs(0,1)); // SELECT with data-link expression with convert=... convertBack=...\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsource = linkCtx.fn(view.data, view, $sub); // SELECT with data-link expression (either data-link='expression', or data-link='{cvt:expression:cvtBk}')\n\t\t\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\t// If the bound property or arg has not yet been set (e.g. during initial rendering),\n\t\t\t\t// or has been unset, because onUpdate is set to true, or if onUpdate is false,\n\t\t\t\t// but this particular bound arg/prop is being changed observably: call setValue()\n\t\t\t\ttag.setValue(props[l], l, m, ev, eventArgs);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tif (tag._tgId) {\n\t\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex, isCpfn,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tisCpfn = lastPath._cpfn && !lastPath.sb; // leaf binding to computed property/function \"a.b.c()\"\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tto.isCpfn = isCpfn;\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"))) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$extend(tagCtx.ctx, newTagCtx.ctx); // We don't support propagating ctx variables, ~foo, observably, to nested views. So extend, not setProperty...\n\t\t\ttagCtx.args = newTagCtx.args;\n\t\t\tif (refresh) {\n\t\t\t\ttagCtx.tmpl = newTagCtx.tmpl;\n\t\t\t}\n\t\t\t$observable(tagCtx.props).setProperty(newTagCtx.props);\n\t\t}\n\t}\n\t$sub._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\tif (object = binding.bnd[objId]) {\n\t\t\t\tobsId = binding.cbId;\n\t\t\t\tif ($isArray(object)) {\n\t\t\t\t\t$([object]).off(arrayChangeStr + obsId).off(propertyChangeStr + obsId); // There may be either or both of arrayChange and propertyChange\n\t\t\t\t} else {\n\t\t\t\t\t$(object).off(propertyChangeStr + obsId);\n\t\t\t\t}\n\t\t\t\tdelete binding.bnd[objId];\n\t\t\t}\n\t\t}\n\n\t\tif (linkCtx = binding.linkCtx) {\n\t\t\tif (tag = linkCtx.tag) {\n\t\t\t\tif (tagCtxs = tag.tagCtxs) {\n\t\t\t\t\tl = tagCtxs.length;\n\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete binding.s[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments),\n\t\t// Now set also delimOpenChar0 etc. in context of jquery.views.js...\n\t\tdelimChars = $subSettings.delimiters;\n\n\tdelimOpenChar0 = delimChars[0].charAt(0);\n\tdelimOpenChar1 = delimChars[0].charAt(1);\n\tdelimCloseChar0 = delimChars[1].charAt(0);\n\tdelimCloseChar1 = delimChars[1].charAt(1);\n\tlinkChar = delimChars[2];\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tif (arguments.length < 4) {\n\t\tif (+index !== index) {\n\t\t\tasync = index;\n\t\t\ttagElse = index = 0;\n\t\t} else if (+tagElse !== tagElse) {\n\t\t\tasync = tagElse;\n\t\t\ttagElse = 0;\n\t\t}\n\t}\n\tvalues[index||0] = val;\n\tupdateValues(values, tagElse, async, bindId, ev);\n\treturn self;\n}\n\nfunction setValues() {\n\t// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = this.tag.bindTo.length,\n\t\tev = arguments[m],\n\t\teventArgs = arguments[m+1];\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index, ev, eventArgs);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\tselect = deep ? select || \"*\" : select;\n\t\t\tfiltered = select ? nodes.filter(select) : nodes;\n\t\t\tnodes = deep ? filtered.add(nodes.find(select)) : filtered;\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse, ev, eventArgs) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, indexTo, linkedElems, newVal,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse];\n\n\t\t\t\tif (tagCtx._bdArgs && (eventArgs || val !== undefined) && tagCtx._bdArgs[indexFrom]===val\n\t\t\t\t\t&& (!eventArgs || eventArgs.change !== \"set\" || ev.target !== val && eventArgs.value !== val)) {\n\n\t\t\t\t\tif (tagCtx._bdVals) { // If val is not undefined (or is coming from an observable change event), and is a value that was already returned, use stored value and don't call tag.setValue()\n\t\t\t\t\t\tval = tagCtx._bdVals[indexFrom];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Call tag method tag.setValue(), if implemented\n\t\t\t\t\ttagCtx._bdArgs = tagCtx._bdArgs || [];\n\t\t\t\t\ttagCtx._bdArgs[indexFrom] = val;\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse, ev, eventArgs);\n\t\t\t\t\tif (newVal !== undefined) {\n\t\t\t\t\t\ttagCtx._bdVals = tagCtx._bdVals || [];\n\t\t\t\t\t\ttagCtx._bdVals[indexFrom] = newVal; // store value, so that if same value is called later we'll use the stored value, and won't call tag.setValue()\n\t\t\t\t\t\tval = newVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val !== undefined && (linkedCtxParam = theTag.linkedCtxParam) && linkedCtxParam[indexFrom]) {\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxParam[indexFrom], val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = $.isArray(val)\n\t\t\t\t\t\t\t\t\t\t\t\t? $.inArray(linkedEl.value, val) > -1\n\t\t\t\t\t\t\t\t\t\t\t\t: val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\tvar tagElse, async,\n\t\t\t\ttag = this,\n\t\t\t\tbindToLength = tag.bindTo ? tag.bindTo.length : 1,\n\t\t\t\textra = arguments.length - bindToLength;\n\n\t\t\tif (extra) {\n\t\t\t\ttagElse = arguments[bindToLength];\n\t\t\t\tif (extra > 1) {\n\t\t\t\t\tasync = extra > 1 ? arguments[bindToLength + 1] : undefined;\n\t\t\t\t} else if (+tagElse !== tagElse) {\n\t\t\t\t\tasync = tagElse;\n\t\t\t\t\ttagElse = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn updateValues(arguments, tagElse, async, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems, delayed) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false\n\t\t\t\t\t&& !view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, delayed) {\n\t\t\t// view.removeViews() removes all the child views\n\t\t\t// view.removeViews(index) removes the child view with specified index or key\n\t\t\t// view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index\n\t\t\tfunction removeView(index) {\n\t\t\t\tvar id, bindId, parentElem, prevNode, nextNode, nodesToRemove,\n\t\t\t\t\tviewToRemove = views[index];\n\n\t\t\t\tif (viewToRemove && viewToRemove.link) {\n\t\t\t\t\tid = viewToRemove._.id;\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tnodesToRemove = viewToRemove.nodes();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove child views, without removing nodes\n\t\t\t\t\tviewToRemove.removeViews(undefined, undefined, true);\n\n\t\t\t\t\tviewToRemove.type = undefined; // Set type to undefined: used as a flag that this view is being removed\n\t\t\t\t\tprevNode = viewToRemove._prv;\n\t\t\t\t\tnextNode = viewToRemove._nxt;\n\t\t\t\t\tparentElem = viewToRemove.parentElem;\n\t\t\t\t\t// If prevNode and nextNode are the same, the view is empty\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tif (viewToRemove._elCnt) {\n\t\t\t\t\t\t\t// if keepNodes is false (and transferring of tokens has not already been done at a higher level)\n\t\t\t\t\t\t\t// then transfer tokens from prevNode which is being removed, to nextNode.\n\t\t\t\t\t\t\ttransferViewTokens(prevNode, nextNode, parentElem, id, \"_\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(nodesToRemove).remove();\n\t\t\t\t\t}\n\t\t\t\t\tif (!viewToRemove._elCnt && prevNode) {\n\t\t\t\t\t\tprevNode.parentNode.removeChild(prevNode); // (prevNode.parentNode is parentElem, except if jQuery Mobile or similar has inserted an intermediate wrapper\n\t\t\t\t\t\tnextNode.parentNode.removeChild(nextNode);\n\t\t\t\t\t}\n\t\t\t\t\tsetArrayChangeLink(viewToRemove);\n\t\t\t\t\tfor (bindId in viewToRemove._.bnds) {\n\t\t\t\t\t\tremoveViewBinding(bindId);\n\t\t\t\t\t}\n\t\t\t\t\tdelete viewStore[id];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar current, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar tag,\n\t\t\t\t\tprv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\ttag = bindingStore[id].linkCtx.tag;\n\t\t\t\t\tif (tag.inline) {\n\t\t\t\t\t\ttag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\n\treturn $;\n}, window));\n"]} \ No newline at end of file +{"version":3,"sources":["jquery.views.js"],"names":["factory","global","$","jQuery","exports","module","define","amd","jsr","jso","updateValues","sourceValues","tagElse","async","bindId","ev","linkCtx","cvtBack","cnvtName","target","view","binding","sourceValue","origVals","sourceElem","sourceEl","tos","to","tcpTag","exprOb","contextCb","l","m","tag","vals","ind","_tgId","bindTo","defineBindToDataTargets","bindingStore","elem","_cxp","path","_ocp","_","chg","convertBack","$isFunction","getRsc","nodeName","multiple","_jsvSel","$inArray","value","checked","splice","push","slice","length","apply","undefined","$isArray","arg0","data","_vw","onBeforeUpdateVal","change","index","toIndex","updateValue","setValue","_jsvInd","_jsvLkEl","fromIndex","_jsvElse","_cpfn","_ctxCb","_cpCtx","sb","$observable","setProperty","isCpfn","onElemChange","val","source","fromAttr","defaultAttr","setter","fnSetters","_jsvTr","delegateTarget","activeBody","type","attr","_jsvChg","rSplitBindings","lastIndex","exec","_jsvBnd","onDataLinkedTagChange","eventArgs","noUpdate","forceUpdate","hasError","onError","bindEarly","tagCtx","this","linkFn","fn","cvt","convert","parentElem","parentNode","oldLinkCtx","_lc","onEvent","changeHandler","onBeforeChangeStr","call","prop","_toLk","_er","$sub","e","onRenderError","Function","props","args","_dfAt","VALUE","CHECKBOX","CHECKED","onUpdate","mergeCtxs","HTML","NONE","callAfterLink","observeAndBind","onAfterChangeStr","dataMap","map","isRenderCall","bnd","onUnbind","ctx","linkedElems","linkedElem","mainElem","displayElem","tagCtxs","tagName","_cnvt","_tag","tmpl","TRUE","addLinkMethods","inline","_lr","template","updateContent","_noUpd","ths","setDefer","_df","deferAttr","prevNode","nextNode","late","nodesToRemove","useProp","tokens","id","openIndex","closeIndex","testElem","cStyle","jsvSel","renders","targetParent","$target","targetVal","_val","unlinked","expr","_elCnt","_prv","_nxt","test","currentStyle","getComputedStyle","display","_jsvd","displayStyles","document","createElement","body","appendChild","removeChild","style","name","RADIO","nodes","transferViewTokens","getAttribute","jsvAttrStr","indexOf","disposeTokens","setAttribute","previousSibling","lastChild","remove","link","empty","children","TEXTCONTENT","selected","lateLink","arrayChangeHandler","self","onBeforeChange","onAfterChange","action","items","srt","refresh","addViews","_dly","removeViews","moveViews","oldIndex","fixIndex","setArrayChangeLink","handler","arrayBinding","bound","useKey","bndArr","off","arrayChangeStr","arrVws","arguments","on","linkGetVal","toLowerCase","$subSettingsAdvanced","_fe","contentEditable","from","renderAndLink","views","context","html","linkToNode","prevView","elCnt","error","bnds","removeViewBinding","nextSibling","render","addBindingMarkers","end","bindingKey","viewStore","k","exprFnDeps","propDeps","depends","tagDepends","allowArray","cvtBk","_hdl","_dp","concat","_depends","deps","bdId","_apply","boundProps","paths","skp","onArrayChange","$extend","_bndId","bindLinkedElChange","flow","lnkCtx","pop","tmplLink","noIteration","parentView","$link","tmplOrLinkExpr","jquery","useInput","elementChangeStr","i","vwInfos","placeholderParent","targetEl","prntView","onRender","replaceMode","$view","addDataBinding","markup","scp","cleanData","topView","lnk","viewInfos","rOpenViewMarkers","parent","key","viewLink","outerData","validateOnly","convertMarkers","all","preceding","selfClose","closeTag","spaceBefore","boundId","spaceAfter","tag1","tag2","closeTag2","spaceAfterClose","selfClose2","endOpenTag","errorMsg","bndId","endOfElCnt","inTag","isVoid","parentTag","tagStack","shift","validate","voidElems","join","syntaxError","prevElCnt","elContent","defer","ids","openScript","closeScript","deferStack","charAt","unshift","badParent","processViewInfos","deferPath","deferChar","bindChar","onAftCr","deep","addedBindEls","_tkns","len","vwInfo","ch","j","previousElementSibling","lastElementChild","open","removeSubStr","onAfterCreateStr","onAfterCreate","bindEls","getViewInfos","level","named","_is","tagDepth","tags","dataLink","wrap","selector","linkViewsSel","get","elems","qsa","querySelectorAll","innerHTML","prevNodes","found","markerNodeInfo","contains","isLink","rViewMarkers","skip","processInfos","$viewsLinkAttr","rOpenTagMarkers","unmarkPrevOrNextNode","prevIds","linkInfo","token","nextView","node","depth","fragment","copiedNode","firstTag","wrapper","div","htmlTag","thisId","noValidate","markPrevOrNextNode","namespaceURI","rFirstElem","replace","rConvertMarkers","safeFragment","wrapMap","createDocumentFragment","firstChild","insertBefore","linkMarkup","currentView","boundTagId","tagExpr","rTagIndex","hasElse","linkExpressions","bindDataLinkTarget","normalizeLinkTag","rTagDatalink","delimCloseChar1","delimOpenChar0","delimOpenChar1","delimCloseChar0","linkExprStore","tmplFn","rEscapeQuotes","linkCtxType","View","extendCtx","_gccb","$elem","cvtArgs","str","substr","SCRIPT","nodeType","isVal","rBinding","getInfos","close","elPath","infos","rMarkerTokens","removeAttribute","marker","twoway","trim","copyFromTagCtxToTag","linkedElements","$linkCtxElem","linkCtxElem","linkedEl","linkedTag","tagCtxElse","oldVal","indexTo","mapDeps","tagCtxslength","linkedElement","mainElement","displayElement","filter","Array","contents","eq","onBind","mapProps","mapDepends","observe","setSize","height","width","className","_jsvCl","hasClass","removeClass","addClass","onAfterLink","lt","asyncOnElemChange","which","setTimeout","bindTriggerEvent","trig","onoff","isIE","$linkedElem","newTrig","oldTrig","trigger","$subSettings","pathIndex","lastPath","bindtoOb","obsCtxPrm","linkedCtxParam","targetPaths","bindTos","targetPathsElses","_jsvto","resolveDataTargetPath","targetPath","topCp","split","newCtxs","newTagCtx","_thp","clean","bindings","elemArray","linkedElemTag","objId","object","obsId","allLinkedElems","cbId","propertyChangeStr","unmap","onDispose","s","$unlink","each","innerView","getElementsByTagName","inputAttrib","ctxPrm","$views","helpers","viewOrTagChar","viewOrTag","viewId","precedingLength","emptyView","vwItem","rOpenMarkers","values","setValues","tagOrView","bindFrom","theTag","theView","select","filtered","add","find","withMarkers","contentView","prevIsFirstNode","lastSibling","childTags","_gm","constructor","prototype","indexFrom","newVal","_bdArgs","base","_bdVals","isArray","inArray","bindToLength","extra","domChange","hasListener","_data","events","domChangeNotification","triggerHandler","dataItems","delayed","viewsCount","itemsCount","keepNodes","removeView","viewToRemove","current","childView","parts","itemView","RegExp","setPrv","prv","rTagMarkers","selfNxt","backwards","firstChange","lastChange","movedNodes","viewsToMove","appendTo","afterParts","endChange","startView","endView","afterView","startParts","endParts","observeProps","options","updatePropsArr","propsArr","sort","start","step","reverse","update","tgt","insert","observeMappedProps","src","removeProperty","oldValue","shallowArrayFilter","rShallowArrayPath","setGlobals","jsrender","versionNumber","requiresStr","sub","_jq","$observe","jsviews","linkChar","$viewsSettings","settings","extend","isFunction","$converters","expando","converters","$tags","advanced","propChng","arrChng","syntaxErr","_err","oldAdvSet","window","navigator","userAgent","textContent","RADIOINPUT","CHECKBOXINPUT","bindElsSel","input","text","valueBinding","isCleanCall","oldCleanData","oldJsvDelimiters","delimiters","querySelector","ol","ul","table","tbody","thead","tfoot","tr","colgroup","dl","optgroup","svg","svg_ns","br","img","hr","area","col","meta","command","embed","keygen","param","track","wbr","rViewPath","observable","_clFns","onStore","item","parentTmpl","ret","delimChars","rTag","addSetting","merge","regularExpression","currentValue","toggle","init","content","_hi","rTmpl","params","activeElem","contextOb","_sel","_evs","_hlr","oldIsCleanCall","contentCtx","dataBoundOnly","radiogroup","Math","random","domChngCntnr","useDisable","disabled","_dmChg","forOrIfTagCtx","parentTags","propParams","checkboxgroup","tgCtxProps","linkExpr","sortDataMap","getTgt","obsSrc","obsTgt","arrayView","targetLength","rendering","noVws","done","setDataMap","arrayBindings","_ars","tagCt","paged","sorted","newTagCtxs","prevArg","different","tci","baseTag","tgtFlt","inner","getInnerView","nd","isVl","unlink","oldFn","result","links","0","_glt","regEx","linkCtxs","helper","last","nextPath","addedTagCpDep","cache","getCache","_cpKey","_cp","paramVal","paramExpr","tagCtxPrm","linked","_ucp","_ceo","cloneExprObjects","obs","ob","clones","prm","advSet","_jsv","linkAttr","_wm","option","caption","th","td","useViews","legend","support","htmlSerialize","textarea"],"mappings":";CAeC,SAASA,EAASC,GAElB,GAAIC,GAAID,EAAOE,MAEQ,iBAAZC,SACVC,OAAOD,QAAUF,EACdF,EAAQC,EAAQC,GAChB,SAASA,GACV,MAAOF,GAAQC,EAAQC,IAEG,kBAAXI,SAAyBA,OAAOC,IACjDD,QAAQ,SAAU,aAAc,uBAAwB,SAASJ,EAAGM,EAAKC,GACxE,MAAOT,GAAQC,EAAQC,EAAGM,EAAKC,KAGhCT,EAAQC,GAAQ,IAKlB,SAASA,EAAQC,EAAGM,EAAKC,GACzB,YAiJA,SAASC,GAAaC,EAAcC,EAASC,EAAOC,EAAQC,GAI3D,GAAIC,GAASC,EAASC,EAAUC,EAAQC,EAAMC,EAASC,EAAaC,EAAUC,EAAYC,EACzFC,EAAKC,EAAIC,EAAQC,EAAQC,EAAWC,EAAGC,E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Render templates.\n * Subcomponent of JsViews\n * Requires jQuery and jsrender.js (Best-of-breed templating in browser or on Node.js)\n * See JsRender at http://jsviews.com/#download and http://github.com/BorisMoore/jsrender\n * Also requires jquery.observable.js\n * See JsObservable at http://jsviews.com/#download and http://github.com/BorisMoore/jsviews\n *\n * Copyright 2021, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take jQuery passed as parameter (with JsRender and JsObservable): require(\"jquery.views\")(jQuery)\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine([\"jquery\", \"./jsrender\", \"./jquery.observable\"], function($, jsr, jso) {\n\t\t\treturn factory(global, $, jsr, jso);\n\t\t}); // Require jQuery, JsRender, JsObservable\n\t} else { // Browser using plain ',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousElementSibling; // IE9 or later only\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastElementChild; // IE9 or later only\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\t\ttmpl = currentView.tmpl;\n\t\tlinkMarkup = normalizeLinkTag(linkMarkup, defaultAttr(node));\n\t\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = linkExprStore[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\tlinkExprStore[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup, or for a linkedElement\n\tfunction handler(ev, eventArgs) {\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t\tif (!eventArgs || !eventArgs.refresh) {\n\t\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t}\n\t}\n\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\n\tif (linkCtx.elem.nodeName === \"SELECT\"\n\t\t&& (linkCtx.elem._jsvLkEl // A SELECT which is a linkedElement\n\t\t|| (linkCtxType === \"link\" && !linkCtx.attr && linkCtx.convert !== undefined))) { // A SELECT with a data-link binding (the assign tag {:...}, not another expression such as {on ...} (See https://github.com/BorisMoore/jsviews/issues/444))\n\t\t\tvar source,\n\t\t\t\telem = linkCtx.elem,\n\t\t\t\t$elem = $(elem);\n\t\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\t\tif (elem._jsvLkEl) {\n\t\t\t\t\t\t$elem.val(elem._jsvLkEl.cvtArgs(elem._jsvElse, 1)[elem._jsvInd]); // SELECT is a linkedElement, so set to value of bndArgs(elseIndex)[bindToIndex]\n\t\t\t\t\t} else if (linkCtx.tag) {\n\t\t\t\t\t\t$elem.val(linkCtx.tag.cvtArgs(0,1)); // SELECT with data-link expression with convert=... convertBack=...\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsource = linkCtx.fn(view.data, view, $sub); // SELECT with data-link expression (either data-link='expression', or data-link='{cvt:expression:cvtBk}')\n\t\t\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\t// If the bound property or arg has not yet been set (e.g. during initial rendering),\n\t\t\t\t// or has been unset, because onUpdate is set to true, or if onUpdate is false,\n\t\t\t\t// but this particular bound arg/prop is being changed observably: call setValue()\n\t\t\t\ttag.setValue(props[l], l, m, ev, eventArgs);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tif (tag._tgId) {\n\t\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex, isCpfn,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tisCpfn = lastPath._cpfn && !lastPath.sb; // leaf binding to computed property/function \"a.b.c()\"\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tto.isCpfn = isCpfn;\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"))) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$extend(tagCtx.ctx, newTagCtx.ctx); // We don't support propagating ctx variables, ~foo, observably, to nested views. So extend, not setProperty...\n\t\t\ttagCtx.args = newTagCtx.args;\n\t\t\tif (refresh) {\n\t\t\t\ttagCtx.tmpl = newTagCtx.tmpl;\n\t\t\t}\n\t\t\t$observable(tagCtx.props).setProperty(newTagCtx.props);\n\t\t}\n\t}\n\t$sub._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\tif (object = binding.bnd[objId]) {\n\t\t\t\tobsId = binding.cbId;\n\t\t\t\tif ($isArray(object)) {\n\t\t\t\t\t$([object]).off(arrayChangeStr + obsId).off(propertyChangeStr + obsId); // There may be either or both of arrayChange and propertyChange\n\t\t\t\t} else {\n\t\t\t\t\t$(object).off(propertyChangeStr + obsId);\n\t\t\t\t}\n\t\t\t\tdelete binding.bnd[objId];\n\t\t\t}\n\t\t}\n\n\t\tif (linkCtx = binding.linkCtx) {\n\t\t\tif (tag = linkCtx.tag) {\n\t\t\t\tif (tagCtxs = tag.tagCtxs) {\n\t\t\t\t\tl = tagCtxs.length;\n\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete binding.s[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments),\n\t\t// Now set also delimOpenChar0 etc. in context of jquery.views.js...\n\t\tdelimChars = $subSettings.delimiters;\n\n\tdelimOpenChar0 = delimChars[0].charAt(0);\n\tdelimOpenChar1 = delimChars[0].charAt(1);\n\tdelimCloseChar0 = delimChars[1].charAt(0);\n\tdelimCloseChar1 = delimChars[1].charAt(1);\n\tlinkChar = delimChars[2];\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tif (arguments.length < 4) {\n\t\tif (+index !== index) {\n\t\t\tasync = index;\n\t\t\ttagElse = index = 0;\n\t\t} else if (+tagElse !== tagElse) {\n\t\t\tasync = tagElse;\n\t\t\ttagElse = 0;\n\t\t}\n\t}\n\tvalues[index||0] = val;\n\tupdateValues(values, tagElse, async, bindId, ev);\n\treturn self;\n}\n\nfunction setValues() {\n\t// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = this.tag.bindTo.length,\n\t\tev = arguments[m],\n\t\teventArgs = arguments[m+1];\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index, ev, eventArgs);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\tselect = deep ? select || \"*\" : select;\n\t\t\tfiltered = select ? nodes.filter(select) : nodes;\n\t\t\tnodes = deep ? filtered.add(nodes.find(select)) : filtered;\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse, ev, eventArgs) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, indexTo, linkedElems, newVal,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse];\n\n\t\t\t\tif (tagCtx._bdArgs && (eventArgs || val !== undefined) && tagCtx._bdArgs[indexFrom]===val\n\t\t\t\t\t&& (!eventArgs || eventArgs.change !== \"set\" || ev.target !== val && eventArgs.value !== val)) {\n\n\t\t\t\t\tif (tagCtx._bdVals) { // If val is not undefined (or is coming from an observable change event), and is a value that was already returned, use stored value and don't call tag.setValue()\n\t\t\t\t\t\tval = tagCtx._bdVals[indexFrom];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Call tag method tag.setValue(), if implemented\n\t\t\t\t\ttagCtx._bdArgs = tagCtx._bdArgs || [];\n\t\t\t\t\ttagCtx._bdArgs[indexFrom] = val;\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse, ev, eventArgs);\n\t\t\t\t\tif (newVal !== undefined) {\n\t\t\t\t\t\ttagCtx._bdVals = tagCtx._bdVals || [];\n\t\t\t\t\t\ttagCtx._bdVals[indexFrom] = newVal; // store value, so that if same value is called later we'll use the stored value, and won't call tag.setValue()\n\t\t\t\t\t\tval = newVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val !== undefined && (linkedCtxParam = theTag.linkedCtxParam) && linkedCtxParam[indexFrom]) {\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxParam[indexFrom], val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = $.isArray(val)\n\t\t\t\t\t\t\t\t\t\t\t\t? $.inArray(linkedEl.value, val) > -1\n\t\t\t\t\t\t\t\t\t\t\t\t: val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\tvar tagElse, async,\n\t\t\t\ttag = this,\n\t\t\t\tbindToLength = tag.bindTo ? tag.bindTo.length : 1,\n\t\t\t\textra = arguments.length - bindToLength;\n\n\t\t\tif (extra) {\n\t\t\t\ttagElse = arguments[bindToLength];\n\t\t\t\tif (extra > 1) {\n\t\t\t\t\tasync = extra > 1 ? arguments[bindToLength + 1] : undefined;\n\t\t\t\t} else if (+tagElse !== tagElse) {\n\t\t\t\t\tasync = tagElse;\n\t\t\t\t\ttagElse = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn updateValues(arguments, tagElse, async, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems, delayed) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false\n\t\t\t\t\t&& !view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, delayed) {\n\t\t\t// view.removeViews() removes all the child views\n\t\t\t// view.removeViews(index) removes the child view with specified index or key\n\t\t\t// view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index\n\t\t\tfunction removeView(index) {\n\t\t\t\tvar id, bindId, parentElem, prevNode, nextNode, nodesToRemove,\n\t\t\t\t\tviewToRemove = views[index];\n\n\t\t\t\tif (viewToRemove && viewToRemove.link) {\n\t\t\t\t\tid = viewToRemove._.id;\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tnodesToRemove = viewToRemove.nodes();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove child views, without removing nodes\n\t\t\t\t\tviewToRemove.removeViews(undefined, undefined, true);\n\n\t\t\t\t\tviewToRemove.type = undefined; // Set type to undefined: used as a flag that this view is being removed\n\t\t\t\t\tprevNode = viewToRemove._prv;\n\t\t\t\t\tnextNode = viewToRemove._nxt;\n\t\t\t\t\tparentElem = viewToRemove.parentElem;\n\t\t\t\t\t// If prevNode and nextNode are the same, the view is empty\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tif (viewToRemove._elCnt) {\n\t\t\t\t\t\t\t// if keepNodes is false (and transferring of tokens has not already been done at a higher level)\n\t\t\t\t\t\t\t// then transfer tokens from prevNode which is being removed, to nextNode.\n\t\t\t\t\t\t\ttransferViewTokens(prevNode, nextNode, parentElem, id, \"_\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(nodesToRemove).remove();\n\t\t\t\t\t}\n\t\t\t\t\tif (!viewToRemove._elCnt && prevNode) {\n\t\t\t\t\t\tprevNode.parentNode.removeChild(prevNode); // (prevNode.parentNode is parentElem, except if jQuery Mobile or similar has inserted an intermediate wrapper\n\t\t\t\t\t\tnextNode.parentNode.removeChild(nextNode);\n\t\t\t\t\t}\n\t\t\t\t\tsetArrayChangeLink(viewToRemove);\n\t\t\t\t\tfor (bindId in viewToRemove._.bnds) {\n\t\t\t\t\t\tremoveViewBinding(bindId);\n\t\t\t\t\t}\n\t\t\t\t\tdelete viewStore[id];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar current, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar tag,\n\t\t\t\t\tprv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\ttag = bindingStore[id].linkCtx.tag;\n\t\t\t\t\tif (tag.inline) {\n\t\t\t\t\t\ttag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\n\treturn $;\n}, window));\n"]} \ No newline at end of file diff --git a/jsrender.js b/jsrender.js index bd8533d..501f1f9 100644 --- a/jsrender.js +++ b/jsrender.js @@ -1,4 +1,4 @@ -/*! JsRender v1.0.10: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.11: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -44,7 +44,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -753,7 +753,7 @@ function renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) { tag.linkCtx = linkCtx; if (tag._.bnd = boundTag || linkCtx.fn) { // Bound if {^{tag...}} or data-link="{tag...}" - tag._.ths = tagCtx.params.props.this; // Tag has a this=expr binding, to get javascript reference to tag instance + tag._.ths = tagCtx.params.props["this"]; // Tag has a this=expr binding, to get javascript reference to tag instance tag._.lt = tagCtxs.lt; // If a late path @some.path has not returned @some object, mark tag as late tag._.arrVws = {}; } else if (tag.dataBoundOnly) { @@ -1115,6 +1115,8 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // Look for server-generated script block with id "./some/file.html" elem = document.getElementById(value); } + } else if (value.charAt(0) === "#") { + elem = document.getElementById(value.slice(1)); } else if ($.fn && !$sub.rTmpl.test(value)) { try { elem = $(value, document)[0]; // if jQuery is loaded, test for selector returning elements, and get first element diff --git a/jsrender.min.js b/jsrender.min.js index 40cc444..be2c969 100644 --- a/jsrender.min.js +++ b/jsrender.min.js @@ -1,4 +1,4 @@ -/*! JsRender v1.0.10: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.11: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ -!function(t,e){var n=e.jQuery;"object"==typeof exports?module.exports=n?t(e,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return t(e,n)}:"function"==typeof define&&define.amd?define(function(){return t(e)}):t(e,!1)}(function(t,e){"use strict";function n(t,e){return function(){var n,r=this,i=r.base;return r.base=t,n=e.apply(r,arguments),r.base=i,n}}function r(t,e){return st(e)&&(e=n(t?t._d?t:n(a,t):a,e),e._d=(t&&t._d||0)+1),e}function i(t,e){var n,i=e.props;for(n in i)!Vt.test(n)||t[n]&&t[n].fix||(t[n]="convert"!==n?r(t.constructor.prototype[n],i[n]):i[n])}function o(t){return t}function a(){return""}function s(t){try{throw console.log("JsRender dbg breakpoint: "+t),"dbg breakpoint"}catch(e){}return this.base?this.baseApply(arguments):t}function l(t){this.name=(e.link?"JsViews":"JsRender")+" Error",this.message=t||this.name}function d(t,e){if(t){for(var n in e)t[n]=e[n];return t}}function c(t,e,n){return t?lt(t)?c.apply(ot,t):(wt=n?n[0]:wt,/^(\W|_){5}$/.test(t+e+wt)||S("Invalid delimiters"),mt=t[0],_t=t[1],xt=e[0],bt=e[1],gt.delimiters=[mt+_t,xt+bt,wt],t="\\"+mt+"(\\"+wt+")?\\"+_t,e="\\"+xt+"\\"+bt,rt="(?:(\\w+(?=[\\/\\s\\"+xt+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+xt+"]|\\"+xt+"(?!\\"+bt+"))*?)",ft.rTag="(?:"+rt+")",rt=new RegExp("(?:"+t+rt+"(\\/)?|\\"+mt+"(\\"+wt+")?\\"+_t+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+e,"g"),ft.rTmpl=new RegExp("^\\s|\\s$|<.*>|([^\\\\]|^)[{}]|"+t+".*"+e),ht):gt.delimiters}function p(t,e){e||t===!0||(e=t,t=void 0);var n,r,i,o,a=this,s="root"===e;if(t){if(o=e&&a.type===e&&a,!o)if(n=a.views,a._.useKey){for(r in n)if(o=e?n[r].get(t,e):n[r])break}else for(r=0,i=n.length;!o&&r1,v=f.ctx;if(n){if(f._||(c=f.index,f=f.tag),p=f,v&&v.hasOwnProperty(n)||(v=pt).hasOwnProperty(n)){if(s=v[n],"tag"===n||"tagCtx"===n||"root"===n||"parentTags"===n)return s}else v=void 0;if((!Ct&&f.tagCtx||f.linked)&&(s&&s._cxp||(f=f.tagCtx||st(s)?f:(f=f.scope||f,!f.isTop&&f.ctx.tag||f),void 0!==s&&f.tagCtx&&(f=f.tagCtx.view.scope),v=f._ocps,s=v&&v.hasOwnProperty(n)&&v[n]||s,s&&s._cxp||!i&&!g||((v||(f._ocps=f._ocps||{}))[n]=s=[{_ocp:s,_vw:p,_key:n}],s._cxp={path:jt,ind:0,updateValue:function(t,n){return e.observable(s[0]).setProperty(jt,t),this}})),l=s&&s._cxp)){if(arguments.length>2)return a=s[1]?ft._ceo(s[1].deps):[jt],a.unshift(s[0]),a._cxp=l,a;if(c=l.tagElse,u=s[1]?l.tag&&l.tag.cvtArgs?l.tag.cvtArgs(c,1)[l.ind]:s[1](s[0].data,s[0],ft):s[0]._ocp,g)return ft._ucp(n,r,f,l),f;s=u}return s&&st(s)&&(o=function(){return s.apply(this&&this!==t?this:p,arguments)},d(o,s)),o||s}}function h(t){return t&&(t.fn?t:this.getRsc("templates",t)||dt(t))}function m(t,e,n,r){var o,a,s,l,c,p="number"==typeof n&&e.tmpl.bnds[n-1];if(void 0===r&&p&&p._lr&&(r=""),void 0!==r?n=r={props:{},args:[r]}:p&&(n=p(e.data,e,ft)),p=p._bd&&p,t||p){if(a=e._lc,o=a&&a.tag,n.view=e,!o){if(o=d(new ft._tg,{_:{bnd:p,unlinked:!0,lt:n.lt},inline:!a,tagName:":",convert:t,onArrayChange:!0,flow:!0,tagCtx:n,tagCtxs:[n],_is:"tag"}),l=n.args.length,l>1)for(c=o.bindTo=[];l--;)c.unshift(l);a&&(a.tag=o,o.linkCtx=a),n.ctx=Q(n.ctx,(a?a.view:e).ctx),i(o,n)}o._er=r&&s,o.ctx=n.ctx||o.ctx||{},n.ctx=void 0,s=o.cvtArgs()[0],o._er=r&&s}else s=n.args[0];return s=p&&e._.onRender?e._.onRender(s,e,o):s,void 0!=s?s:""}function _(t,e){var n,r,i,o,a,s,l,d=this;if(d.tagName){if(s=d,d=(s.tagCtxs||[d])[t||0],!d)return}else s=d.tag;if(a=s.bindFrom,o=d.args,(l=s.convert)&&""+l===l&&(l="true"===l?void 0:d.view.getRsc("converters",l)||S("Unknown converter: '"+l+"'")),l&&!e&&(o=o.slice()),a){for(i=[],n=a.length;n--;)r=a[n],i.unshift(x(d,r));e&&(o=i)}if(l){if(l=l.apply(s,i||o),void 0===l)return o;if(a=a||[0],n=a.length,lt(l)&&(l.arg0===!1||1!==n&&l.length===n&&!l.arg0)||(l=[l],a=[0],n=1),e)o=l;else for(;n--;)r=a[n],+r===r&&(o[r]=l[n])}return o}function x(t,e){return t=t[+e===e?"args":"props"],t&&t[e]}function b(t){return this.cvtArgs(t,1)}function w(t,e){var n,r,i=this;if(""+e===e){for(;void 0===n&&i;)r=i.tmpl&&i.tmpl[t],n=r&&r[e],i=i.parent;return n||ot[t][e]}}function y(t,e,n,r,o,a){function s(t){var e=l[t];if(void 0!==e)for(e=lt(e)?e:[e],h=e.length;h--;)q=e[h],isNaN(parseInt(q))||(e[h]=parseInt(q));return e||[0]}e=e||it;var l,d,c,p,u,f,g,h,m,w,y,C,k,j,T,A,P,F,N,R,M,$,V,I,D,q,U,K,J,L,B=0,H="",W=e._lc||!1,Z=e.ctx,z=n||e.tmpl,G="number"==typeof r&&e.tmpl.bnds[r-1];for("tag"===t._is?(l=t,t=l.tagName,r=l.tagCtxs,c=l.template):(d=e.getRsc("tags",t)||S("Unknown tag: {{"+t+"}} "),c=d.template),void 0===a&&G&&(G._lr=d.lateRender&&G._lr!==!1||G._lr)&&(a=""),void 0!==a?(H+=a,r=a=[{props:{},args:[],params:{props:{}}}]):G&&(r=G(e.data,e,ft)),g=r.length;B0&&(a=n)){if(!a)if(/^\.?\/[^\\:*?"<>]*$/.test(n))(s=dt[t=t||n])?n=s:a=document.getElementById(n);else if(e.fn&&!ft.rTmpl.test(n))try{a=e(n,document)[0]}catch(l){}a&&("SCRIPT"!==a.tagName&&S(n+": Use script block, not "+a.tagName),i?n=a.innerHTML:(o=a.getAttribute(Bt),o&&(o!==Qt?(n=dt[o],delete dt[o]):e.fn&&(n=e.data(a)[Qt])),o&&n||(t=t||(e.fn?Qt:n),n=A(t,a.innerHTML,r,i)),n.tmplName=t=t||o,t!==Qt&&(dt[t]=n),a.setAttribute(Bt,t),e.fn&&e.data(a,Qt,n))),a=void 0}else n.fn||(n=void 0);return n}var a,s,l=n=n||"";if(ft._html=ct.html,0===i&&(i=void 0,l=o(l)),i=i||(n.markup?n.bnds?d({},n):n:{}),i.tmplName=i.tmplName||t||"unnamed",r&&(i._parentTmpl=r),!l&&n.markup&&(l=o(n.markup))&&l.fn&&(l=l.markup),void 0!==l)return l.render||n.render?l.tmpls&&(s=l):(n=R(l,i),q(l.replace(Pt,"\\$&"),n)),s||(s=d(function(){return s.render.apply(s,arguments)},n),k(s)),s}function P(t,e){return st(t)?t.call(e):t}function F(t,e,n){Object.defineProperty(t,e,{value:n,configurable:!0})}function N(t,n){function r(t){c.apply(this,t)}function i(){return new r(arguments)}function o(t,e){for(var n,r,i,o,a,s=0;sY-(Q||0)){if(Q=e.trim(L.slice(Q,Y+r.length)),H=s||g[m-1].bd,W=H[H.length-1],W&&W.prm){for(;W.sb&&W.sb.prm;)W=W.sb;Z=W.sb={path:W.sb,bnd:W.bnd}}else H.push(Z={path:H.pop()});W&&W.sb===Z&&(k[m]=k[m-1].slice(W._cpPthSt)+k[m],k[m-1]=k[m-1].slice(0,W._cpPthSt)),Z._cpPthSt=C[m-1],Z._cpKey=Q,k[m]+=L.slice(j,J),j=J,Z._cpfn=Wt[Q]=Wt[Q]||new Function("data,view,j","//"+Q+"\nvar v;\nreturn ((v="+k[m]+("]"===S?")]":S)+")!=null?v:null);"),k[m-1]+=w[h]&&vt.cache?'view.getCache("'+Q.replace(Pt,"\\$&")+'"':k[m],Z.prm=f.bd,Z.bnd=Z.bnd||Z.path&&Z.path.indexOf("^")>=0}k[m]=""}"["===$&&($="[j._sq("),"["===d&&(d="[j._sq(")}return X=p?(p=!O,p?r:E+'"'):c?(c=!I,c?r:E+'"'):(d?(b[++h]=!0,_[h]=0,u&&(y[m++]=Y++,f=g[m]={bd:[]},k[m]="",C[m]=1),d):"")+(K?h?"":(v=L.slice(v,Y),(a?(a=l=s=!1,"\b"):"\b,")+v+(v=Y+r.length,u&&n.push(f.bd=[]),"\b")):N?(m&&D(t),u&&n.pop(),a="_"+A,l=T,v=Y+r.length,u&&(u=f.bd=n[a]=[],u.skp=!T),A+":"):A?A.split("^").join(".").replace(ft.rPath,B)+($||P):P?P:S?"]"===S?")]":")":V?(w[h]||D(t),","):o?"":(p=O,c=I,'"')),p||c||S&&(w[h]=!1,h--),u&&(p||c||(S&&(b[h+1]&&(f=g[--m],b[h+1]=!1),x=_[h+1]),$&&(_[h+1]=k[m].length+(d?1:0),(A||S)&&(f=g[++m]={bd:[]},b[h+1]=!0))),k[m]=(k[m]||"")+L.slice(j,J),j=J+r.length,p||c||((G=d&&b[h+1])&&(k[m-1]+=d,C[m-1]++),"("===$&&z&&!Z&&(k[m]=k[m-1].slice(x)+k[m],k[m-1]=k[m-1].slice(0,x))),k[m]+=G?X.slice(1):X),p||c||!$||(h++,A&&"("===$&&(w[h]=!0)),p||c||!U||(u&&(k[m]+=$),X+=$),X}var a,s,l,d,c,p,u=n&&n[0],f={bd:u},g={0:f},v=0,h=0,m=0,_={},x=0,b={},w={},y={},C={0:0},k={0:""},j=0;return"@"===t[0]&&(t=t.replace(Dt,".")),d=(t+(r?" ":"")).replace(ft.rPrm,o),u&&(d=k[0]),!h&&d||D(t)}function B(t,e,n){var r,i,o,a,s,l,d,c,p,u,f,g,v,h,m,_,x,b,w,y,C,k,j,T,A,P,F,N,M,$,V,E,O,I=0,S=vt.useViews||e.useViews||e.tags||e.templates||e.helpers||e.converters,q="",K={},L=t.length;for(""+e===e?(b=n?'data-link="'+e.replace(Tt," ").slice(1,-1)+'"':e,e=0):(b=e.tmplName||"unnamed",e.allowCode&&(K.allowCode=!0),e.debug&&(K.debug=!0),f=e.bnds,x=e.tmpls),r=0;r":a+o):(C&&(w=R(k,K),w.tmplName=b+"/"+o,w.useViews=w.useViews||S,B(C,w),S=w.useViews,x.push(w)),A||(y=o,S=S||o&&(!ut[o]||!ut[o].flow),T=q,q=""),j=t[r+1],j=j&&"else"===j[0]),M=N?";\ntry{\nret+=":"\n+",h="",m="",P&&(g||$||a&&a!==Jt||V)){if(F=new Function("data,view,j","// "+b+" "+ ++I+" "+o+E+"{"+s+"};"+O),F._er=N,F._tag=o,F._bd=!!g,F._lr=V,n)return F;U(F,g),_='c("'+a+'",view,',u=!0,h=_+I+",",m=")"}if(q+=P?(n?(N?"try{\n":"")+"return ":M)+(u?(u=void 0,S=p=!0,_+(F?(f[I-1]=F,I):"{"+s+"}")+")"):">"===o?(d=!0,"h("+v[0]+")"):(c=!0,"((v="+v[0]+")!=null?v:"+(n?"null)":'"")'))):(l=!0,"\n{view:view,content:false,tmpl:"+(C?x.length:"false")+","+s+"},"),y&&!j){if(q="["+q.slice(0,-1)+"]",_='t("'+y+'",view,this,',n||g){if(q=new Function("data,view,j"," // "+b+" "+I+" "+y+E+q+O),q._er=N,q._tag=y,g&&U(f[I-1]=q,g),q._lr=V,n)return q;h=_+I+",undefined,",m=")"}q=T+M+_+(g&&I||q)+")",g=0,y=0}N&&!j&&(S=!0,q+=";\n}catch(e){ret"+(n?"urn ":"+=")+h+"j._err(e,view,"+N+")"+m+";}"+(n?"":"\nret=ret"))}q="// "+b+(K.debug?"\ndebugger;":"")+"\nvar v"+(l?",t=j._tag":"")+(p?",c=j._cnvt":"")+(d?",h=j._html":"")+(n?(i[8]?", ob":"")+";\n":',ret=""')+q+(n?"\n":";\nreturn ret;");try{q=new Function("data,view,j",q)}catch(Q){D("Compiled template code:\n\n"+q+'\n: "'+(Q.message||Q)+'"')}return e&&(e.fn=q,e.useViews=!!S),q}function Q(t,e){return t&&t!==e?e?d(d({},e),t):t:e&&d({},e)}function H(t,n){var r,i,o=n.map,a=o&&o.propsArr;if(!a){if(a=[],typeof t===Lt||st(t))for(r in t)i=t[r],r===at||!t.hasOwnProperty(r)||n.props.noFunctions&&e.isFunction(i)||a.push({key:r,prop:i});o&&(o.propsArr=o.options&&a)}return W(a,n)}function W(t,n){var r,i,o,a=n.tag,s=n.props,l=n.params.props,d=s.filter,c=s.sort,p=c===!0,u=parseInt(s.step),f=s.reverse?-1:1;if(!lt(t))return t;if(p||c&&""+c===c?(r=t.map(function(t,e){return t=p?t:g(t,c),{i:e,v:""+t===t?t.toLowerCase():t}}),r.sort(function(t,e){return t.v>e.v?f:t.vt.length?t.length:+o,t=t.slice(i,o)),u>1){for(i=0,o=t.length,r=[];i\s]/,Mt=/[\x00`><"'&=]/g,$t=/[\x00`><\"'&=]/,Vt=/^on[A-Z]|^convert(Back)?$/,Et=/^\#\d+_`[\s\S]*\/\d+_`$/,Ot=Mt,It=/[&<>]/g,St=/&(amp|gt|lt);/g,Dt=/\[['"]?|['"]?\]/g,qt=0,Ut={"&":"&","<":"<",">":">","\0":"�","'":"'",'"':""","`":"`","=":"="},Kt={amp:"&",gt:">",lt:"<"},Jt="html",Lt="object",Bt="data-jsv-tmpl",Qt="jsvTmpl",Ht="For #index in nested block use #getIndex().",Wt={},Zt={},zt=t.jsrender,Gt=zt&&e&&!e.render,Xt={template:{compile:A},tag:{compile:j},viewModel:{compile:N},helper:{},converter:{}};if(ot={jsviews:kt,sub:{rPath:/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,rPrm:/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(~?[\w$.^]+)?\s*((\+\+|--)|\+|-|~(?![\w$])|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?(@)?[#~]?[\w$.^]+)([([])?)|(,\s*)|(?:(\()\s*)?\\?(?:(')|("))|(?:\s*(([)\]])(?=[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,View:C,Err:l,tmplFn:q,parse:L,extend:d,extendCtx:Q,syntaxErr:D,onStore:{template:function(t,e){null===e?delete Zt[t]:t&&(Zt[t]=e)}},addSetting:$,settings:{allowCode:!1},advSet:a,_thp:i,_gm:r,_tg:function(){},_cnvt:m,_tag:y,_er:S,_err:I,_cp:o,_sq:function(t){return"constructor"===t&&D(""),t}},settings:{delimiters:c,advanced:function(t){return t?(d(vt,t),ft.advSet(),ht):vt}},map:V},(l.prototype=new Error).constructor=l,u.depends=function(){return[this.get("item"),"index"]},f.depends="index",C.prototype={get:p,getIndex:f,ctxPrm:v,getRsc:w,_getTmpl:h,_getOb:g,getCache:function(t){return gt._cchCt>this.cache._ct&&(this.cache={_ct:gt._cchCt}),void 0!==this.cache[t]?this.cache[t]:this.cache[t]=Wt[t](this.data,this,ft)},_is:"view"},ft=ot.sub,ht=ot.settings,!(zt||e&&e.render)){for(nt in Xt)M(nt,Xt[nt]);if(ct=ot.converters,pt=ot.helpers,ut=ot.tags,ft._tg.prototype={baseApply:T,cvtArgs:_,bndArgs:b,ctxPrm:v},it=ft.topView=new C,e){if(e.fn.render=Z,at=e.expando,e.observable){if(kt!==(kt=e.views.jsviews))throw"jquery.observable.js requires jsrender.js "+kt;d(ft,e.views.sub),ot.map=e.views.map}}else e={},et&&(t.jsrender=e),e.renderFile=e.__express=e.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},e.isFunction=function(t){return"function"==typeof t},e.isArray=Array.isArray||function(t){return"[object Array]"==={}.toString.call(t)},ft._jq=function(t){t!==e&&(d(t,e),e=t,e.fn.render=Z,delete e.jsrender,at=e.expando)},e.jsrender=kt;gt=ft.settings,gt.allowCode=!1,st=e.isFunction,e.render=Zt,e.views=ot,e.templates=dt=ot.templates;for(yt in gt)$(yt);(ht.debugMode=function(t){return void 0===t?gt.debugMode:(gt._clFns&>._clFns(),gt.debugMode=t,gt.onError=t+""===t?function(){return t}:st(t)?t:void 0,ht)})(!1),vt=gt.advanced={cache:!0,useViews:!1,_jsv:!1},ut({"if":{render:function(t){var e=this,n=e.tagCtx,r=e.rendering.done||!t&&(n.args.length||!n.index)?"":(e.rendering.done=!0,void(e.selected=n.index));return r},contentCtx:!0,flow:!0},"for":{sortDataMap:V(W),init:function(t,e){this.setDataMap(this.tagCtxs)},render:function(t){var e,n,r,i,o,a=this,s=a.tagCtx,l=s.argDefault===!1,d=s.props,c=l||s.args.length,p="",u=0;if(!a.rendering.done){if(e=c?t:s.view.data,l)for(l=d.reverse?"unshift":"push",i=+d.end,o=+d.step||1,e=[],r=+d.start||0;(i-r)*o>0;r+=o)e[l](r);void 0!==e&&(n=lt(e),p+=s.render(e,!c||d.noIteration),u+=n?e.length:1),(a.rendering.done=u)&&(a.selected=s.index)}return p},setDataMap:function(t){for(var e,n,r,i=this,o=t.length;o--;)e=t[o],n=e.props,r=e.params.props,e.argDefault=void 0===n.end||e.args.length>0,n.dataMap=e.argDefault!==!1&<(e.args[0])&&(r.sort||r.start||r.end||r.step||r.filter||r.reverse||n.sort||n.start||n.end||n.step||n.filter||n.reverse)&&i.sortDataMap},flow:!0},props:{baseTag:"for",dataMap:V(H),init:a,flow:!0},include:{flow:!0},"*":{render:o,flow:!0},":*":{render:o,flow:!0},dbg:pt.dbg=ct.dbg=s}),ct({html:X,attr:X,encode:Y,unencode:tt,url:function(t){return void 0!=t?encodeURI(""+t):null===t?t:""}})}return gt=ft.settings,lt=(e||zt).isArray,ht.delimiters("{{","}}","^"),Gt&&zt.views.sub._jq(e),e||zt},window); +!function(t,e){var n=e.jQuery;"object"==typeof exports?module.exports=n?t(e,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return t(e,n)}:"function"==typeof define&&define.amd?define(function(){return t(e)}):t(e,!1)}(function(t,e){"use strict";function n(t,e){return function(){var n,r=this,i=r.base;return r.base=t,n=e.apply(r,arguments),r.base=i,n}}function r(t,e){return st(e)&&(e=n(t?t._d?t:n(a,t):a,e),e._d=(t&&t._d||0)+1),e}function i(t,e){var n,i=e.props;for(n in i)!Vt.test(n)||t[n]&&t[n].fix||(t[n]="convert"!==n?r(t.constructor.prototype[n],i[n]):i[n])}function o(t){return t}function a(){return""}function s(t){try{throw console.log("JsRender dbg breakpoint: "+t),"dbg breakpoint"}catch(e){}return this.base?this.baseApply(arguments):t}function l(t){this.name=(e.link?"JsViews":"JsRender")+" Error",this.message=t||this.name}function d(t,e){if(t){for(var n in e)t[n]=e[n];return t}}function c(t,e,n){return t?lt(t)?c.apply(ot,t):(wt=n?n[0]:wt,/^(\W|_){5}$/.test(t+e+wt)||S("Invalid delimiters"),mt=t[0],_t=t[1],xt=e[0],bt=e[1],gt.delimiters=[mt+_t,xt+bt,wt],t="\\"+mt+"(\\"+wt+")?\\"+_t,e="\\"+xt+"\\"+bt,rt="(?:(\\w+(?=[\\/\\s\\"+xt+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+xt+"]|\\"+xt+"(?!\\"+bt+"))*?)",ft.rTag="(?:"+rt+")",rt=new RegExp("(?:"+t+rt+"(\\/)?|\\"+mt+"(\\"+wt+")?\\"+_t+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+e,"g"),ft.rTmpl=new RegExp("^\\s|\\s$|<.*>|([^\\\\]|^)[{}]|"+t+".*"+e),ht):gt.delimiters}function p(t,e){e||t===!0||(e=t,t=void 0);var n,r,i,o,a=this,s="root"===e;if(t){if(o=e&&a.type===e&&a,!o)if(n=a.views,a._.useKey){for(r in n)if(o=e?n[r].get(t,e):n[r])break}else for(r=0,i=n.length;!o&&r1,v=f.ctx;if(n){if(f._||(c=f.index,f=f.tag),p=f,v&&v.hasOwnProperty(n)||(v=pt).hasOwnProperty(n)){if(s=v[n],"tag"===n||"tagCtx"===n||"root"===n||"parentTags"===n)return s}else v=void 0;if((!Ct&&f.tagCtx||f.linked)&&(s&&s._cxp||(f=f.tagCtx||st(s)?f:(f=f.scope||f,!f.isTop&&f.ctx.tag||f),void 0!==s&&f.tagCtx&&(f=f.tagCtx.view.scope),v=f._ocps,s=v&&v.hasOwnProperty(n)&&v[n]||s,s&&s._cxp||!i&&!g||((v||(f._ocps=f._ocps||{}))[n]=s=[{_ocp:s,_vw:p,_key:n}],s._cxp={path:jt,ind:0,updateValue:function(t,n){return e.observable(s[0]).setProperty(jt,t),this}})),l=s&&s._cxp)){if(arguments.length>2)return a=s[1]?ft._ceo(s[1].deps):[jt],a.unshift(s[0]),a._cxp=l,a;if(c=l.tagElse,u=s[1]?l.tag&&l.tag.cvtArgs?l.tag.cvtArgs(c,1)[l.ind]:s[1](s[0].data,s[0],ft):s[0]._ocp,g)return ft._ucp(n,r,f,l),f;s=u}return s&&st(s)&&(o=function(){return s.apply(this&&this!==t?this:p,arguments)},d(o,s)),o||s}}function h(t){return t&&(t.fn?t:this.getRsc("templates",t)||dt(t))}function m(t,e,n,r){var o,a,s,l,c,p="number"==typeof n&&e.tmpl.bnds[n-1];if(void 0===r&&p&&p._lr&&(r=""),void 0!==r?n=r={props:{},args:[r]}:p&&(n=p(e.data,e,ft)),p=p._bd&&p,t||p){if(a=e._lc,o=a&&a.tag,n.view=e,!o){if(o=d(new ft._tg,{_:{bnd:p,unlinked:!0,lt:n.lt},inline:!a,tagName:":",convert:t,onArrayChange:!0,flow:!0,tagCtx:n,tagCtxs:[n],_is:"tag"}),l=n.args.length,l>1)for(c=o.bindTo=[];l--;)c.unshift(l);a&&(a.tag=o,o.linkCtx=a),n.ctx=Q(n.ctx,(a?a.view:e).ctx),i(o,n)}o._er=r&&s,o.ctx=n.ctx||o.ctx||{},n.ctx=void 0,s=o.cvtArgs()[0],o._er=r&&s}else s=n.args[0];return s=p&&e._.onRender?e._.onRender(s,e,o):s,void 0!=s?s:""}function _(t,e){var n,r,i,o,a,s,l,d=this;if(d.tagName){if(s=d,d=(s.tagCtxs||[d])[t||0],!d)return}else s=d.tag;if(a=s.bindFrom,o=d.args,(l=s.convert)&&""+l===l&&(l="true"===l?void 0:d.view.getRsc("converters",l)||S("Unknown converter: '"+l+"'")),l&&!e&&(o=o.slice()),a){for(i=[],n=a.length;n--;)r=a[n],i.unshift(x(d,r));e&&(o=i)}if(l){if(l=l.apply(s,i||o),void 0===l)return o;if(a=a||[0],n=a.length,lt(l)&&(l.arg0===!1||1!==n&&l.length===n&&!l.arg0)||(l=[l],a=[0],n=1),e)o=l;else for(;n--;)r=a[n],+r===r&&(o[r]=l[n])}return o}function x(t,e){return t=t[+e===e?"args":"props"],t&&t[e]}function b(t){return this.cvtArgs(t,1)}function w(t,e){var n,r,i=this;if(""+e===e){for(;void 0===n&&i;)r=i.tmpl&&i.tmpl[t],n=r&&r[e],i=i.parent;return n||ot[t][e]}}function y(t,e,n,r,o,a){function s(t){var e=l[t];if(void 0!==e)for(e=lt(e)?e:[e],h=e.length;h--;)q=e[h],isNaN(parseInt(q))||(e[h]=parseInt(q));return e||[0]}e=e||it;var l,d,c,p,u,f,g,h,m,w,y,C,k,j,T,A,P,F,N,R,M,$,V,I,D,q,U,K,J,B,L=0,H="",W=e._lc||!1,Z=e.ctx,z=n||e.tmpl,G="number"==typeof r&&e.tmpl.bnds[r-1];for("tag"===t._is?(l=t,t=l.tagName,r=l.tagCtxs,c=l.template):(d=e.getRsc("tags",t)||S("Unknown tag: {{"+t+"}} "),c=d.template),void 0===a&&G&&(G._lr=d.lateRender&&G._lr!==!1||G._lr)&&(a=""),void 0!==a?(H+=a,r=a=[{props:{},args:[],params:{props:{}}}]):G&&(r=G(e.data,e,ft)),g=r.length;L0&&(a=n)){if(!a)if(/^\.?\/[^\\:*?"<>]*$/.test(n))(s=dt[t=t||n])?n=s:a=document.getElementById(n);else if("#"===n.charAt(0))a=document.getElementById(n.slice(1));else if(e.fn&&!ft.rTmpl.test(n))try{a=e(n,document)[0]}catch(l){}a&&("SCRIPT"!==a.tagName&&S(n+": Use script block, not "+a.tagName),i?n=a.innerHTML:(o=a.getAttribute(Lt),o&&(o!==Qt?(n=dt[o],delete dt[o]):e.fn&&(n=e.data(a)[Qt])),o&&n||(t=t||(e.fn?Qt:n),n=A(t,a.innerHTML,r,i)),n.tmplName=t=t||o,t!==Qt&&(dt[t]=n),a.setAttribute(Lt,t),e.fn&&e.data(a,Qt,n))),a=void 0}else n.fn||(n=void 0);return n}var a,s,l=n=n||"";if(ft._html=ct.html,0===i&&(i=void 0,l=o(l)),i=i||(n.markup?n.bnds?d({},n):n:{}),i.tmplName=i.tmplName||t||"unnamed",r&&(i._parentTmpl=r),!l&&n.markup&&(l=o(n.markup))&&l.fn&&(l=l.markup),void 0!==l)return l.render||n.render?l.tmpls&&(s=l):(n=R(l,i),q(l.replace(Pt,"\\$&"),n)),s||(s=d(function(){return s.render.apply(s,arguments)},n),k(s)),s}function P(t,e){return st(t)?t.call(e):t}function F(t,e,n){Object.defineProperty(t,e,{value:n,configurable:!0})}function N(t,n){function r(t){c.apply(this,t)}function i(){return new r(arguments)}function o(t,e){for(var n,r,i,o,a,s=0;sY-(Q||0)){if(Q=e.trim(B.slice(Q,Y+r.length)),H=s||g[m-1].bd,W=H[H.length-1],W&&W.prm){for(;W.sb&&W.sb.prm;)W=W.sb;Z=W.sb={path:W.sb,bnd:W.bnd}}else H.push(Z={path:H.pop()});W&&W.sb===Z&&(k[m]=k[m-1].slice(W._cpPthSt)+k[m],k[m-1]=k[m-1].slice(0,W._cpPthSt)),Z._cpPthSt=C[m-1],Z._cpKey=Q,k[m]+=B.slice(j,J),j=J,Z._cpfn=Wt[Q]=Wt[Q]||new Function("data,view,j","//"+Q+"\nvar v;\nreturn ((v="+k[m]+("]"===S?")]":S)+")!=null?v:null);"),k[m-1]+=w[h]&&vt.cache?'view.getCache("'+Q.replace(Pt,"\\$&")+'"':k[m],Z.prm=f.bd,Z.bnd=Z.bnd||Z.path&&Z.path.indexOf("^")>=0}k[m]=""}"["===$&&($="[j._sq("),"["===d&&(d="[j._sq(")}return X=p?(p=!O,p?r:E+'"'):c?(c=!I,c?r:E+'"'):(d?(b[++h]=!0,_[h]=0,u&&(y[m++]=Y++,f=g[m]={bd:[]},k[m]="",C[m]=1),d):"")+(K?h?"":(v=B.slice(v,Y),(a?(a=l=s=!1,"\b"):"\b,")+v+(v=Y+r.length,u&&n.push(f.bd=[]),"\b")):N?(m&&D(t),u&&n.pop(),a="_"+A,l=T,v=Y+r.length,u&&(u=f.bd=n[a]=[],u.skp=!T),A+":"):A?A.split("^").join(".").replace(ft.rPath,L)+($||P):P?P:S?"]"===S?")]":")":V?(w[h]||D(t),","):o?"":(p=O,c=I,'"')),p||c||S&&(w[h]=!1,h--),u&&(p||c||(S&&(b[h+1]&&(f=g[--m],b[h+1]=!1),x=_[h+1]),$&&(_[h+1]=k[m].length+(d?1:0),(A||S)&&(f=g[++m]={bd:[]},b[h+1]=!0))),k[m]=(k[m]||"")+B.slice(j,J),j=J+r.length,p||c||((G=d&&b[h+1])&&(k[m-1]+=d,C[m-1]++),"("===$&&z&&!Z&&(k[m]=k[m-1].slice(x)+k[m],k[m-1]=k[m-1].slice(0,x))),k[m]+=G?X.slice(1):X),p||c||!$||(h++,A&&"("===$&&(w[h]=!0)),p||c||!U||(u&&(k[m]+=$),X+=$),X}var a,s,l,d,c,p,u=n&&n[0],f={bd:u},g={0:f},v=0,h=0,m=0,_={},x=0,b={},w={},y={},C={0:0},k={0:""},j=0;return"@"===t[0]&&(t=t.replace(Dt,".")),d=(t+(r?" ":"")).replace(ft.rPrm,o),u&&(d=k[0]),!h&&d||D(t)}function L(t,e,n){var r,i,o,a,s,l,d,c,p,u,f,g,v,h,m,_,x,b,w,y,C,k,j,T,A,P,F,N,M,$,V,E,O,I=0,S=vt.useViews||e.useViews||e.tags||e.templates||e.helpers||e.converters,q="",K={},B=t.length;for(""+e===e?(b=n?'data-link="'+e.replace(Tt," ").slice(1,-1)+'"':e,e=0):(b=e.tmplName||"unnamed",e.allowCode&&(K.allowCode=!0),e.debug&&(K.debug=!0),f=e.bnds,x=e.tmpls),r=0;r":a+o):(C&&(w=R(k,K),w.tmplName=b+"/"+o,w.useViews=w.useViews||S,L(C,w),S=w.useViews,x.push(w)),A||(y=o,S=S||o&&(!ut[o]||!ut[o].flow),T=q,q=""),j=t[r+1],j=j&&"else"===j[0]),M=N?";\ntry{\nret+=":"\n+",h="",m="",P&&(g||$||a&&a!==Jt||V)){if(F=new Function("data,view,j","// "+b+" "+ ++I+" "+o+E+"{"+s+"};"+O),F._er=N,F._tag=o,F._bd=!!g,F._lr=V,n)return F;U(F,g),_='c("'+a+'",view,',u=!0,h=_+I+",",m=")"}if(q+=P?(n?(N?"try{\n":"")+"return ":M)+(u?(u=void 0,S=p=!0,_+(F?(f[I-1]=F,I):"{"+s+"}")+")"):">"===o?(d=!0,"h("+v[0]+")"):(c=!0,"((v="+v[0]+")!=null?v:"+(n?"null)":'"")'))):(l=!0,"\n{view:view,content:false,tmpl:"+(C?x.length:"false")+","+s+"},"),y&&!j){if(q="["+q.slice(0,-1)+"]",_='t("'+y+'",view,this,',n||g){if(q=new Function("data,view,j"," // "+b+" "+I+" "+y+E+q+O),q._er=N,q._tag=y,g&&U(f[I-1]=q,g),q._lr=V,n)return q;h=_+I+",undefined,",m=")"}q=T+M+_+(g&&I||q)+")",g=0,y=0}N&&!j&&(S=!0,q+=";\n}catch(e){ret"+(n?"urn ":"+=")+h+"j._err(e,view,"+N+")"+m+";}"+(n?"":"\nret=ret"))}q="// "+b+(K.debug?"\ndebugger;":"")+"\nvar v"+(l?",t=j._tag":"")+(p?",c=j._cnvt":"")+(d?",h=j._html":"")+(n?(i[8]?", ob":"")+";\n":',ret=""')+q+(n?"\n":";\nreturn ret;");try{q=new Function("data,view,j",q)}catch(Q){D("Compiled template code:\n\n"+q+'\n: "'+(Q.message||Q)+'"')}return e&&(e.fn=q,e.useViews=!!S),q}function Q(t,e){return t&&t!==e?e?d(d({},e),t):t:e&&d({},e)}function H(t,n){var r,i,o=n.map,a=o&&o.propsArr;if(!a){if(a=[],typeof t===Bt||st(t))for(r in t)i=t[r],r===at||!t.hasOwnProperty(r)||n.props.noFunctions&&e.isFunction(i)||a.push({key:r,prop:i});o&&(o.propsArr=o.options&&a)}return W(a,n)}function W(t,n){var r,i,o,a=n.tag,s=n.props,l=n.params.props,d=s.filter,c=s.sort,p=c===!0,u=parseInt(s.step),f=s.reverse?-1:1;if(!lt(t))return t;if(p||c&&""+c===c?(r=t.map(function(t,e){return t=p?t:g(t,c),{i:e,v:""+t===t?t.toLowerCase():t}}),r.sort(function(t,e){return t.v>e.v?f:t.vt.length?t.length:+o,t=t.slice(i,o)),u>1){for(i=0,o=t.length,r=[];i\s]/,Mt=/[\x00`><"'&=]/g,$t=/[\x00`><\"'&=]/,Vt=/^on[A-Z]|^convert(Back)?$/,Et=/^\#\d+_`[\s\S]*\/\d+_`$/,Ot=Mt,It=/[&<>]/g,St=/&(amp|gt|lt);/g,Dt=/\[['"]?|['"]?\]/g,qt=0,Ut={"&":"&","<":"<",">":">","\0":"�","'":"'",'"':""","`":"`","=":"="},Kt={amp:"&",gt:">",lt:"<"},Jt="html",Bt="object",Lt="data-jsv-tmpl",Qt="jsvTmpl",Ht="For #index in nested block use #getIndex().",Wt={},Zt={},zt=t.jsrender,Gt=zt&&e&&!e.render,Xt={template:{compile:A},tag:{compile:j},viewModel:{compile:N},helper:{},converter:{}};if(ot={jsviews:kt,sub:{rPath:/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,rPrm:/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(~?[\w$.^]+)?\s*((\+\+|--)|\+|-|~(?![\w$])|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?(@)?[#~]?[\w$.^]+)([([])?)|(,\s*)|(?:(\()\s*)?\\?(?:(')|("))|(?:\s*(([)\]])(?=[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,View:C,Err:l,tmplFn:q,parse:B,extend:d,extendCtx:Q,syntaxErr:D,onStore:{template:function(t,e){null===e?delete Zt[t]:t&&(Zt[t]=e)}},addSetting:$,settings:{allowCode:!1},advSet:a,_thp:i,_gm:r,_tg:function(){},_cnvt:m,_tag:y,_er:S,_err:I,_cp:o,_sq:function(t){return"constructor"===t&&D(""),t}},settings:{delimiters:c,advanced:function(t){return t?(d(vt,t),ft.advSet(),ht):vt}},map:V},(l.prototype=new Error).constructor=l,u.depends=function(){return[this.get("item"),"index"]},f.depends="index",C.prototype={get:p,getIndex:f,ctxPrm:v,getRsc:w,_getTmpl:h,_getOb:g,getCache:function(t){return gt._cchCt>this.cache._ct&&(this.cache={_ct:gt._cchCt}),void 0!==this.cache[t]?this.cache[t]:this.cache[t]=Wt[t](this.data,this,ft)},_is:"view"},ft=ot.sub,ht=ot.settings,!(zt||e&&e.render)){for(nt in Xt)M(nt,Xt[nt]);if(ct=ot.converters,pt=ot.helpers,ut=ot.tags,ft._tg.prototype={baseApply:T,cvtArgs:_,bndArgs:b,ctxPrm:v},it=ft.topView=new C,e){if(e.fn.render=Z,at=e.expando,e.observable){if(kt!==(kt=e.views.jsviews))throw"jquery.observable.js requires jsrender.js "+kt;d(ft,e.views.sub),ot.map=e.views.map}}else e={},et&&(t.jsrender=e),e.renderFile=e.__express=e.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},e.isFunction=function(t){return"function"==typeof t},e.isArray=Array.isArray||function(t){return"[object Array]"==={}.toString.call(t)},ft._jq=function(t){t!==e&&(d(t,e),e=t,e.fn.render=Z,delete e.jsrender,at=e.expando)},e.jsrender=kt;gt=ft.settings,gt.allowCode=!1,st=e.isFunction,e.render=Zt,e.views=ot,e.templates=dt=ot.templates;for(yt in gt)$(yt);(ht.debugMode=function(t){return void 0===t?gt.debugMode:(gt._clFns&>._clFns(),gt.debugMode=t,gt.onError=t+""===t?function(){return t}:st(t)?t:void 0,ht)})(!1),vt=gt.advanced={cache:!0,useViews:!1,_jsv:!1},ut({"if":{render:function(t){var e=this,n=e.tagCtx,r=e.rendering.done||!t&&(n.args.length||!n.index)?"":(e.rendering.done=!0,void(e.selected=n.index));return r},contentCtx:!0,flow:!0},"for":{sortDataMap:V(W),init:function(t,e){this.setDataMap(this.tagCtxs)},render:function(t){var e,n,r,i,o,a=this,s=a.tagCtx,l=s.argDefault===!1,d=s.props,c=l||s.args.length,p="",u=0;if(!a.rendering.done){if(e=c?t:s.view.data,l)for(l=d.reverse?"unshift":"push",i=+d.end,o=+d.step||1,e=[],r=+d.start||0;(i-r)*o>0;r+=o)e[l](r);void 0!==e&&(n=lt(e),p+=s.render(e,!c||d.noIteration),u+=n?e.length:1),(a.rendering.done=u)&&(a.selected=s.index)}return p},setDataMap:function(t){for(var e,n,r,i=this,o=t.length;o--;)e=t[o],n=e.props,r=e.params.props,e.argDefault=void 0===n.end||e.args.length>0,n.dataMap=e.argDefault!==!1&<(e.args[0])&&(r.sort||r.start||r.end||r.step||r.filter||r.reverse||n.sort||n.start||n.end||n.step||n.filter||n.reverse)&&i.sortDataMap},flow:!0},props:{baseTag:"for",dataMap:V(H),init:a,flow:!0},include:{flow:!0},"*":{render:o,flow:!0},":*":{render:o,flow:!0},dbg:pt.dbg=ct.dbg=s}),ct({html:X,attr:X,encode:Y,unencode:tt,url:function(t){return void 0!=t?encodeURI(""+t):null===t?t:""}})}return gt=ft.settings,lt=(e||zt).isArray,ht.delimiters("{{","}}","^"),Gt&&zt.views.sub._jq(e),e||zt},window); //# sourceMappingURL=jsrender.min.js.map diff --git a/jsrender.min.js.map b/jsrender.min.js.map index 5db6fdc..6f517a9 100644 --- a/jsrender.min.js.map +++ b/jsrender.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["jsrender.js"],"names":["factory","global","$","jQuery","exports","module","fn","define","amd","getDerivedMethod","baseMethod","method","ret","tag","this","prevBase","base","apply","arguments","getMethod","$isFunction","_d","noop","tagHandlersFromProps","tagCtx","prop","props","rHasHandlers","test","fix","constructor","prototype","retVal","val","dbgBreak","console","log","e","baseApply","JsViewsError","message","name","link","$extend","target","source","$viewsDelimiters","openChars","closeChars","$isArray","$views","linkChar","error","delimOpenChar0","delimOpenChar1","delimCloseChar0","delimCloseChar1","$subSettings","delimiters","rTag","$sub","RegExp","rTmpl","$viewsSettings","getView","inner","type","undefined","views","i","l","found","view","root","_","useKey","get","length","parent","getNestedIndex","index","getIndex","getPathObject","ob","path","ltOb","prevOb","tokens","split","lt","contextParameter","key","value","wrapped","deps","res","obsCtxPrm","tagElse","callView","newRes","storeView","isUpdate","isRenderCall","store","ctx","hasOwnProperty","$helpers","linked","_cxp","scope","isTop","_ocps","_ocp","_vw","_key","ind","updateValue","observable","setProperty","_ceo","unshift","cvtArgs","data","_ucp","getTemplate","tmpl","getRsc","$templates","convertVal","converter","onError","linkCtx","argsLen","bindTo","boundTag","bnds","_lr","args","_bd","_lc","_tg","bnd","unlinked","inline","tagName","convert","onArrayChange","flow","tagCtxs","_is","extendCtx","_er","onRender","convertArgs","bound","boundArgs","bindFrom","slice","argOrProp","arg0","context","convertBoundArgs","getResource","resourceType","itemName","renderTag","parentView","bindToOrBindFrom","bindArray","m","isNaN","parseInt","topView","tagDef","template","tags","attr","parentTag","n","itemRet","tagCtxCtx","ctxPrm","initVal","content","callInit","mapDef","thisMap","bdArgs","tagDataMap","contentCtx","bindFromLength","bindToLength","linkedElement","defaultCtx","parentTmpl","lateRender","params","tmpls","render","renderContent","bndArgs","_getTmpl","init","_ctr","ths","arrVws","dataBoundOnly","dataMap","map","parents","parentTags","rendering","rndr","argDefault","linkedCtxParam","fromIndex","toIndex","_dfAt","noVws","HTML","_cp","cvt","src","unmap","tgt","rWrappedInViewMarker","links","renderWithViews","$converters","html","View","contentTmpl","parentView_","self_","self","isArray","id","viewId","cache","_ct","_cchCt","scp","indexStr","push","splice","compileChildResources","storeName","storeNames","resources","jsvStores","compileTag","Tag","baseTag","compiledDef","depends","$tags","_parentTmpl","compileTmpl","options","lookupTemplate","currentName","nodeType","elem","document","getElementById","innerHTML","getAttribute","tmplAttr","jsvTmpl","tmplName","setAttribute","compiledTmpl","tmplOrMarkup","_html","markup","tmplObject","tmplFn","replace","rEscapeQuotes","getDefaultVal","defaultVal","call","addParentRef","ref","Object","defineProperty","configurable","compileViewModel","JsvVm","vm","iterate","action","getterType","parentRef","j","getterCount","getters","getter","viewModels","JSON","parse","childOb","arr","merge","viewModel","$expando","getterNames","mod","assigned","newModArr","k","model","$observable","refresh","concat","unmapArray","modelArr","charAt","extend","proto","cnstr","privField","set","Function","htmlTag","wrapMap","$subSettingsAdvanced","_wm","rFirstElem","exec","toLowerCase","div","trim","registerStore","storeSettings","theStore","item","compile","thisStore","onStore","OBJECT","getTgt","addSetting","st","Map","baseMap","noIteration","isTopRenderCall","prevData","prevIndex","result","useViews","newView","childView","itemResult","swapContent","outerOnRender","itemVar","newCtx","noLinking","_wrp","nl","syntaxError","helpers","contentView","onRenderError","fallback","Err","isLinkExpr","convertBack","hasElse","pushprecedingContent","shift","loc","substr","rNewLine","blockTagCheck","block","parseTag","all","bind","colon","codeTag","slash","bind2","closeBlock","late","openTagName","isLateOb","pathBindings","ctxProps","paramsArgs","paramsProps","paramsCtxProps","useTrigger","allowCode","rUnescapeQuotes","rTestElseIf","current","substring","stack","pop","parseParams","rBuildHash","onerror","isCtxPrm","keyToken","keyValue","arg","param","hasHandlers","newNode","parsedParam","bindings","astTop","buildCode","setPaths","pathsArr","paths","skp","paramStructure","paramCode","paramVals","parseTokens","lftPrn0","lftPrn","operator","err","eq","path2","prn","comma","lftPrn2","apos","quot","rtPrn","rtPrnDot","prn2","space","full","parsePath","allPath","not","object","helper","viewProperty","pathTokens","leafToken","subPath","binds","named","bindto","_jsvto","bndCtx","bd","theOb","_cpfn","sb","prm","pathStart","fnDp","compiledPathStart","compiledPath","join","expr","newOb","lftPrnFCall","aposed","quoted","bndStack","_cpPthSt","_cpKey","cpFnStore","fnCall","prnDp","indexOf","prnStack","prnInd","paramIndex","boundName","rPath","prnStart","0","rBracketQuote","rPrm","ast","node","hasTag","hasEncoder","getsVal","hasCnvt","useCnvt","tmplBindings","boundOnErrStart","boundOnErrEnd","tagRender","nestedTmpls","nestedTmpl","tagAndElses","nextIsElse","oldCode","isElse","isGetVal","tagCtxFn","tagStart","trigger","retStrOpen","retStrClose","tmplBindingKey","templates","converters","code","tmplOptions","debug","debugMode","_tag","parentContext","getTargetProps","propsArr","noFunctions","isFunction","getTargetSorted","mapped","start","end","propParams","filter","sort","directSort","step","reverse","v","a","b","onFilter","sorted","paged","$fnRender","tmplElem","jquery","getCharEntity","ch","charEntities","charCodeAt","getCharFromEntity","match","token","charsFromEntities","htmlEncode","text","rIsHtml","rHtmlEncode","dataEncode","rDataEncode","dataUnencode","rDataUnencode","setGlobals","jsvStoreName","setting","versionNumber","rAttrEncode","&","<",">","\u0000","'","\"","`","=","amp","gt","$render","jsr","jsrender","jsrToJq","jsviews","sub","syntaxErr","settings","advSet","_thp","_gm","_cnvt","_err","_sq","advanced","Error","_getOb","getCache","expando","renderFile","__express","Array","obj","_jq","jq","_clFns","_jsv","if","done","selected","for","sortDataMap","cloned","setDataMap","range","include","*",":*","dbg","encode","unencode","url","encodeURI","window"],"mappings":";;CAaC,SAASA,EAASC,GAElB,GAAIC,GAAID,EAAOE,MAEQ,iBAAZC,SACVC,OAAOD,QAAUF,EACdF,EAAQC,EAAQC,GAChB,SAASA,GACV,GAAIA,IAAMA,EAAEI,GACX,KAAM,wBAEP,OAAON,GAAQC,EAAQC,IAEG,kBAAXK,SAAyBA,OAAOC,IACjDD,OAAO,WACN,MAAOP,GAAQC,KAGhBD,EAAQC,GAAQ,IAKlB,SAASA,EAAQC,GACjB,YAsIA,SAASO,GAAiBC,EAAYC,GACrC,MAAO,YACN,GAAIC,GACHC,EAAMC,KACNC,EAAWF,EAAIG,IAKhB,OAH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pEnD,EAAMqL,QAAWvL,EAAO6L,cAAe,GAASpK,GAASzB,EAAOiH,KAAK,MACnE+P,EAAYuI,MAAQvI,EAAYmI,OAASnI,EAAYoI,KAAOpI,EAAYyI,MAAQzI,EAAYsI,QAAUtI,EAAY0I,SAChHxf,EAAMqf,MAAQrf,EAAMif,OAASjf,EAAMkf,KAAOlf,EAAMuf,MAAQvf,EAAMof,QAAUpf,EAAMwf,UAC9ExS,EAAKgX,aAGXvc,MAAM,GAEPzH,OACCkO,QAAS,MACT7C,QAASA,EAAQsT,GACjB3T,KAAMpL,EACN6H,MAAM,GAEP2c,SACC3c,MAAM,GAEP4c,KAECzZ,OAAQtK,EACRmH,MAAM,GAEP6c,MAEC1Z,OAAQtK,EACRmH,MAAM,GAEP8c,IAAKvf,GAASuf,IAAM7X,GAAY6X,IAAM/jB,IAGvCkM,IACCC,KAAM+T,EACNpX,KAAMoX,EACN8D,OAAQ1D,EACR2D,SAAUzD,GACV0D,IAAK,SAAS/D,GAEb,MAAele,SAARke,EAAoBgE,UAAU,GAAKhE,GAAiB,OAATA,EAAgBA,EAAO,MAY5E,MAPA5e,IAAeG,GAAKsgB,SACpBjhB,IAAY/C,GAAG0jB,IAAKjV,QACpB5K,GAAeL,WAAW,KAAM,KAAM,KAElCogB,IACHF,GAAIxf,MAAM4f,IAAIkB,IAAIhlB,GAEZA,GAAK0jB,IACT0C","file":"jsrender.min.js","sourcesContent":["/*! JsRender v1.0.10: http://jsviews.com/#jsrender */\n/*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */\n/*\n * Best-of-breed templating in browser or on Node.js.\n * Does not require jQuery, or HTML DOM\n * Integrates with JsViews (http://jsviews.com/#jsviews)\n *\n * Copyright 2021, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take optional jQuery passed as parameter: require('jsrender')(jQuery)\n\t\t\t\tif ($ && !$.fn) {\n\t\t\t\t\tthrow \"Provide jQuery or null\";\n\t\t\t\t}\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine(function() {\n\t\t\treturn factory(global);\n\t\t});\n\t} else { // Browser using plain ',Qn='',Qn='',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousSibling;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastChild;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild,\n\t\t\t\t\t\t// since we have removed white space within elCnt. Hence support IE < 9\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\t\ttmpl = currentView.tmpl;\n\t\tlinkMarkup = normalizeLinkTag(linkMarkup, defaultAttr(node));\n\t\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = linkExprStore[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\tlinkExprStore[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup, or for a linkedElement\n\tfunction handler(ev, eventArgs) {\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t\tif (!eventArgs || !eventArgs.refresh) {\n\t\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t}\n\t}\n\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\n\tif (linkCtx.elem.nodeName === \"SELECT\"\n\t\t&& (linkCtx.elem._jsvLkEl // A SELECT which is a linkedElement\n\t\t|| (linkCtxType === \"link\" && !linkCtx.attr && linkCtx.convert !== undefined))) { // A SELECT with a data-link binding (the assign tag {:...}, not another expression such as {on ...} (See https://github.com/BorisMoore/jsviews/issues/444))\n\t\t\tvar source,\n\t\t\t\telem = linkCtx.elem,\n\t\t\t\t$elem = $(elem);\n\t\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\t\tif (elem._jsvLkEl) {\n\t\t\t\t\t\t$elem.val(elem._jsvLkEl.cvtArgs(elem._jsvElse, 1)[elem._jsvInd]); // SELECT is a linkedElement, so set to value of bndArgs(elseIndex)[bindToIndex]\n\t\t\t\t\t} else if (linkCtx.tag) {\n\t\t\t\t\t\t$elem.val(linkCtx.tag.cvtArgs(0,1)); // SELECT with data-link expression with convert=... convertBack=...\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsource = linkCtx.fn(view.data, view, $sub); // SELECT with data-link expression (either data-link='expression', or data-link='{cvt:expression:cvtBk}')\n\t\t\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\t// If the bound property or arg has not yet been set (e.g. during initial rendering),\n\t\t\t\t// or has been unset, because onUpdate is set to true, or if onUpdate is false,\n\t\t\t\t// but this particular bound arg/prop is being changed observably: call setValue()\n\t\t\t\ttag.setValue(props[l], l, m, ev, eventArgs);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tif (tag._tgId) {\n\t\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex, isCpfn,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tisCpfn = lastPath._cpfn && !lastPath.sb; // leaf binding to computed property/function \"a.b.c()\"\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tto.isCpfn = isCpfn;\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"))) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$extend(tagCtx.ctx, newTagCtx.ctx); // We don't support propagating ctx variables, ~foo, observably, to nested views. So extend, not setProperty...\n\t\t\ttagCtx.args = newTagCtx.args;\n\t\t\tif (refresh) {\n\t\t\t\ttagCtx.tmpl = newTagCtx.tmpl;\n\t\t\t}\n\t\t\t$observable(tagCtx.props).setProperty(newTagCtx.props);\n\t\t}\n\t}\n\t$sub._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\tif (object = binding.bnd[objId]) {\n\t\t\t\tobsId = binding.cbId;\n\t\t\t\tif ($isArray(object)) {\n\t\t\t\t\t$([object]).off(arrayChangeStr + obsId).off(propertyChangeStr + obsId); // There may be either or both of arrayChange and propertyChange\n\t\t\t\t} else {\n\t\t\t\t\t$(object).off(propertyChangeStr + obsId);\n\t\t\t\t}\n\t\t\t\tdelete binding.bnd[objId];\n\t\t\t}\n\t\t}\n\n\t\tif (linkCtx = binding.linkCtx) {\n\t\t\tif (tag = linkCtx.tag) {\n\t\t\t\tif (tagCtxs = tag.tagCtxs) {\n\t\t\t\t\tl = tagCtxs.length;\n\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete cbBindingsStore[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments);\n\n\tif (oldJsvDelimiters !== $viewsDelimiters) {\n\t\t// If JsRender was loaded before JsViews, then need also to initialize and set globals in that JsRender instance\n\t\tret = $viewsDelimiters.apply(0, arguments);\n\t}\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tif (arguments.length < 4) {\n\t\tif (+index !== index) {\n\t\t\tasync = index;\n\t\t\ttagElse = index = 0;\n\t\t} else if (+tagElse !== tagElse) {\n\t\t\tasync = tagElse;\n\t\t\ttagElse = 0;\n\t\t}\n\t}\n\tvalues[index||0] = val;\n\tupdateValues(values, tagElse, async, bindId, ev);\n\treturn self;\n}\n\nfunction setValues() {\n\t// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = this.tag.bindTo.length,\n\t\tev = arguments[m],\n\t\teventArgs = arguments[m+1];\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index, ev, eventArgs);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\tselect = deep ? select || \"*\" : select;\n\t\t\tfiltered = select ? nodes.filter(select) : nodes;\n\t\t\tnodes = deep ? filtered.add(nodes.find(select)) : filtered;\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse, ev, eventArgs) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, indexTo, linkedElems, newVal,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse];\n\n\t\t\t\tif (tagCtx._bdArgs && (eventArgs || val !== undefined) && tagCtx._bdArgs[indexFrom]===val\n\t\t\t\t\t&& (!eventArgs || eventArgs.change !== \"set\" || ev.target !== val && eventArgs.value !== val)) {\n\n\t\t\t\t\tif (tagCtx._bdVals) { // If val is not undefined (or is coming from an observable change event), and is a value that was already returned, use stored value and don't call tag.setValue()\n\t\t\t\t\t\tval = tagCtx._bdVals[indexFrom];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Call tag method tag.setValue(), if implemented\n\t\t\t\t\ttagCtx._bdArgs = tagCtx._bdArgs || [];\n\t\t\t\t\ttagCtx._bdArgs[indexFrom] = val;\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse, ev, eventArgs);\n\t\t\t\t\tif (newVal !== undefined) {\n\t\t\t\t\t\ttagCtx._bdVals = tagCtx._bdVals || [];\n\t\t\t\t\t\ttagCtx._bdVals[indexFrom] = newVal; // store value, so that if same value is called later we'll use the stored value, and won't call tag.setValue()\n\t\t\t\t\t\tval = newVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val !== undefined && (linkedCtxParam = theTag.linkedCtxParam) && linkedCtxParam[indexFrom]) {\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxParam[indexFrom], val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = $.isArray(val)\n\t\t\t\t\t\t\t\t\t\t\t\t? $.inArray(linkedEl.value, val) > -1\n\t\t\t\t\t\t\t\t\t\t\t\t: val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\tvar tagElse, async,\n\t\t\t\ttag = this,\n\t\t\t\tbindToLength = tag.bindTo ? tag.bindTo.length : 1,\n\t\t\t\textra = arguments.length - bindToLength;\n\n\t\t\tif (extra) {\n\t\t\t\ttagElse = arguments[bindToLength];\n\t\t\t\tif (extra > 1) {\n\t\t\t\t\tasync = extra > 1 ? arguments[bindToLength + 1] : undefined;\n\t\t\t\t} else if (+tagElse !== tagElse) {\n\t\t\t\t\tasync = tagElse;\n\t\t\t\t\ttagElse = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn updateValues(arguments, tagElse, async, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems, delayed) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false\n\t\t\t\t\t&& !view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, delayed) {\n\t\t\t// view.removeViews() removes all the child views\n\t\t\t// view.removeViews(index) removes the child view with specified index or key\n\t\t\t// view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index\n\t\t\tfunction removeView(index) {\n\t\t\t\tvar id, bindId, parentElem, prevNode, nextNode, nodesToRemove,\n\t\t\t\t\tviewToRemove = views[index];\n\n\t\t\t\tif (viewToRemove && viewToRemove.link) {\n\t\t\t\t\tid = viewToRemove._.id;\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tnodesToRemove = viewToRemove.nodes();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove child views, without removing nodes\n\t\t\t\t\tviewToRemove.removeViews(undefined, undefined, true);\n\n\t\t\t\t\tviewToRemove.type = undefined; // Set type to undefined: used as a flag that this view is being removed\n\t\t\t\t\tprevNode = viewToRemove._prv;\n\t\t\t\t\tnextNode = viewToRemove._nxt;\n\t\t\t\t\tparentElem = viewToRemove.parentElem;\n\t\t\t\t\t// If prevNode and nextNode are the same, the view is empty\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tif (viewToRemove._elCnt) {\n\t\t\t\t\t\t\t// if keepNodes is false (and transferring of tokens has not already been done at a higher level)\n\t\t\t\t\t\t\t// then transfer tokens from prevNode which is being removed, to nextNode.\n\t\t\t\t\t\t\ttransferViewTokens(prevNode, nextNode, parentElem, id, \"_\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(nodesToRemove).remove();\n\t\t\t\t\t}\n\t\t\t\t\tif (!viewToRemove._elCnt && prevNode) {\n\t\t\t\t\t\tprevNode.parentNode.removeChild(prevNode); // (prevNode.parentNode is parentElem, except if jQuery Mobile or similar has inserted an intermediate wrapper\n\t\t\t\t\t\tnextNode.parentNode.removeChild(nextNode);\n\t\t\t\t\t}\n\t\t\t\t\tsetArrayChangeLink(viewToRemove);\n\t\t\t\t\tfor (bindId in viewToRemove._.bnds) {\n\t\t\t\t\t\tremoveViewBinding(bindId);\n\t\t\t\t\t}\n\t\t\t\t\tdelete viewStore[id];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar current, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar tag,\n\t\t\t\t\tprv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\ttag = bindingStore[id].linkCtx.tag;\n\t\t\t\t\tif (tag.inline) {\n\t\t\t\t\t\ttag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\nreturn $;\n}, window));"]} \ No newline at end of file +{"version":3,"sources":["jsviews.js"],"names":["factory","global","$","jQuery","exports","module","define","amd","getDerivedMethod","baseMethod","method","ret","tag","this","prevBase","base","apply","arguments","getMethod","$isFunction","_d","noop","tagHandlersFromProps","tagCtx","prop","props","rHasHandlers","test","fix","constructor","prototype","retVal","val","dbgBreak","console","log","e","baseApply","JsViewsError","message","name","link","$extend","target","source","$viewsDelimiters","openChars","closeChars","$isArray","$views","linkChar","error","delimOpenChar0","delimOpenChar1","delimCloseChar0","delimCloseChar1","$subSettings","delimiters","rTag","$sub","RegExp","rTmpl","$viewsSettings","getView","inner","type","undefined","views","i","l","found","view","root","_","useKey","get","length","parent","getNestedIndex","index","getIndex","getPathObject","ob","path","ltOb","fn","prevOb","tokens","split","lt","contextParameter","key","value","wrapped","deps","res","obsCtxPrm","tagElse","callView","newRes","storeView","isUpdate","isRenderCall","store","ctx","hasOwnProperty","$helpers","linked","_cxp","scope","isTop","_ocps","_ocp","_vw","_key","ind","updateValue","observable","setProperty","_ceo","unshift","cvtArgs","data","_ucp","getTemplate","tmpl","getRsc","$templates","convertVal","converter","onError","linkCtx","argsLen","bindTo","boundTag","bnds","_lr","args","_bd","_lc","_tg","bnd","unlinked","inline","tagName","convert","onArrayChange","flow","tagCtxs","_is","extendCtx","_er","onRender","convertArgs","bound","boundArgs","bindFrom","slice","argOrProp","arg0","context","convertBoundArgs","getResource","resourceType","itemName","renderTag","parentView","bindToOrBindFrom","bindArray","m","isNaN","parseInt","topView","tagDef","template","tags","attr","parentTag","n","itemRet","tagCtxCtx","ctxPrm","initVal","content","callInit","mapDef","thisMap","bdArgs","tagDataMap","contentCtx","bindFromLength","bindToLength","linkedElement","defaultCtx","parentTmpl","lateRender","params","tmpls","render","renderContent","bndArgs","_getTmpl","init","_ctr","ths","arrVws","dataBoundOnly","dataMap","map","parents","parentTags","rendering","rndr","argDefault","linkedCtxParam","fromIndex","toIndex","_dfAt","noVws","HTML","_cp","cvt","src","unmap","tgt","rWrappedInViewMarker","links","renderWithViews","$converters","html","View","contentTmpl","parentView_","self_","self","isArray","id","viewId","cache","_ct","_cchCt","scp","indexStr","push","splice","compileChildResources","storeName","storeNames","resources","jsvStores","compileTag","Tag","baseTag","compiledDef","depends","$tags","_parentTmpl","compileTmpl","options","lookupTemplate","currentName","nodeType","elem","document","getElementById","charAt","innerHTML","getAttribute","tmplAttr","jsvTmpl","tmplName","setAttribute","compiledTmpl","tmplOrMarkup","_html","markup","tmplObject","tmplFn","replace","rEscapeQuotes","getDefaultVal","defaultVal","call","addParentRef","ref","Object","defineProperty","configurable","compileViewModel","JsvVm","vm","iterate","action","getterType","parentRef","j","getterCount","getters","getter","viewModels","JSON","parse","childOb","arr","merge","viewModel","$expando","getterNames","mod","assigned","newModArr","k","model","$observable","refresh","concat","unmapArray","modelArr","extend","proto","cnstr","privField","set","Function","htmlTag","wrapMap","$subSettingsAdvanced","_wm","rFirstElem","exec","toLowerCase","div","trim","registerStore","storeSettings","theStore","item","compile","thisStore","onStore","OBJECT","getTgt","addSetting","st","Map","baseMap","noIteration","isTopRenderCall","prevData","prevIndex","result","useViews","newView","childView","itemResult","swapContent","outerOnRender","itemVar","newCtx","noLinking","_wrp","nl","syntaxError","helpers","contentView","onRenderError","fallback","Err","isLinkExpr","convertBack","hasElse","pushprecedingContent","shift","loc","substr","rNewLine","blockTagCheck","block","parseTag","all","bind","colon","codeTag","slash","bind2","closeBlock","late","openTagName","isLateOb","pathBindings","ctxProps","paramsArgs","paramsProps","paramsCtxProps","useTrigger","allowCode","rUnescapeQuotes","rTestElseIf","current","substring","stack","pop","parseParams","rBuildHash","onerror","isCtxPrm","keyToken","keyValue","arg","param","hasHandlers","newNode","parsedParam","bindings","astTop","buildCode","setPaths","pathsArr","paths","skp","paramStructure","paramCode","paramVals","parseTokens","lftPrn0","lftPrn","operator","err","eq","path2","prn","comma","lftPrn2","apos","quot","rtPrn","rtPrnDot","prn2","space","full","parsePath","allPath","not","object","helper","viewProperty","pathTokens","leafToken","subPath","binds","named","bindto","_jsvto","bndCtx","bd","theOb","_cpfn","sb","prm","pathStart","fnDp","compiledPathStart","compiledPath","join","expr","newOb","lftPrnFCall","aposed","quoted","bndStack","_cpPthSt","_cpKey","cpFnStore","fnCall","prnDp","indexOf","prnStack","prnInd","paramIndex","boundName","rPath","prnStart","0","rBracketQuote","rPrm","ast","node","hasTag","hasEncoder","getsVal","hasCnvt","useCnvt","tmplBindings","boundOnErrStart","boundOnErrEnd","tagRender","nestedTmpls","nestedTmpl","tagAndElses","nextIsElse","oldCode","isElse","isGetVal","tagCtxFn","tagStart","trigger","retStrOpen","retStrClose","tmplBindingKey","templates","converters","code","tmplOptions","debug","debugMode","_tag","parentContext","getTargetProps","propsArr","noFunctions","isFunction","getTargetSorted","mapped","start","end","propParams","filter","sort","directSort","step","reverse","v","a","b","onFilter","sorted","paged","$fnRender","tmplElem","jquery","getCharEntity","ch","charEntities","charCodeAt","getCharFromEntity","match","token","charsFromEntities","htmlEncode","text","rIsHtml","rHtmlEncode","dataEncode","rDataEncode","dataUnencode","rDataUnencode","updateValues","sourceValues","async","bindId","ev","cvtBack","cnvtName","binding","sourceValue","origVals","sourceElem","sourceEl","tos","to","tcpTag","exprOb","contextCb","vals","_tgId","defineBindToDataTargets","bindingStore","chg","nodeName","multiple","_jsvSel","$inArray","checked","onBeforeUpdateVal","change","setValue","_jsvInd","_jsvLkEl","_jsvElse","_ctxCb","_cpCtx","isCpfn","onElemChange","fromAttr","defaultAttr","setter","fnSetters","_jsvTr","delegateTarget","activeBody","_jsvChg","rSplitBindings","lastIndex","_jsvBnd","onDataLinkedTagChange","eventArgs","noUpdate","forceUpdate","hasError","bindEarly","linkFn","parentElem","parentNode","oldLinkCtx","onEvent","changeHandler","onBeforeChangeStr","_toLk","VALUE","CHECKBOX","CHECKED","onUpdate","mergeCtxs","NONE","callAfterLink","observeAndBind","onAfterChangeStr","onUnbind","linkedElems","linkedElem","mainElem","displayElem","_cnvt","TRUE","addLinkMethods","updateContent","_noUpd","setDefer","_df","deferAttr","prevNode","nextNode","nodesToRemove","useProp","openIndex","closeIndex","testElem","cStyle","jsvSel","renders","targetParent","$target","targetVal","_val","_elCnt","_prv","_nxt","currentStyle","getComputedStyle","display","_jsvd","displayStyles","createElement","body","appendChild","removeChild","style","RADIO","nodes","transferViewTokens","jsvAttrStr","disposeTokens","previousSibling","lastChild","remove","empty","children","TEXTCONTENT","selected","lateLink","arrayChangeHandler","onBeforeChange","onAfterChange","items","srt","addViews","_dly","removeViews","moveViews","oldIndex","fixIndex","setArrayChangeLink","handler","arrayBinding","bndArr","off","arrayChangeStr","on","linkGetVal","_fe","contentEditable","from","renderAndLink","linkToNode","prevView","elCnt","removeViewBinding","nextSibling","addBindingMarkers","bindingKey","viewStore","exprFnDeps","propDeps","tagDepends","allowArray","cvtBk","_hdl","_dp","_depends","bdId","_apply","boundProps","_bndId","bindLinkedElChange","lnkCtx","tmplLink","$link","tmplOrLinkExpr","useInput","elementChangeStr","vwInfos","placeholderParent","targetEl","prntView","replaceMode","$view","addDataBinding","cleanData","lnk","viewInfos","rOpenViewMarkers","viewLink","outerData","validateOnly","convertMarkers","preceding","selfClose","closeTag","spaceBefore","boundId","spaceAfter","tag1","tag2","closeTag2","spaceAfterClose","selfClose2","endOpenTag","errorMsg","bndId","endOfElCnt","inTag","isVoid","tagStack","validate","voidElems","prevElCnt","elContent","defer","ids","openScript","closeScript","deferStack","badParent","processViewInfos","deferPath","deferChar","bindChar","onAftCr","deep","addedBindEls","_tkns","len","vwInfo","previousElementSibling","lastElementChild","open","removeSubStr","onAfterCreateStr","onAfterCreate","bindEls","getViewInfos","level","tagDepth","dataLink","wrap","selector","linkViewsSel","elems","qsa","querySelectorAll","prevNodes","markerNodeInfo","contains","isLink","rViewMarkers","skip","processInfos","$viewsLinkAttr","rOpenTagMarkers","unmarkPrevOrNextNode","prevIds","linkInfo","nextView","depth","fragment","copiedNode","firstTag","wrapper","thisId","noValidate","markPrevOrNextNode","namespaceURI","rConvertMarkers","safeFragment","createDocumentFragment","firstChild","insertBefore","linkMarkup","currentView","boundTagId","tagExpr","rTagIndex","linkExpressions","bindDataLinkTarget","normalizeLinkTag","rTagDatalink","linkExprStore","linkCtxType","_gccb","$elem","str","SCRIPT","isVal","rBinding","getInfos","close","elPath","infos","rMarkerTokens","removeAttribute","marker","twoway","copyFromTagCtxToTag","linkedElements","$linkCtxElem","linkCtxElem","linkedEl","linkedTag","tagCtxElse","oldVal","indexTo","mapDeps","tagCtxslength","mainElement","displayElement","Array","contents","onBind","mapProps","mapDepends","observe","setSize","height","width","className","_jsvCl","hasClass","removeClass","addClass","onAfterLink","asyncOnElemChange","which","setTimeout","bindTriggerEvent","trig","onoff","isIE","$linkedElem","newTrig","oldTrig","pathIndex","lastPath","bindtoOb","targetPaths","bindTos","targetPathsElses","resolveDataTargetPath","targetPath","topCp","newCtxs","newTagCtx","_thp","clean","elemArray","linkedElemTag","objId","obsId","allLinkedElems","cbId","propertyChangeStr","onDispose","cbBindingsStore","$unlink","each","innerView","getElementsByTagName","inputAttrib","viewOrTagChar","viewOrTag","precedingLength","emptyView","vwItem","rOpenMarkers","values","setValues","tagOrView","theTag","theView","select","filtered","add","find","withMarkers","prevIsFirstNode","lastSibling","childTags","_gm","indexFrom","newVal","_bdArgs","_bdVals","inArray","extra","domChange","hasListener","_data","events","domChangeNotification","triggerHandler","dataItems","delayed","viewsCount","itemsCount","keepNodes","removeView","viewToRemove","parts","itemView","setPrv","prv","rTagMarkers","selfNxt","backwards","firstChange","lastChange","movedNodes","viewsToMove","appendTo","afterParts","endChange","startView","endView","afterView","startParts","endParts","observeProps","updatePropsArr","update","insert","observeMappedProps","removeProperty","oldValue","shallowArrayFilter","rShallowArrayPath","setGlobals","jsvStoreName","$observe","setting","versionNumber","rAttrEncode","&","<",">","\u0000","'","\"","`","=","amp","gt","$render","jsr","jsrender","jsrToJq","jsviews","sub","syntaxErr","settings","advSet","_err","_sq","advanced","Error","_getOb","getCache","expando","renderFile","__express","obj","_jq","jq","_clFns","_jsv","if","done","for","sortDataMap","cloned","setDataMap","range","include","*",":*","dbg","encode","unencode","url","encodeURI","$eventSpecial","event","special","PARSEINT","rNotWhite","rShallowPath","propChng","arrChng","observeStr","observeObjKey","observeCbKey","observeInnerCbKey","$data","asyncBatch","getCbKey","cb","_cId","ObjectObservable","ns","_ns","ArrayObservable","wrapArray","dependsPaths","callback","rt","nextObj","out","_ar","onDataChange","isOb","noArray","parentObs","observeAll","_arOk","array","_path","observe_apply","$observeAll","unobserve","$unobserveAll","namespace","objMap","observeArrayItems","unobs","newAllPath","filterAndObserveAll","nestedArray","newObject","newParentObs","_fltr","nextParentObs","updatedTgt","wrappedCb","isObject","obId","notRemoving","un","hasData","shallowFilter","$unobserve","batchTrigger","batch","_go","_trigger","innerObserve","unobserveBinding","observeOnOff","fullPath","pathStr","isArrayBinding","evData","dataOb","boundObOrArr","prntObs","allPth","initialNs","el","cbBindings","unbind","relPath","prevAllPath","observeObjects","observeObjectPaths","pths","getInnerCb","newObj","observePath","prts","obArrAddRemove","arrIndex","dep","obArr","prt","fnProp","isGet","_inId","pth","innerCb","p","inId","initNsArr","initNsArrLen","lastArg","wait","delay","asyncObserve","_batch","unobserveAll","nonStrict","pair","tempBatch","multi","_setProperty","leaf","removeProp","property","Date","force","previous","_insert","oldLength","numToRemove","_remove","move","newIndex","numToMove","_move","excess","newItems","insertAdded","addedItems","dataLength","newItem","num","oldItems","newLength","_srt","handleObj","oldMapOrTarget","unbound","changing","updatedMap","obsSrc","obs","srcFlt","obsTgt","obt","_updt","tgtFlt","oldMap","newMap","obmp","_def","_gck","_obs","oldAdvSet","window","navigator","userAgent","textContent","RADIOINPUT","CHECKBOXINPUT","bindElsSel","input","valueBinding","isCleanCall","oldCleanData","oldJsvDelimiters","querySelector","ol","ul","table","tbody","thead","tfoot","tr","colgroup","dl","optgroup","svg","svg_ns","br","img","hr","area","col","meta","command","embed","keygen","track","wbr","rViewPath","requiresStr","regularExpression","currentValue","toggle","_hi","activeElem","contextOb","_sel","_evs","_hlr","oldIsCleanCall","radiogroup","Math","random","domChngCntnr","useDisable","disabled","_dmChg","forOrIfTagCtx","checkboxgroup","tgCtxProps","linkExpr","arrayView","targetLength","arrayBindings","_ars","tagCt","newTagCtxs","prevArg","different","tci","getInnerView","nd","isVl","unlink","oldFn","_glt","regEx","linkCtxs","last","nextPath","addedTagCpDep","paramVal","paramExpr","tagCtxPrm","cloneExprObjects","clones","linkAttr","option","caption","th","td","legend","support","htmlSerialize","textarea"],"mappings":";;CAcC,SAASA,EAASC,GAElB,GAAIC,GAAID,EAAOE,MAEQ,iBAAZC,SACVC,OAAOD,QAAUF,EACdF,EAA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Rc,UACCvoB,GAAI,YAKAvjB,GACJwqC","file":"jsviews.min.js","sourcesContent":["/*! jsviews.js v1.0.11 single-file version: http://jsviews.com/ */\n/*! includes JsRender, JsObservable and JsViews - see: http://jsviews.com/#download */\n\n/* Interactive data-driven views using JsRender templates */\n\n//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsRender >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n/* JsRender:\n * See http://jsviews.com/#jsrender and http://github.com/BorisMoore/jsrender\n * Copyright 2021, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take jQuery passed as parameter: require(\"jsviews\")(jQuery)\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine([\"jquery\"], function($) {\n\t\t\treturn factory(global, $);\n\t\t}); // Require jQuery\n\t} else { // Browser using plain ',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousElementSibling; // IE9 or later only\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastElementChild; // IE9 or later only\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\t\ttmpl = currentView.tmpl;\n\t\tlinkMarkup = normalizeLinkTag(linkMarkup, defaultAttr(node));\n\t\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = linkExprStore[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\tlinkExprStore[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup, or for a linkedElement\n\tfunction handler(ev, eventArgs) {\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t\tif (!eventArgs || !eventArgs.refresh) {\n\t\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t}\n\t}\n\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\n\tif (linkCtx.elem.nodeName === \"SELECT\"\n\t\t&& (linkCtx.elem._jsvLkEl // A SELECT which is a linkedElement\n\t\t|| (linkCtxType === \"link\" && !linkCtx.attr && linkCtx.convert !== undefined))) { // A SELECT with a data-link binding (the assign tag {:...}, not another expression such as {on ...} (See https://github.com/BorisMoore/jsviews/issues/444))\n\t\t\tvar source,\n\t\t\t\telem = linkCtx.elem,\n\t\t\t\t$elem = $(elem);\n\t\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\t\tif (elem._jsvLkEl) {\n\t\t\t\t\t\t$elem.val(elem._jsvLkEl.cvtArgs(elem._jsvElse, 1)[elem._jsvInd]); // SELECT is a linkedElement, so set to value of bndArgs(elseIndex)[bindToIndex]\n\t\t\t\t\t} else if (linkCtx.tag) {\n\t\t\t\t\t\t$elem.val(linkCtx.tag.cvtArgs(0,1)); // SELECT with data-link expression with convert=... convertBack=...\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsource = linkCtx.fn(view.data, view, $sub); // SELECT with data-link expression (either data-link='expression', or data-link='{cvt:expression:cvtBk}')\n\t\t\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\t// If the bound property or arg has not yet been set (e.g. during initial rendering),\n\t\t\t\t// or has been unset, because onUpdate is set to true, or if onUpdate is false,\n\t\t\t\t// but this particular bound arg/prop is being changed observably: call setValue()\n\t\t\t\ttag.setValue(props[l], l, m, ev, eventArgs);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tif (tag._tgId) {\n\t\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex, isCpfn,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tisCpfn = lastPath._cpfn && !lastPath.sb; // leaf binding to computed property/function \"a.b.c()\"\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tto.isCpfn = isCpfn;\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"))) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$extend(tagCtx.ctx, newTagCtx.ctx); // We don't support propagating ctx variables, ~foo, observably, to nested views. So extend, not setProperty...\n\t\t\ttagCtx.args = newTagCtx.args;\n\t\t\tif (refresh) {\n\t\t\t\ttagCtx.tmpl = newTagCtx.tmpl;\n\t\t\t}\n\t\t\t$observable(tagCtx.props).setProperty(newTagCtx.props);\n\t\t}\n\t}\n\t$sub._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\tif (object = binding.bnd[objId]) {\n\t\t\t\tobsId = binding.cbId;\n\t\t\t\tif ($isArray(object)) {\n\t\t\t\t\t$([object]).off(arrayChangeStr + obsId).off(propertyChangeStr + obsId); // There may be either or both of arrayChange and propertyChange\n\t\t\t\t} else {\n\t\t\t\t\t$(object).off(propertyChangeStr + obsId);\n\t\t\t\t}\n\t\t\t\tdelete binding.bnd[objId];\n\t\t\t}\n\t\t}\n\n\t\tif (linkCtx = binding.linkCtx) {\n\t\t\tif (tag = linkCtx.tag) {\n\t\t\t\tif (tagCtxs = tag.tagCtxs) {\n\t\t\t\t\tl = tagCtxs.length;\n\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete cbBindingsStore[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments);\n\n\tif (oldJsvDelimiters !== $viewsDelimiters) {\n\t\t// If JsRender was loaded before JsViews, then need also to initialize and set globals in that JsRender instance\n\t\tret = $viewsDelimiters.apply(0, arguments);\n\t}\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tif (arguments.length < 4) {\n\t\tif (+index !== index) {\n\t\t\tasync = index;\n\t\t\ttagElse = index = 0;\n\t\t} else if (+tagElse !== tagElse) {\n\t\t\tasync = tagElse;\n\t\t\ttagElse = 0;\n\t\t}\n\t}\n\tvalues[index||0] = val;\n\tupdateValues(values, tagElse, async, bindId, ev);\n\treturn self;\n}\n\nfunction setValues() {\n\t// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = this.tag.bindTo.length,\n\t\tev = arguments[m],\n\t\teventArgs = arguments[m+1];\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index, ev, eventArgs);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\tselect = deep ? select || \"*\" : select;\n\t\t\tfiltered = select ? nodes.filter(select) : nodes;\n\t\t\tnodes = deep ? filtered.add(nodes.find(select)) : filtered;\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse, ev, eventArgs) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, indexTo, linkedElems, newVal,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse];\n\n\t\t\t\tif (tagCtx._bdArgs && (eventArgs || val !== undefined) && tagCtx._bdArgs[indexFrom]===val\n\t\t\t\t\t&& (!eventArgs || eventArgs.change !== \"set\" || ev.target !== val && eventArgs.value !== val)) {\n\n\t\t\t\t\tif (tagCtx._bdVals) { // If val is not undefined (or is coming from an observable change event), and is a value that was already returned, use stored value and don't call tag.setValue()\n\t\t\t\t\t\tval = tagCtx._bdVals[indexFrom];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Call tag method tag.setValue(), if implemented\n\t\t\t\t\ttagCtx._bdArgs = tagCtx._bdArgs || [];\n\t\t\t\t\ttagCtx._bdArgs[indexFrom] = val;\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse, ev, eventArgs);\n\t\t\t\t\tif (newVal !== undefined) {\n\t\t\t\t\t\ttagCtx._bdVals = tagCtx._bdVals || [];\n\t\t\t\t\t\ttagCtx._bdVals[indexFrom] = newVal; // store value, so that if same value is called later we'll use the stored value, and won't call tag.setValue()\n\t\t\t\t\t\tval = newVal;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val !== undefined && (linkedCtxParam = theTag.linkedCtxParam) && linkedCtxParam[indexFrom]) {\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxParam[indexFrom], val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = $.isArray(val)\n\t\t\t\t\t\t\t\t\t\t\t\t? $.inArray(linkedEl.value, val) > -1\n\t\t\t\t\t\t\t\t\t\t\t\t: val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\tvar tagElse, async,\n\t\t\t\ttag = this,\n\t\t\t\tbindToLength = tag.bindTo ? tag.bindTo.length : 1,\n\t\t\t\textra = arguments.length - bindToLength;\n\n\t\t\tif (extra) {\n\t\t\t\ttagElse = arguments[bindToLength];\n\t\t\t\tif (extra > 1) {\n\t\t\t\t\tasync = extra > 1 ? arguments[bindToLength + 1] : undefined;\n\t\t\t\t} else if (+tagElse !== tagElse) {\n\t\t\t\t\tasync = tagElse;\n\t\t\t\t\ttagElse = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn updateValues(arguments, tagElse, async, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems, delayed) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false\n\t\t\t\t\t&& !view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, delayed) {\n\t\t\t// view.removeViews() removes all the child views\n\t\t\t// view.removeViews(index) removes the child view with specified index or key\n\t\t\t// view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index\n\t\t\tfunction removeView(index) {\n\t\t\t\tvar id, bindId, parentElem, prevNode, nextNode, nodesToRemove,\n\t\t\t\t\tviewToRemove = views[index];\n\n\t\t\t\tif (viewToRemove && viewToRemove.link) {\n\t\t\t\t\tid = viewToRemove._.id;\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tnodesToRemove = viewToRemove.nodes();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove child views, without removing nodes\n\t\t\t\t\tviewToRemove.removeViews(undefined, undefined, true);\n\n\t\t\t\t\tviewToRemove.type = undefined; // Set type to undefined: used as a flag that this view is being removed\n\t\t\t\t\tprevNode = viewToRemove._prv;\n\t\t\t\t\tnextNode = viewToRemove._nxt;\n\t\t\t\t\tparentElem = viewToRemove.parentElem;\n\t\t\t\t\t// If prevNode and nextNode are the same, the view is empty\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tif (viewToRemove._elCnt) {\n\t\t\t\t\t\t\t// if keepNodes is false (and transferring of tokens has not already been done at a higher level)\n\t\t\t\t\t\t\t// then transfer tokens from prevNode which is being removed, to nextNode.\n\t\t\t\t\t\t\ttransferViewTokens(prevNode, nextNode, parentElem, id, \"_\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(nodesToRemove).remove();\n\t\t\t\t\t}\n\t\t\t\t\tif (!viewToRemove._elCnt && prevNode) {\n\t\t\t\t\t\tprevNode.parentNode.removeChild(prevNode); // (prevNode.parentNode is parentElem, except if jQuery Mobile or similar has inserted an intermediate wrapper\n\t\t\t\t\t\tnextNode.parentNode.removeChild(nextNode);\n\t\t\t\t\t}\n\t\t\t\t\tsetArrayChangeLink(viewToRemove);\n\t\t\t\t\tfor (bindId in viewToRemove._.bnds) {\n\t\t\t\t\t\tremoveViewBinding(bindId);\n\t\t\t\t\t}\n\t\t\t\t\tdelete viewStore[id];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar current, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar tag,\n\t\t\t\t\tprv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\ttag = bindingStore[id].linkCtx.tag;\n\t\t\t\t\tif (tag.inline) {\n\t\t\t\t\t\ttag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\nreturn $;\n}, window));"]} \ No newline at end of file diff --git a/package.json b/package.json index 2ccda13..abe0c00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jsviews", - "version": "v1.0.10", + "version": "v1.0.11", "description": "Next-generation MVVM and MVP framework - built on top of JsRender templates. Bringing templates to life...", "main": "./jsviews.js", "author": { @@ -35,7 +35,7 @@ "browserify": "^11.0.1", "glob-stream": "^5.0.0", "gulp": "^3.9.0", - "jsrender": "^1.0.10", + "jsrender": "^1.0.11", "qunit": "^0.7.6" }, "dependencies": { diff --git a/test/browserify/bundles/1-bundle.js b/test/browserify/bundles/1-bundle.js index d0beffc..8ab63e7 100644 --- a/test/browserify/bundles/1-bundle.js +++ b/test/browserify/bundles/1-bundle.js @@ -1,12 +1,12 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsRender: * See http://jsviews.com/#jsrender and http://github.com/BorisMoore/jsrender - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -4081,7 +4079,7 @@ if (!$ || !$.fn) { throw "JsViews requires jQuery"; // We require jQuery } -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", jsvStoreName, rTag, rTmplString, topView, $views, $observe, $observable, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -4791,7 +4789,7 @@ function renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) { tag.linkCtx = linkCtx; if (tag._.bnd = boundTag || linkCtx.fn) { // Bound if {^{tag...}} or data-link="{tag...}" - tag._.ths = tagCtx.params.props.this; // Tag has a this=expr binding, to get javascript reference to tag instance + tag._.ths = tagCtx.params.props["this"]; // Tag has a this=expr binding, to get javascript reference to tag instance tag._.lt = tagCtxs.lt; // If a late path @some.path has not returned @some object, mark tag as late tag._.arrVws = {}; } else if (tag.dataBoundOnly) { @@ -5153,6 +5151,8 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // Look for server-generated script block with id "./some/file.html" elem = document.getElementById(value); } + } else if (value.charAt(0) === "#") { + elem = document.getElementById(value.slice(1)); } else if ($.fn && !$sub.rTmpl.test(value)) { try { elem = $(value, document)[0]; // if jQuery is loaded, test for selector returning elements, and get first element @@ -7056,7 +7056,7 @@ if (jsrToJq) { // Moving from jsrender namespace to jQuery namepace - copy over //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsObservable >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsObservable: * See https://www.jsviews.com/#jsobservable and http://github.com/borismoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -8345,7 +8345,7 @@ if (!$.observe) { /* JsViews: * Interactive data-driven views using templates and data-linking. * See https://www.jsviews.com/#jsviews and http://github.com/BorisMoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -9548,15 +9548,13 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont if (deferChar === "+") { if (deferPath.charAt(j) === "-") { j--; - targetParent = targetParent.previousSibling; + targetParent = targetParent.previousElementSibling; // IE9 or later only } else { targetParent = targetParent.parentNode; } } else { - targetParent = targetParent.lastChild; + targetParent = targetParent.lastElementChild; // IE9 or later only } - // Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild, - // since we have removed white space within elCnt. Hence support IE < 9 } } if (bindChar === "^") { @@ -22889,14 +22887,14 @@ return jQuery; } ); },{}],4:[function(require,module,exports){ -/*! JsRender v1.0.10: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.11: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. * Does not require jQuery, or HTML DOM * Integrates with JsViews (http://jsviews.com/#jsviews) * - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -22935,7 +22933,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -23644,7 +23642,7 @@ function renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) { tag.linkCtx = linkCtx; if (tag._.bnd = boundTag || linkCtx.fn) { // Bound if {^{tag...}} or data-link="{tag...}" - tag._.ths = tagCtx.params.props.this; // Tag has a this=expr binding, to get javascript reference to tag instance + tag._.ths = tagCtx.params.props["this"]; // Tag has a this=expr binding, to get javascript reference to tag instance tag._.lt = tagCtxs.lt; // If a late path @some.path has not returned @some object, mark tag as late tag._.arrVws = {}; } else if (tag.dataBoundOnly) { @@ -24006,6 +24004,8 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // Look for server-generated script block with id "./some/file.html" elem = document.getElementById(value); } + } else if (value.charAt(0) === "#") { + elem = document.getElementById(value.slice(1)); } else if ($.fn && !$sub.rTmpl.test(value)) { try { elem = $(value, document)[0]; // if jQuery is loaded, test for selector returning elements, and get first element @@ -25993,4 +25993,4 @@ QUnit.test('More Errors for require() for JsRender, JsViews, JsObservable, JsRen }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../":2,"../../jquery.views":1,"jQuery":3,"jsrender":4}]},{},[5]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqcXVlcnkudmlld3MuanMiLCJqc3ZpZXdzLmpzIiwibm9kZ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WI6IHtcblx0XHRcdC8vIHN1YnNjcmlwdGlvbiwgZS5nLiBKc1ZpZXdzIGludGVncmF0aW9uXG5cdFx0XHRyUGF0aDogL14oISo/KSg/Om51bGx8dHJ1ZXxmYWxzZXxcXGRbXFxkLl0qfChbXFx3JF0rfFxcLnx+KFtcXHckXSspfCModmlld3woW1xcdyRdKykpPykoW1xcdyQuXl0qPykoPzpbLlteXShbXFx3JF0rKVxcXT8pPykkL2csXG5cdFx0XHQvLyAgICAgICAgbm90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iamVjdCAgICAgaGVscGVyICAgIHZpZXcgIHZpZXdQcm9wZXJ0eSBwYXRoVG9rZW5zICAgICAgbGVhZlRva2VuXG5cblx0XHRcdHJQcm06IC8oXFwoKSg/PVxccypcXCgpfCg/OihbKFtdKVxccyopPyg/OihcXF4/KSh+P1tcXHckLl5dKyk/XFxzKigoXFwrXFwrfC0tKXxcXCt8LXx+KD8hW1xcdyRdKXwmJnxcXHxcXHx8PT09fCE9PXw9PXwhPXw8PXw+PXxbPD4lKjo/XFwvXXwoPSkpXFxzKnwoISo/KEApP1sjfl0/W1xcdyQuXl0rKShbKFtdKT8pfCgsXFxzKil8KD86KFxcKClcXHMqKT9cXFxcPyg/OignKXwoXCIpKXwoPzpcXHMqKChbKVxcXV0pKD89Wy5eXXxcXHMqJHxbXihbXSl8WylcXF1dKShbKFtdPykpfChcXHMrKS9nLFxuXHRcdFx0Ly8gICBsZnRQcm4wICAgICAgICAgICBsZnRQcm4gICAgICAgICBib3VuZCAgICAgcGF0aCAgICAgICAgICAgICAgIG9wZXJhdG9yICAgICBlcnIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcSAgICAgIHBhdGgyIGxhdGUgICAgICAgICAgICBwcm4gICAgICBjb21tYSAgbGZ0UHJuMiAgICAgICAgICBhcG9zIHF1b3QgICAgICAgIHJ0UHJuICBydFBybkRvdCAgICAgICAgICAgICAgICAgIHBybjIgICAgI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bCwgYmluZCwgdGFnTmFtZSwgY29udmVydGVyLCBjb2xvbiwgaHRtbCwgY29kZVRhZywgcGFyYW1zLCBzbGFzaCwgYmluZDIsIGNsb3NlQmxvY2ssIGluZGV4KSB7XG4vKlxuXG4gICAgIGJpbmQgICAgIHRhZ05hbWUgICAgICAgICBjdnQgICBjbG4gaHRtbCBjb2RlICAgIHBhcmFtcyAgICAgICAgICAgIHNsYXNoICAgYmluZDIgICAgICAgICBjbG9zZUJsayAgY29tbWVudFxuLyg/OnsoXFxeKT97KD86KFxcdysoPz1bXFwvXFxzfV0pKXwoXFx3Kyk/KDopfCg+KXwoXFwqKSlcXHMqKCg/OltefV18fSg/IX0pKSo/KShcXC8pP3x7KFxcXik/eyg/Oig/OlxcLyhcXHcrKSlcXHMqfCEtLVtcXHNcXFNdKj8tLSkpfX0vZ1xuXG4oPzpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogICBjbG9zZUJsb2NrXG4gICAgfFxuICAgICEtLVtcXHNcXFNdKj8tLSAgICBjb21tZW50XG4gIClcbilcbn19L2dcblxuKi9cblx0XHRpZiAoY29kZVRhZyAmJiBiaW5kIHx8IHNsYXNoICYmICF0YWdOYW1lIHx8IHBh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nVsbHx0cnVlfGZhbHNlfFxcZFtcXGQuXSp8KFtcXHckXSt8XFwufH4oW1xcdyRdKyl8Iyh2aWV3fChbXFx3JF0rKSk/KShbXFx3JC5eXSo/KSg/OlsuW15dKFtcXHckXSspXFxdPyk/KSQvZyxcblx0XHRcdC8vICAgICAgICBub3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0ICAgICBoZWxwZXIgICAgdmlldyAgdmlld1Byb3BlcnR5IHBhdGhUb2tlbnMgICAgICBsZWFmVG9rZW5cblxuXHRcdFx0clBybTogLyhcXCgpKD89XFxzKlxcKCl8KD86KFsoW10pXFxzKik/KD86KFxcXj8pKH4/W1xcdyQuXl0rKT9cXHMqKChcXCtcXCt8LS0pfFxcK3wtfH4oPyFbXFx3JF0pfCYmfFxcfFxcfHw9PT18IT09fD09fCE9fDw9fD49fFs8PiUqOj9cXC9dfCg9KSlcXHMqfCghKj8oQCk/WyN+XT9bXFx3JC5eXSspKFsoW10pPyl8KCxcXHMqKXwoPzooXFwoKVxccyopP1xcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcGF0aDIgbGF0ZSAgICAgICAgICAgIHBybiAgICAgIGNvbW1hICBsZnRQcm4yICAgICAgICAgIGFwb3MgcXVvdCAgICAgICAgcnRQcm4gIHJ0UHJuRG90ICAgICAgICAgICAgICAgICAgcHJuMiAgICAgc3BhY2VcblxuXHRcdFx0VmlldzogVmlldyxcblx0XHRcdEVycjogSnNWaWV3c0Vycm9yLFxuXHRcdFx0dG1wbEZuOiB0bXBsRm4sXG5cdFx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CBodG1sLCBjb2RlVGFnLCBwYXJhbXMsIHNsYXNoLCBiaW5kMiwgY2xvc2VCbG9jaywgaW5kZXgpIHtcbi8qXG5cbiAgICAgYmluZCAgICAgdGFnTmFtZSAgICAgICAgIGN2dCAgIGNsbiBodG1sIGNvZGUgICAgcGFyYW1zICAgICAgICAgICAgc2xhc2ggICBiaW5kMiAgICAgICAgIGNsb3NlQmxrICBjb21tZW50XG4vKD86eyhcXF4pP3soPzooXFx3Kyg/PVtcXC9cXHN9XSkpfChcXHcrKT8oOil8KD4pfChcXCopKVxccyooKD86W159XXx9KD8hfSkpKj8pKFxcLyk/fHsoXFxeKT97KD86KD86XFwvKFxcdyspKVxccyp8IS0tW1xcc1xcU10qPy0tKSl9fS9nXG5cbig/OlxuICB7KFxcXik/eyAgICAgICAgICAgIGJpbmRcbiAgKD86XG4gICAgKFxcdysgICAgICAgICAgICAgdGFnTmFtZVxuICAgICAgKD89W1xcL1xcc31dKVxuICAgIClcbiAgICB8XG4gICAgKFxcdyspPyg6KSAgICAgICAgY29udmVydGVyIGNvbG9uXG4gICAgfFxuICAgICg+KSAgICAgICAgICAgICAgaHRtbFxuICAgIHxcbiAgICAoXFwqKSAgICAgICAgICAgICBjb2RlVGFnXG4gIClcbiAgXFxzKlxuICAoICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgKD86W159XXx9KD8hfSkpKj9cbiAgKVxuICAoXFwvKT8gICAgICAgICAgICAgIHNsYXNoXG4gIHxcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kMlxuICAoPzpcbiAgICAoPzpcXC8oXFx3KykpXFxzKiAgIGNsb3NlQmxvY2tcbiAgICB8XG4gICAgIS0tW1xcc1xcU10qPy0tICAgIGNvbW1lbnRcbiAgKVxuKVxufX0vZ1xuXG4qL1xuXHRcdGlmIChjb2RlVGFnICYmIGJpbmQgfHwgc2xhc2ggJiYgIXRhZ05hbWUgfHwgcGFyYW1zICYmIHBhcmFtcy5zbGljZSgtMSkgPT09IF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x0bGluazogZnVuY3Rpb24oZXhwciwgZnJvbSwgY29udGV4dCwgbm9JdGVyYXRpb24sIHBhcmVudFZpZXcsIHByZXZOb2RlLCBuZXh0Tm9kZSkge1xuXHRcdHJldHVybiAkbGluayhleHByLCB0aGlzLCBmcm9tLCBjb250ZXh0LCBub0l0ZXJhdGlvbiwgcGFyZW50VmlldywgcHJldk5vZGUsIG5leHROb2RlKTtcblx0fSxcblx0dW5saW5rOiBmdW5jdGlvbigpIHtcblx0XHRyZXR1cm4gJHVubGluayh0aGlzKTtcblx0fSxcblx0dmlldzogZnVuY3Rpb24oaW5uZXIsIHR5cGUpIHtcblx0XHRyZXR1cm4gJHZpZXcodGhpc1swXSwgaW5uZXIsIHR5cGUpO1xuXHR9XG59KTtcblxuLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIE92ZXJyaWRlIGpRdWVyeSBtZXRob2RzIHRoYXQgY2FsbCBvdXIgb3ZlcnJpZGRlbiBjbGVhbkRhdGEsIGZvciBkaXNwb3NhbCBldGMuXG4vLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG4kLmVhY2goW0hUTUwsIFwicmVwbGFjZVdpdGhcIiwgXCJlbXB0eVwiLCBcInJlbW92ZVwiXSwgZnVuY3Rpb24oaSwgbmFtZSkge1xuXHR2YXIgb2xkRm4gPSAkLmZuW25hbWVdO1xuXHQkLmZuW25hbWVdID0gZnVuY3Rpb24oKSB7XG5cdFx0dmFyIHJlc3VsdDtcblx0XHRpc0NsZWFuQ2FsbCsrOyAvLyBNYWtlIHN1cmUgY2xlYW5EYXRhIGRvZXMgZGlzcG9zYWwgb25seSB3aGVuIGNvbWluZyBmcm9tIHRoZXNlIGNhbGxzLlxuXHRcdHRyeSB7XG5cdFx0XHRyZXN1bHQgPSBvbGRGb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k7XG4iXX0= diff --git a/test/browserify/bundles/12-nested-bundle.js b/test/browserify/bundles/12-nested-bundle.js index 54d2413..1317591 100644 --- a/test/browserify/bundles/12-nested-bundle.js +++ b/test/browserify/bundles/12-nested-bundle.js @@ -1,12 +1,12 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsRender: * See http://jsviews.com/#jsrender and http://github.com/BorisMoore/jsrender - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -48,7 +48,7 @@ if (!$ || !$.fn) { throw "JsViews requires jQuery"; // We require jQuery } -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", jsvStoreName, rTag, rTmplString, topView, $views, $observe, $observable, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -758,7 +758,7 @@ function renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) { tag.linkCtx = linkCtx; if (tag._.bnd = boundTag || linkCtx.fn) { // Bound if {^{tag...}} or data-link="{tag...}" - tag._.ths = tagCtx.params.props.this; // Tag has a this=expr binding, to get javascript reference to tag instance + tag._.ths = tagCtx.params.props["this"]; // Tag has a this=expr binding, to get javascript reference to tag instance tag._.lt = tagCtxs.lt; // If a late path @some.path has not returned @some object, mark tag as late tag._.arrVws = {}; } else if (tag.dataBoundOnly) { @@ -1120,6 +1120,8 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // Look for server-generated script block with id "./some/file.html" elem = document.getElementById(value); } + } else if (value.charAt(0) === "#") { + elem = document.getElementById(value.slice(1)); } else if ($.fn && !$sub.rTmpl.test(value)) { try { elem = $(value, document)[0]; // if jQuery is loaded, test for selector returning elements, and get first element @@ -3023,7 +3025,7 @@ if (jsrToJq) { // Moving from jsrender namespace to jQuery namepace - copy over //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsObservable >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsObservable: * See https://www.jsviews.com/#jsobservable and http://github.com/borismoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -4312,7 +4314,7 @@ if (!$.observe) { /* JsViews: * Interactive data-driven views using templates and data-linking. * See https://www.jsviews.com/#jsviews and http://github.com/BorisMoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -5515,15 +5517,13 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont if (deferChar === "+") { if (deferPath.charAt(j) === "-") { j--; - targetParent = targetParent.previousSibling; + targetParent = targetParent.previousElementSibling; // IE9 or later only } else { targetParent = targetParent.parentNode; } } else { - targetParent = targetParent.lastChild; + targetParent = targetParent.lastElementChild; // IE9 or later only } - // Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild, - // since we have removed white space within elCnt. Hence support IE < 9 } } if (bindChar === "^") { @@ -18924,4 +18924,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[3]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqc3ZpZXdzLmpzIiwibm9kZV9tb2R1bGVzL2pxdWVyeS9kaXN0L2pxdWVyeS5qcyIsInRlc3QvYnJvd3NlcmlmeS84LXVuaXQtdGVzdHMuanMiLCJ0ZXN0L3RlbXBsYXRlcy9uYW1lLXRlbXBsYXRlLmh0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B7eycgKyB0YWdOYW1lXG5cdFx0XHRcdFx0OiAnVW5tYXRjaGVkIG9yIG1pc3Npbmcge3svJyArIHRhZ05hbWUpICsgJywgaW4gdGVtcGxhdGU6XFxuJyArIG1hcmt1cCk7XG5cdFx0fVxuXHR9XG5cblx0ZnVuY3Rpb24gcGFyc2VUYWcoYWxsLCBiaW5kLCB0YWdOYW1lLCBjb252ZXJ0ZXIsIGNvbG9uLCBodG1sLCBjb2RlVGFnLCBwYXJhbXMsIHNsYXNoLCBiaW5kMiwgY2xvc2VCbG9jaywgaW5kZXgpIHtcbi8qXG5cbiAgICAgYmluZCAgICAgdGFnTmFtZSAgICAgICAgIGN2dCAgIGNsbiBodG1sIGNvZGUgICAgcGFyYW1zICAgICAgICAgICAgc2xhc2ggICBiaW5kMiAgICAgICAgIGNsb3NlQmxrICBjb21tZW50XG4vKD86eyhcXF4pP3soPzooXFx3Kyg/PVtcXC9cXHN9XSkpfChcXHcrKT8oOil8KD4pfChcXCopKVxccyooKD86W159XXx9KD8hfSkpKj8pKFxcLyk/fHsoXFxeKT97KD86KD86XFwvKFxcdyspKVxccyp8IS0tW1xcc1xcU10qPy0tKSl9fS9nXG5cbig/OlxuICB7KFxcXik/eyAgICAgICAgICAgIGJpbmRcbiAgKD86XG4gICAgKFxcdysgICAgICAgICAgICAgdGFnTmFtZVxuICAgICAgKD89W1xcL1xcc31dKVxuICAgIClcbiAgICB8XG4gICAgKFxcdyspPyg6KSAgICAgICAgY29udmVydGVyIGNvbG9uXG4gICAgfFxuICAgICg+KSAgICAgICAgICAgICAgaHRtbFxuICAgIHxcbiAgICAoXFwqKSAgICAgICAgICAgICBjb2RlVGFnXG4gIClcbiAgXFxzKlxuICAoICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgKD86W159XXx9KD8hfSkpKj9cbiAgKVxuICAoXFwvKT8gICAgICAgICAgICAgIHNsYXNoXG4gIHxcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kMlxuICAoPzpcbi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09PT09XG4vLyBFeHRlbmQgalF1ZXJ5IGluc3RhbmNlIHBsdWdpbnNcbi8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG4kZXh0ZW5kKCQuZm4sIHtcblx0bGluazogZnVuY3Rpb24oZXhwciwgZnJvbSwgY29udGV4dCwgbm9JdGVyYXRpb24sIHBhcmVudFZpZXcsIHByZXZOb2RlLCBuZXh0Tm9kZSkge1xuXHRcdHJldHVybiAkbGluayhleHByLCB0aGlzLCBmcm9tLCBjb250ZXh0LCBub0l0ZXJhdGlvbiwgcGFyZW50VmlldywgcHJldk5vZGUsIG5leHROb2RlKTtcblx0fSxcblx0dW5saW5rOiBmdW5jdGlvbigpIHtcblx0XHRyZXR1cm4gJHVubGluayh0aGlzKTtcblx0fSxcblx0dmlldzogZnVuY3Rpb24oaW5uZXIsIHR5cGUpIHtcblx0XHRyZXR1cm4gJHZpZXcodGhpc1swXSwgaW5uZXIsIHR5cGUpO1xuXHR9XG59KTtcblxuLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIE92ZXJyaWRlIGpRdWVyeSBtZXRob2RzIHRoYXQgY2FsbCBvdXIgb3ZlcnJpZGRlbiBjbGVhbkRhdGEsIGZvciBkaXNwb3NhbCBldGMuXG4vLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG4kLmVhY2goW0hUTUwsIFwicmVwbGFjZVdpdGhcIiwgXCJlbXB0eVwiLCBcInJlbW92ZVwiXSwgZnVuY3Rpb24oaSwgbmFtZSkge1xuXHR2YXIgb2xkRm4gPSAkLmZuW25hbWVdO1xuXHQkLmZuW25hbWVdID0gZnVuY3Rpb24oKSB7XG5cdFx0dmFyIHJlc3VsdDtcblx0XHRpc0NsZWFuQ2FsbCsrOyAvLyBNYWtlIHN1cmUgY2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31cbiAgICB3aGlsZSAodG1wbFJlZnMubGVuZ3RoKSB7XG4gICAgICB0bXBsUmVmcy5wb3AoKSgkKTsgLy8gY29tcGlsZSBuZXN0ZWQgdGVtcGxhdGVcbiAgICB9XG5cbiAgICByZXR1cm4gJC50ZW1wbGF0ZXMoXCIuL3Rlc3QvdGVtcGxhdGVzL25hbWUtdGVtcGxhdGUuaHRtbFwiLCBta3VwKVxuICB9OyJdfQ== diff --git a/test/browserify/bundles/8B-bundle.js b/test/browserify/bundles/8B-bundle.js index 5a4e228..997ee00 100644 --- a/test/browserify/bundles/8B-bundle.js +++ b/test/browserify/bundles/8B-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsRender: * See http://jsviews.com/#jsrender and http://github.com/BorisMoore/jsrender - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -48,7 +48,7 @@ if (!$ || !$.fn) { throw "JsViews requires jQuery"; // We require jQuery } -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", jsvStoreName, rTag, rTmplString, topView, $views, $observe, $observable, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -758,7 +758,7 @@ function renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) { tag.linkCtx = linkCtx; if (tag._.bnd = boundTag || linkCtx.fn) { // Bound if {^{tag...}} or data-link="{tag...}" - tag._.ths = tagCtx.params.props.this; // Tag has a this=expr binding, to get javascript reference to tag instance + tag._.ths = tagCtx.params.props["this"]; // Tag has a this=expr binding, to get javascript reference to tag instance tag._.lt = tagCtxs.lt; // If a late path @some.path has not returned @some object, mark tag as late tag._.arrVws = {}; } else if (tag.dataBoundOnly) { @@ -1120,6 +1120,8 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // Look for server-generated script block with id "./some/file.html" elem = document.getElementById(value); } + } else if (value.charAt(0) === "#") { + elem = document.getElementById(value.slice(1)); } else if ($.fn && !$sub.rTmpl.test(value)) { try { elem = $(value, document)[0]; // if jQuery is loaded, test for selector returning elements, and get first element @@ -3023,7 +3025,7 @@ if (jsrToJq) { // Moving from jsrender namespace to jQuery namepace - copy over //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsObservable >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsObservable: * See https://www.jsviews.com/#jsobservable and http://github.com/borismoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -4312,7 +4314,7 @@ if (!$.observe) { /* JsViews: * Interactive data-driven views using templates and data-linking. * See https://www.jsviews.com/#jsviews and http://github.com/BorisMoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -5515,15 +5517,13 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont if (deferChar === "+") { if (deferPath.charAt(j) === "-") { j--; - targetParent = targetParent.previousSibling; + targetParent = targetParent.previousElementSibling; // IE9 or later only } else { targetParent = targetParent.parentNode; } } else { - targetParent = targetParent.lastChild; + targetParent = targetParent.lastElementChild; // IE9 or later only } - // Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild, - // since we have removed white space within elCnt. Hence support IE < 9 } } if (bindChar === "^") { @@ -18856,14 +18856,14 @@ return jQuery; } ); },{}],3:[function(require,module,exports){ -/*! JsRender v1.0.10: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.11: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. * Does not require jQuery, or HTML DOM * Integrates with JsViews (http://jsviews.com/#jsviews) * - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -18902,7 +18902,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -19611,7 +19611,7 @@ function renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) { tag.linkCtx = linkCtx; if (tag._.bnd = boundTag || linkCtx.fn) { // Bound if {^{tag...}} or data-link="{tag...}" - tag._.ths = tagCtx.params.props.this; // Tag has a this=expr binding, to get javascript reference to tag instance + tag._.ths = tagCtx.params.props["this"]; // Tag has a this=expr binding, to get javascript reference to tag instance tag._.lt = tagCtxs.lt; // If a late path @some.path has not returned @some object, mark tag as late tag._.arrVws = {}; } else if (tag.dataBoundOnly) { @@ -19973,6 +19973,8 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // Look for server-generated script block with id "./some/file.html" elem = document.getElementById(value); } + } else if (value.charAt(0) === "#") { + elem = document.getElementById(value.slice(1)); } else if ($.fn && !$sub.rTmpl.test(value)) { try { elem = $(value, document)[0]; // if jQuery is loaded, test for selector returning elements, and get first element @@ -21944,4 +21946,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[4]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqc3ZpZXdzLmpzIiwibm9kZV9tb2R1bGVzL2pxdWVyeS9kaXN0L2pxdWVyeS5qcyIsIm5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FxcZFtcXGQuXSp8KFtcXHckXSt8XFwufH4oW1xcdyRdKyl8Iyh2aWV3fChbXFx3JF0rKSk/KShbXFx3JC5eXSo/KSg/OlsuW15dKFtcXHckXSspXFxdPyk/KSQvZyxcblx0XHRcdC8vICAgICAgICBub3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0ICAgICBoZWxwZXIgICAgdmlldyAgdmlld1Byb3BlcnR5IHBhdGhUb2tlbnMgICAgICBsZWFmVG9rZW5cblxuXHRcdFx0clBybTogLyhcXCgpKD89XFxzKlxcKCl8KD86KFsoW10pXFxzKik/KD86KFxcXj8pKH4/W1xcdyQuXl0rKT9cXHMqKChcXCtcXCt8LS0pfFxcK3wtfH4oPyFbXFx3JF0pfCYmfFxcfFxcfHw9PT18IT09fD09fCE9fDw9fD49fFs8PiUqOj9cXC9dfCg9KSlcXHMqfCghKj8oQCk/WyN+XT9bXFx3JC5eXSspKFsoW10pPyl8KCxcXHMqKXwoPzooXFwoKVxccyopP1xcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcGF0aDIgbGF0ZSAgICAgICAgICAgIHBybiAgICAgIGNvbW1hICBsZnRQcm4yICAgICAgICAgIGFwb3MgcXVvdCAgICAgICAgcnRQcm4gIHJ0UHJuRG90ICAgICAgICAgICAgICAgICAgcHJuMiAgICAgc3BhY2VcblxuXHRcdFx0VmlldzogVmlldyxcblx0XHRcdEVycjogSnNWaWV3c0Vycm9yLFxuXHRcdFx0dG1wbEZuOiB0bXBsRm4sXG5cdFx0XHRwYXJzZTogcGFyc2VQ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BwYXJhbXMsIHNsYXNoLCBiaW5kMiwgY2xvc2VCbG9jaywgaW5kZXgpIHtcbi8qXG5cbiAgICAgYmluZCAgICAgdGFnTmFtZSAgICAgICAgIGN2dCAgIGNsbiBodG1sIGNvZGUgICAgcGFyYW1zICAgICAgICAgICAgc2xhc2ggICBiaW5kMiAgICAgICAgIGNsb3NlQmxrICBjb21tZW50XG4vKD86eyhcXF4pP3soPzooXFx3Kyg/PVtcXC9cXHN9XSkpfChcXHcrKT8oOil8KD4pfChcXCopKVxccyooKD86W159XXx9KD8hfSkpKj8pKFxcLyk/fHsoXFxeKT97KD86KD86XFwvKFxcdyspKVxccyp8IS0tW1xcc1xcU10qPy0tKSl9fS9nXG5cbig/OlxuICB7KFxcXik/eyAgICAgICAgICAgIGJpbmRcbiAgKD86XG4gICAgKFxcdysgICAgICAgICAgICAgdGFnTmFtZVxuICAgICAgKD89W1xcL1xcc31dKVxuICAgIClcbiAgICB8XG4gICAgKFxcdyspPyg6KSAgICAgICAgY29udmVydGVyIGNvbG9uXG4gICAgfFxuICAgICg+KSAgICAgICAgICAgICAgaHRtbFxuICAgIHxcbiAgICAoXFwqKSAgICAgICAgICAgICBjb2RlVGFnXG4gIClcbiAgXFxzKlxuICAoICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgKD86W159XXx9KD8hfSkpKj9cbiAgKVxuICAoXFwvKT8gICAgICAgICAgICAgIHNsYXNoXG4gIHxcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kMlxuICAoPzpcbiAgICAoPzpcXC8oXFx3KykpXFxzKiAgIGNsb3NlQmxvY2tcbiAgICB8XG4gICAgIS0tW1xcc1xcU10qPy0tICAgIGNvbW1lbnRcbiAgKVxuKVxufX0vZ1xuXG4qL1xuXHRcdGlmIChjb2RlVGFnICYmIGJpbmQgfHwgc2xhc2ggJiYgIXRhZ05hbWUgfHwgcGFyYW1zICYmIHBhcmFtcy5zbGljZSgtMSkgPT09IFwiOlwiIHx8IGJpbmQyKS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/KT8pJC9nLFxuXHRcdFx0Ly8gICAgICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgICAgIGhlbHBlciAgICB2aWV3ICB2aWV3UHJvcGVydHkgcGF0aFRva2VucyAgICAgIGxlYWZUb2tlblxuXG5cdFx0XHRyUHJtOiAvKFxcKCkoPz1cXHMqXFwoKXwoPzooWyhbXSlcXHMqKT8oPzooXFxePykofj9bXFx3JC5eXSspP1xccyooKFxcK1xcK3wtLSl8XFwrfC18fig/IVtcXHckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfCg/OihcXCgpXFxzKik/XFxcXD8oPzooJyl8KFwiKSl8KD86XFxzKigoWylcXF1dKSg/PVsuXl18XFxzKiR8W14oW10pfFspXFxdXSkoWyhbXT8pKXwoXFxzKykvZyxcblx0XHRcdC8vICAgbGZ0UHJuMCAgICAgICAgICAgbGZ0UHJuICAgICAgICAgYm91bmQgICAgIHBhdGggICAgICAgICAgICAgICBvcGVyYXRvciAgICAgZXJyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXEgICAgICBwYXRoMiBsYXRlICAgICAgICAgICAgcHJuICAgICAgY29tbWEgIGxmdFBybjIgICAgICAgICAgYXBvcyBxdW90ICAgICAgICBydFBybiAgcnRQcm5Eb3QgICAgICAgICAgICAgICAgICBwcm4yICAgICBzcGFjZVxuXG5cdFx0XHRWaWV3OiBWaWV3LFxuXHRcdFx0RXJyOiBKc1ZpZXdzRXJyb3IsXG5cdFx0XHR0bXBsRm46IHRtcGxGbixcblx0XHRcdHBhcnNlOiBwYXJzZVBhcmFtcyxcblx0XHRcdGV4dGVuZDogJGV4dGVuZCxcblx0XHRcdGV4dGVuZEN0eDogZXh0ZW5kQ3R4LFxuXHRcdFx0c3ludGF4RXJyOiBzeW50YXhFc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dGlvbiwgZS5nLiBKc1ZpZXdzIGludGVncmF0aW9uXG5cdFx0XHRyUGF0aDogL14oISo/KSg/Om51bGx8dHJ1ZXxmYWxzZXxcXGRbXFxkLl0qfChbXFx3JF0rfFxcLnx+KFtcXHckXSspfCModmlld3woW1xcdyRdKykpPykoW1xcdyQuXl0qPykoPzpbLlteXShbXFx3JF0rKVxcXT8pPykkL2csXG5cdFx0XHQvLyAgICAgICAgbm90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iamVjdCAgICAgaGVscGVyICAgIHZpZXcgIHZpZXdQcm9wZXJ0eSBwYXRoVG9rZW5zICAgICAgbGVhZlRva2VuXG5cblx0XHRcdHJQcm06IC8oXFwoKSg/PVxccypcXCgpfCg/OihbKFtdKVxccyopPyg/OihcXF4/KSh+P1tcXHckLl5dKyk/XFxzKigoXFwrXFwrfC0tKXxcXCt8LXx+KD8hW1xcdyRdKXwmJnxcXHxcXHx8PT09fCE9PXw9PXwhPXw8PXw+PXxbPD4lKjo/XFwvXXwoPSkpXFxzKnwoISo/KEApP1sjfl0/W1xcdyQuXl0rKShbKFtdKT8pfCgsXFxzKil8KD86KFxcKClcXHMqKT9cXFxcPyg/OignKXwoXCIpKXwoPzpcXHMqKChbKVxcXV0pKD89Wy5eXXxcXHMqJHxbXihbXSl8WylcXF1dKShbKFtdPykpfChcXHMrKS9nLFxuXHRcdFx0Ly8gICBsZnRQcm4wICAgICAgICAgICBsZnRQcm4gICAgICAgICBib3VuZCAgICAgcGF0aCAgICAgICAgICAgICAgIG9wZXJhdG9yICAgICBlcnIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcSAgICAgIHBhdGgyIGxhdGUgICAgICAgICAgICBwcm4gICAgICBjb21tYSAgbGZ0UHJuMiAgICAgICAgICBhcG9zIHF1b3QgICAgICAgIHJ0UHJuICBydFBybkRvdCAgICAgICAgICAgICAgICAgIHBybjIgICAgIHNwYWNlXG5cblx0XHRcdFZpZXc6IFZp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YW1lXG5cdFx0XHRcdFx0OiAnVW5tYXRjaGVkIG9yIG1pc3Npbmcge3svJyArIHRhZ05hbWUpICsgJywgaW4gdGVtcGxhdGU6XFxuJyArIG1hcmt1cCk7XG5cdFx0fVxuXHR9XG5cblx0ZnVuY3Rpb24gcGFyc2VUYWcoYWxsLCBiaW5kLCB0YWdOYW1lLCBjb252ZXJ0ZXIsIGNvbG9uLCBodG1sLCBjb2RlVGFnLCBwYXJhbXMsIHNsYXNoLCBiaW5kMiwgY2xvc2VCbG9jaywgaW5kZXgpIHtcbi8qXG5cbiAgICAgYmluZCAgICAgdGFnTmFtZSAgICAgICAgIGN2dCAgIGNsbiBodG1sIGNvZGUgICAgcGFyYW1zICAgICAgICAgICAgc2xhc2ggICBiaW5kMiAgICAgICAgIGNsb3NlQmxrICBjb21tZW50XG4vKD86eyhcXF4pP3soPzooXFx3Kyg/PVtcXC9cXHN9XSkpfChcXHcrKT8oOil8KD4pfChcXCopKVxccyooKD86W159XXx9KD8hfSkpKj8pKFxcLyk/fHsoXFxeKT97KD86KD86XFwvKFxcdyspKVxccyp8IS0tW1xcc1xcU10qPy0tKSl9fS9nXG5cbig/OlxuICB7KFxcXik/eyAgICAgICAgICAgIGJpbmRcbiAgKD86XG4gICAgKFxcdysgICAgICAgICAgICAgdGFnTmFtZVxuICAgICAgKD89W1xcL1xcc31dKVxuICAgIClcbiAgICB8XG4gICAgKFxcdyspPyg6KSAgICAgICAgY29udmVydGVyIGNvbG9uXG4gICAgfFxuICAgICg+KSAgICAgICAgICAgICAgaHRtbFxuICAgIHxcbiAgICAoXFwqKSAgICAgICAgICAgICBjb2RlVGFnXG4gIClcbiAgXFxzKlxuICAoICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgKD86W159XXx9KD8hfSkpKj9cbiAgKVxuICAoXFwvKT8gICAgICAgICAgICAgIHNsYXNoXG4gIHxcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kMlxuICAoPzpcbiAgICAoPzpcXC8o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9uLCBodG1sLCBjb2RlVGFnLCBwYXJhbXMsIHNsYXNoLCBiaW5kMiwgY2xvc2VCbG9jaywgaW5kZXgpIHtcbi8qXG5cbiAgICAgYmluZCAgICAgdGFnTmFtZSAgICAgICAgIGN2dCAgIGNsbiBodG1sIGNvZGUgICAgcGFyYW1zICAgICAgICAgICAgc2xhc2ggICBiaW5kMiAgICAgICAgIGNsb3NlQmxrICBjb21tZW50XG4vKD86eyhcXF4pP3soPzooXFx3Kyg/PVtcXC9cXHN9XSkpfChcXHcrKT8oOil8KD4pfChcXCopKVxccyooKD86W159XXx9KD8hfSkpKj8pKFxcLyk/fHsoXFxeKT97KD86KD86XFwvKFxcdyspKVxccyp8IS0tW1xcc1xcU10qPy0tKSl9fS9nXG5cbig/OlxuICB7KFxcXik/eyAgICAgICAgICAgIGJpbmRcbiAgKD86XG4gICAgKFxcdysgICAgICAgICAgICAgdGFnTmFtZVxuICAgICAgKD89W1xcL1xcc31dKVxuICAgIClcbiAgICB8XG4gICAgKFxcdyspPyg6KSAgICAgICAgY29udmVydGVyIGNvbG9uXG4gICAgfFxuICAgICg+KSAgICAgICAgICAgICAgaHRtbFxuICAgIHxcbiAgICAoXFwqKSAgICAgICAgICAgICBjb2RlVGFnXG4gIClcbiAgXFxzKlxuICAoICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgKD86W159XXx9KD8hfSkpKj9cbiAgKVxuICAoXFwvKT8gICAgICAgICAgICAgIHNsYXNoXG4gIHxcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kMlxuICAoPzpcbiAgICAoPzpcXC8oXFx3KykpXFxzKiAgIGNsb3NlQmxvY2tcbiAgICB8XG4gICAgIS0tW1xcc1xcU10qPy0tICAgIGNvbW1lbnRcbiAgKVxuKVxufX0vZ1xuXG4qL1xuXHRcdGlmIChjb2RlVGFnICYmIGJpbmQgfHwgc2xhc2ggJiYgIXRhZ05hbWUgfHwgcGFyYW1zICYmIHBhcmFtcy5zbGljZSgtMSkgPT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GVtcGxhdGVzKFwiLi90ZXN0L3RlbXBsYXRlcy9uYW1lLXRlbXBsYXRlLmh0bWxcIiwgbWt1cClcbiAgfTsiXX0= diff --git a/test/browserify/bundles/9-bundle.js b/test/browserify/bundles/9-bundle.js index 8839b8d..03bda9f 100644 --- a/test/browserify/bundles/9-bundle.js +++ b/test/browserify/bundles/9-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsRender: * See http://jsviews.com/#jsrender and http://github.com/BorisMoore/jsrender - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -48,7 +48,7 @@ if (!$ || !$.fn) { throw "JsViews requires jQuery"; // We require jQuery } -var versionNumber = "v1.0.10", +var versionNumber = "v1.0.11", jsvStoreName, rTag, rTmplString, topView, $views, $observe, $observable, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -758,7 +758,7 @@ function renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) { tag.linkCtx = linkCtx; if (tag._.bnd = boundTag || linkCtx.fn) { // Bound if {^{tag...}} or data-link="{tag...}" - tag._.ths = tagCtx.params.props.this; // Tag has a this=expr binding, to get javascript reference to tag instance + tag._.ths = tagCtx.params.props["this"]; // Tag has a this=expr binding, to get javascript reference to tag instance tag._.lt = tagCtxs.lt; // If a late path @some.path has not returned @some object, mark tag as late tag._.arrVws = {}; } else if (tag.dataBoundOnly) { @@ -1120,6 +1120,8 @@ function compileTmpl(name, tmpl, parentTmpl, options) { // Look for server-generated script block with id "./some/file.html" elem = document.getElementById(value); } + } else if (value.charAt(0) === "#") { + elem = document.getElementById(value.slice(1)); } else if ($.fn && !$sub.rTmpl.test(value)) { try { elem = $(value, document)[0]; // if jQuery is loaded, test for selector returning elements, and get first element @@ -3023,7 +3025,7 @@ if (jsrToJq) { // Moving from jsrender namespace to jQuery namepace - copy over //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsObservable >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> /* JsObservable: * See https://www.jsviews.com/#jsobservable and http://github.com/borismoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -4312,7 +4314,7 @@ if (!$.observe) { /* JsViews: * Interactive data-driven views using templates and data-linking. * See https://www.jsviews.com/#jsviews and http://github.com/BorisMoore/jsviews - * Copyright 2020, Boris Moore + * Copyright 2021, Boris Moore * Released under the MIT License. */ @@ -5515,15 +5517,13 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont if (deferChar === "+") { if (deferPath.charAt(j) === "-") { j--; - targetParent = targetParent.previousSibling; + targetParent = targetParent.previousElementSibling; // IE9 or later only } else { targetParent = targetParent.parentNode; } } else { - targetParent = targetParent.lastChild; + targetParent = targetParent.lastElementChild; // IE9 or later only } - // Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild, - // since we have removed white space within elCnt. Hence support IE < 9 } } if (bindChar === "^") { @@ -18923,4 +18923,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[3]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqc3ZpZXdzLmpzIiwibm9kZV9tb2R1bGVzL2pxdWVyeS9kaXN0L2pxdWVyeS5qcyIsInRlc3QvYnJvd3Nlcmlme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09PT09PT09PT09PT09PT09XG4vLyBFeHRlbmQgalF1ZXJ5IGluc3RhbmNlIHBsdWdpbnNcbi8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG4kZXh0ZW5kKCQuZm4sIHtcblx0bGluazogZnVuY3Rpb24oZXhwciwgZnJvbSwgY29udGV4dCwgbm9JdGVyYXRpb24sIHBhcmVudFZpZXcsIHByZXZOb2RlLCBuZXh0Tm9kZSkge1xuXHRcdHJldHVybiAkbGluayhleHByLCB0aGlzLCBmcm9tLCBjb250ZXh0LCBub0l0ZXJhdGlvbiwgcGFyZW50VmlldywgcHJldk5vZGUsIG5leHROb2RlKTtcblx0fSxcblx0dW5saW5rOiBmdW5jdGlvbigpIHtcblx0XHRyZXR1cm4gJHVubGluayh0aGlzKTtcblx0fSxcblx0dmlldzogZnVuY3Rpb24oaW5uZXIsIHR5cGUpIHtcblx0XHRyZXR1cm4gJHZpZXcodGhpc1swXSwgaW5uZXIsIHR5cGUpO1xuXHR9XG59KTtcblxuLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIE92ZXJyaWRlIGpRdWVyeSBtZXRob2RzIHRoYXQgY2FsbCBvdXIgb3ZlcnJpZGRlbiBjbGVhbkRhdGEsIGZvciBkaXNwb3NhbCBldGMuXG4vLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG4kLmVhY2goW0hUTUwsIFwicmVwbGFjZVdpdGhcIiwgXCJlbXB0eVwiLCBcInJlbW92ZVwiXSwgZnVuY3Rpb24oaSwgbmFtZSkge1xuXHR2YXIgb2xkRm4gPSAkLmZuW25hbWVdO1xuXHQkLmZuW25hbWVdID0gZnVuY3Rpb24oKSB7XG5cdFx0dmFyIHJlc3VsdDtcblx0XHRpc0NsZWFuQ2FsbCsrOyAvLyBNYW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ff --git a/test/unit-tests-all-jsviews.html b/test/unit-tests-all-jsviews.html index ff950a3..9e4add5 100644 --- a/test/unit-tests-all-jsviews.html +++ b/test/unit-tests-all-jsviews.html @@ -37,7 +37,7 @@ - + diff --git a/test/unit-tests-all-observable-render-views.html b/test/unit-tests-all-observable-render-views.html index 5b2a76c..aaac714 100644 --- a/test/unit-tests-all-observable-render-views.html +++ b/test/unit-tests-all-observable-render-views.html @@ -26,7 +26,7 @@ - + diff --git a/test/unit-tests-all-render-observable-views.html b/test/unit-tests-all-render-observable-views.html index b4ad9cb..9ece681 100644 --- a/test/unit-tests-all-render-observable-views.html +++ b/test/unit-tests-all-render-observable-views.html @@ -36,7 +36,7 @@ - + diff --git a/test/unit-tests-jsrender-no-jquery.html b/test/unit-tests-jsrender-no-jquery.html index 38ff244..8c5f392 100644 --- a/test/unit-tests-jsrender-no-jquery.html +++ b/test/unit-tests-jsrender-no-jquery.html @@ -10,7 +10,7 @@ - + diff --git a/test/unit-tests-jsrender-with-jquery.html b/test/unit-tests-jsrender-with-jquery.html index 1d28d26..b0bfba6 100644 --- a/test/unit-tests-jsrender-with-jquery.html +++ b/test/unit-tests-jsrender-with-jquery.html @@ -10,7 +10,7 @@ - + diff --git a/test/unit-tests-jsviews.html b/test/unit-tests-jsviews.html index 921abc8..5457321 100644 --- a/test/unit-tests-jsviews.html +++ b/test/unit-tests-jsviews.html @@ -11,7 +11,7 @@ - + diff --git a/test/unit-tests-multiple-loads.html b/test/unit-tests-multiple-loads.html index be60931..4722f2a 100644 --- a/test/unit-tests-multiple-loads.html +++ b/test/unit-tests-multiple-loads.html @@ -45,7 +45,7 @@ - + diff --git a/test/unit-tests/tests-jsobservable.js b/test/unit-tests/tests-jsobservable.js index abbdecc..34719aa 100644 --- a/test/unit-tests/tests-jsobservable.js +++ b/test/unit-tests/tests-jsobservable.js @@ -5082,8 +5082,10 @@ QUnit.test("$.views.viewModels", function(assert) { QUnit.test("setProperty/insert/remove etc. using async or batched events", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - count = 0, +var done; +if (assert.async) { done = assert.async() } else { stop() } + + var count = 0, batch = [], person = { first: "Jo", last: "Blow" }, numbers = [0], @@ -5151,14 +5153,15 @@ QUnit.test("setProperty/insert/remove etc. using async or batched events", funct // ................................ Reset ................................ result = ""; $.unobserve(); - done(); + if (assert.async) { done() } else { start() } }, 0); }); QUnit.test("setProperty/insert/remove etc. using namespaces", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - count = 0, +var done; +if (assert.async) { done = assert.async() } else { stop() } + var count = 0, batch = [], person = { first: "Jo", last: "Blow" }, numbers = [0], @@ -5236,7 +5239,7 @@ QUnit.test("setProperty/insert/remove etc. using namespaces", function(assert) { // ................................ Reset ................................ result = ""; $.unobserve(); - done(); + if (assert.async) { done() } else { start() } }, 0); }); diff --git a/test/unit-tests/tests-jsrender-amd-scriptloader.js b/test/unit-tests/tests-jsrender-amd-scriptloader.js index fc32b68..913c8ae 100644 --- a/test/unit-tests/tests-jsrender-amd-scriptloader.js +++ b/test/unit-tests/tests-jsrender-amd-scriptloader.js @@ -13,8 +13,9 @@ if (!window.attachEvent || window.addEventListener) { // Running RequireJS in qu QUnit.module("AMD Script Loader"); QUnit.test("Loading JsRender, without jQuery, using RequireJS", function(assert) { - var done = assert.async(), - jq = window.jQuery; +var done; +if (assert.async) { done = assert.async() } else { stop() } + var jq = window.jQuery; undefine(); require(["//www.jsviews.com/download/jsrender.js"], function($) { // Or point to correct local path for jsrender.js on your system @@ -24,13 +25,14 @@ QUnit.test("Loading JsRender, without jQuery, using RequireJS", function(assert) var result = $.templates("Name: {{:name}}").render({name: "Jo"}) + " " + (!!$.jsrender); assert.equal(result, "Name: Jo true", "JsRender Loaded"); - done(); + if (assert.async) { done() } else { start() } }); }); QUnit.test("Loading JsRender and jQuery, without forcing load order, using RequireJS", function(assert) { - var done = assert.async(), - jq = window.jQuery; +var done; +if (assert.async) { done = assert.async() } else { stop() } + var jq = window.jQuery; undefine(); // Note JsRender does not require jQuery - so its AMD definition does not specify jQuery dependency. @@ -42,14 +44,15 @@ QUnit.test("Loading JsRender and jQuery, without forcing load order, using Requi var result = $.templates("Name: {{:name}}").render({name: "Jo"}) + " " + ($ === $jq || !!$.jsrender); assert.equal(result, "Name: Jo true", "JsRender Loaded"); - done(); + if (assert.async) { done() } else { start() } }); }); }); QUnit.test("Loading JsRender with jQuery, and force jQuery to load before JsRender, using RequireJS", function(assert) { - var done = assert.async(), - jq = window.jQuery; +var done; +if (assert.async) { done = assert.async() } else { stop() } + var jq = window.jQuery; undefine(); // Note JsRender does not require jQuery - so its AMD definition does not specify jQuery dependency. @@ -63,7 +66,7 @@ QUnit.test("Loading JsRender with jQuery, and force jQuery to load before JsRend var result = $.templates("Name: {{:name}}").render({name: "Jo"}) + " " + (jq !== $ && $ === window.jQuery && $ === $jq); assert.equal(result, "Name: Jo true", "JsRender LoadedX"); - done(); + if (assert.async) { done() } else { start() } }); }); }); diff --git a/test/unit-tests/tests-jsrender-no-jquery.js b/test/unit-tests/tests-jsrender-no-jquery.js index 6203cf4..c6d9114 100644 --- a/test/unit-tests/tests-jsrender-no-jquery.js +++ b/test/unit-tests/tests-jsrender-no-jquery.js @@ -1261,6 +1261,7 @@ var teams = [ QUnit.module("api no jQuery"); QUnit.test("templates", function(assert) { + // ................................ Arrange .................................. $.templates("./test/templates/file/path.html", null); // In case template has been stored in a previous test @@ -1302,7 +1303,61 @@ QUnit.test("templates", function(assert) { document.getElementById("./test/templates/file/path.html").removeAttribute("data-jsv-tmpl"); } - // =============================== Arrange =============================== +if (isBrowser) { + var tmplElem = document.getElementById("myTmpl"); + + // ................................ Act .................................. + tmpl0 = $.templates({markup: "#myTmpl"}); // Compile template declared in script block, but do not cache + + // ............................... Assert ................................. + assert.equal(tmpl0.render({name: "Jo0"}), "A_Jo0_B", + "Compile template declared in script block, without caching"); + + // ................................ Act .................................. + tmpl1 = $.templates("#myTmpl"); // Compile and cache, using "#myTmpl" as key); + + // ............................... Assert ................................. + assert.equal(tmpl1 !== tmpl0 && tmpl1.render({name: "Jo1"}), "A_Jo1_B", + "Compile template declared in script block, and cache on file path"); + + // ................................ Act .................................. + tmpl2 = $.templates("#myTmpl"); // Use cached template, accessed by $.templates["#myTmpl"] + + // ............................... Assert ................................. + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), "A_Jo2_B", + "Re-use cached template declared in script block"); + + // ................................ Act .................................. + var tmpl2b = $.templates(".myTmpl"); // Try to access script element by class selector - but fail because jQuery not loaded, so only "#xxx" selector is supported + + // ............................... Assert ................................. + if ($.fn || window._$ || tmpl2b === tmpl2) { + assert.equal(tmpl2b === tmpl2 && tmpl2b.render({name: "Jo2"}), "A_Jo2_B", + "Try to access script block using class selector - but not supported, by design, when jQuery not loaded"); + } else { + assert.equal(tmpl2b !== tmpl2 && tmpl2b.render({name: "Jo2"}), ".myTmpl", + "Can access script block using class selector - when jQuery loaded"); + } + + // ................................ Act .................................. + tmpl2 = $.templates("#myAbsentTmpl"); + + // ............................... Assert ................................. + assert.equal(tmpl2.render({name: "Jo2"}), "#myAbsentTmpl", + "Access missing script block template - renders as string"); + + // ................................ Act .................................. + tmpl3 = $.templates({markup: "#myTmpl"}); // Re-compile template but do not cache. Leave cached template. + + // ............................... Assert ................................. + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && tmpl3.render({name: "Jo3"}), "A_Jo3_B", + "Recompile template declared in script block, without caching"); + + // ................................ Reset ................................ + tmplElem.removeAttribute("data-jsv-tmpl"); +} + +// =============================== Arrange =============================== tmplString = "A_{{:name}}_B"; var tmpl = $.templates(tmplString); diff --git a/test/unit-tests/tests-jsrender-with-jquery.js b/test/unit-tests/tests-jsrender-with-jquery.js index 459f766..132b7ff 100644 --- a/test/unit-tests/tests-jsrender-with-jquery.js +++ b/test/unit-tests/tests-jsrender-with-jquery.js @@ -34,7 +34,9 @@ QUnit.test("templates", function(assert) { var tmpl0 = $.templates({markup: "./test/templates/file/path.html"}); // Compile template but do not cache // ............................... Assert ................................. - assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), "ServerRenderedTemplate_Jo0_B", "Compile server-generated template, without caching"); + assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), + "ServerRenderedTemplate_Jo0_B", + "Compile server-generated template, without caching"); // ................................ Act .................................. var tmpl1 = $.templates("./test/templates/file/path.html"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); @@ -46,13 +48,17 @@ QUnit.test("templates", function(assert) { var tmpl2 = $.templates("./test/templates/file/path.html"); // Use cached template, accessed by path as key // ............................... Assert ................................. - assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), "ServerRenderedTemplate_Jo2_B", "Re-use cached server-generated template"); + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), + "ServerRenderedTemplate_Jo2_B", + "Re-use cached server-generated template"); // ................................ Act .................................. var tmpl3 = $.templates({markup: "./test/templates/file/path.html"}); // Re-compile template but do not cache. Leaved cached template. // ............................... Assert ................................. - assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), "ServerRenderedTemplate_Jo3_B", "Recompile server-generated template, without caching"); + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), + "ServerRenderedTemplate_Jo3_B", + "Recompile server-generated template, without caching"); // ................................ Reset ................................ delete $.data(tmplElem).jsvTmpl; @@ -66,25 +72,43 @@ QUnit.test("templates", function(assert) { tmpl0 = $.templates({markup: "#myTmpl"}); // Compile template declared in script block, but do not cache // ............................... Assert ................................. - assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), "A_Jo0_B", "Compile template declared in script block, without caching"); + assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), "A_Jo0_B", + "Compile template declared in script block, without caching"); // ................................ Act .................................. tmpl1 = $.templates("#myTmpl"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); // ............................... Assert ................................. - assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), "A_Jo1_B", "Compile template declared in script block, and cache on file path"); + assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), "A_Jo1_B", + "Compile template declared in script block, and cache on file path"); // ................................ Act .................................. tmpl2 = $.templates("#myTmpl"); // Use cached template, accessed by $.data(elem, "jsvTmpl") // ............................... Assert ................................. - assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), "A_Jo2_B", "Re-use cached template declared in script block"); + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), "A_Jo2_B", + "Re-use cached template declared in script block"); + + // ................................ Act .................................. + var tmpl2b = $.templates(".myTmpl"); // Access script element by class selector. Still get cached template, accessed by $.data(elem, "jsvTmpl") + + // ............................... Assert ................................. + assert.equal(tmpl2b === tmpl2 && tmpl2.render({name: "Jo2"}), "A_Jo2_B", + "Re-use cached template declared in script block - accessed by class selector"); + + // ................................ Act .................................. + tmpl2 = $.templates("#myAbsentTmpl"); + + // ............................... Assert ................................. + assert.equal(tmpl2.render({name: "Jo2"}), "#myAbsentTmpl", + "Access missing script block template - renders as string"); // ................................ Act .................................. tmpl3 = $.templates({markup: "#myTmpl"}); // Re-compile template but do not cache. Leave cached template. // ............................... Assert ................................. - assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), "A_Jo3_B", "Recompile template declared in script block, without caching"); + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), "A_Jo3_B", + "Recompile template declared in script block, without caching"); // ................................ Reset ................................ delete $.data(tmplElem).jsvTmpl; diff --git a/test/unit-tests/tests-jsviews-amd-scriptloader.js b/test/unit-tests/tests-jsviews-amd-scriptloader.js index b55edbe..910860d 100644 --- a/test/unit-tests/tests-jsviews-amd-scriptloader.js +++ b/test/unit-tests/tests-jsviews-amd-scriptloader.js @@ -16,8 +16,9 @@ if (!window.attachEvent || window.addEventListener) { // Running RequireJS in qu QUnit.module("AMD Script Loader"); QUnit.test("Loading jquery.observable.js using RequireJS", function(assert) { - var done = assert.async(), - jq = window.jQuery; +var done; +if (assert.async) { done = assert.async() } else { stop() } + var jq = window.jQuery; undefine(); require(["./unit-tests/requirejs-config"], function() { @@ -28,14 +29,15 @@ QUnit.test("Loading jquery.observable.js using RequireJS", function(assert) { var result = data.name + " " + (jq !== $ && $ === window.jQuery); assert.equal(result, "Jo updated! true", "jsviews.js loaded"); - done(); + if (assert.async) { done() } else { start() } }); }); }); QUnit.test("Loading jquery.views.js, plus dependencies, using RequireJS", function(assert) { - var done = assert.async(), - jq = window.jQuery; +var done; +if (assert.async) { done = assert.async() } else { stop() } + var jq = window.jQuery; undefine(); require(["./unit-tests/requirejs-config"], function() { @@ -47,14 +49,15 @@ QUnit.test("Loading jquery.views.js, plus dependencies, using RequireJS", functi var result = $("#result").text() + " " + (jq !== $ && $ === window.jQuery); assert.equal(result, "Name: Jo updated! true", "jquery.views.js loaded"); - done(); + if (assert.async) { done() } else { start() } }); }); }); QUnit.test("Loading jsviews.js using RequireJS", function(assert) { - var done = assert.async(), - jq = window.jQuery; +var done; +if (assert.async) { done = assert.async() } else { stop() } + var jq = window.jQuery; undefine(); require(["./unit-tests/requirejs-config"], function() { @@ -66,7 +69,7 @@ QUnit.test("Loading jsviews.js using RequireJS", function(assert) { var result = $("#result").text() + " " + (jq !== $ && $ === window.jQuery); assert.equal(result, "Name: Jo updated! true", "jsviews.js loaded"); - done(); + if (assert.async) { done() } else { start() } }); }); }); diff --git a/test/unit-tests/tests-jsviews.js b/test/unit-tests/tests-jsviews.js index ba72182..f2ffb6f 100644 --- a/test/unit-tests/tests-jsviews.js +++ b/test/unit-tests/tests-jsviews.js @@ -5,8 +5,10 @@ /* Setup */ var inputOrKeydownContentEditable, useInput = "oninput" in document, - inputOrKeydown = useInput ? "input" : "keydown"; - inputOrKeydownContentEditable = "input"; + inputOrKeydown = useInput ? "input" : "keydown", + isIE = window.navigator.userAgent; + isIE = isIE.indexOf('MSIE ')>0 || isIE.indexOf('Trident/')>0; + inputOrKeydownContentEditable = isIE ? "keydown" : "input"; function keydown(elem) { if (useInput) { @@ -1292,7 +1294,8 @@ QUnit.test("Top-level linking", function(assert) { }); QUnit.test("$.link() and $().link() variants", function(assert) { - var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } // ................................ Reset ................................ person1.lastName = "One"; // reset Prop @@ -1969,7 +1972,8 @@ setTimeout(function() { // ................................ Reset ................................ $.views.settings.advanced({_jsv: false}); -done(); + if (assert.async) { done() } else { start() } + }, 0); }, 0); }, 0); @@ -1993,7 +1997,8 @@ done(); QUnit.module("template.link()"); QUnit.test("Helper overriding", function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } // ................................ Reset ................................ home1.address = address1; // reset Prop @@ -2197,14 +2202,16 @@ setTimeout(function() { }); $("#result").empty(); -done(); + if (assert.async) { done() } else { start() } + }, 0); }, 0); }, 0); }); QUnit.test('data-link="expression"', function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } // ................................ Reset ................................ home1.address = address1; // reset Prop @@ -2588,7 +2595,8 @@ setTimeout(function() { $.views.settings.advanced({_jsv: false}); -done(); + if (assert.async) { done() } else { start() } + }, 0); }); @@ -3266,7 +3274,8 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { QUnit.test('data-link="{cvt:expression:cvtBack}"', function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } // ................................ Reset ................................ $("#result").empty(); person1._firstName = "Jo"; // reset Prop @@ -3413,7 +3422,7 @@ setTimeout(function() { $("#result").empty(); person1.lastName = "One"; // reset Prop -done(); + if (assert.async) { done() } else { start() } }, 0); }, 0); @@ -3424,7 +3433,8 @@ done(); QUnit.test('Two-way binding', function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } // =============================== Arrange =============================== var tmpl = $.templates('
'); @@ -4305,7 +4315,8 @@ setTimeout(function() { // ................................ Reset ................................ $("#result").empty(); -done(); + if (assert.async) { done() } else { start() } + }, 0); }, 0); @@ -5780,19 +5791,29 @@ QUnit.test("Computed observables in paths", function(assert) { + " {{/for}}"); // ............................... Assert ................................. - testTemplate("deep table", - "{^{for items}}" - + "" - + "" - + "{^{for ~getItems(expanded) ~row=row}}" - + "" - + "" - + "" - + "{{/for}}" - + "" - + " {{/for}}
{{:name}}
{{:~row}}{{:#data}}
"); + testTemplate("deep div2 with comments", // See https://github.com/BorisMoore/jsviews/issues/452 + "{^{for items}}" + + "{{:name}}" + + "
{^{for ~getItems(expanded) ~row=row}}" + + "" + + "{{:~row}}{{:#data}}" + + "{{/for}}
" + + "{{/for}}"); + + // ............................... Assert ................................. + testTemplate("deep table with comments", // See https://github.com/BorisMoore/jsviews/issues/452 + "{^{for items}}" + + "" + + "" + + "{^{for ~getItems(expanded) ~row=row}}" + + "" + + "" + + "" + + "{{/for}}" + + "" + + " {{/for}}
{{:name}}
{{:~row}}{^{:#data}}
"); - // =============================== Arrange =============================== +// =============================== Arrange =============================== var ret = "", people1 = [{address: {street: "1 first street"}}], people2 = [{address: {street: "1 second street"}}, {address: {street: "2 second street"}}], @@ -6589,7 +6610,8 @@ QUnit.test("Computed observables in $.link() expressions", function(assert) { }); QUnit.test("Computed observables in two-way binding", function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } // =============================== Arrange =============================== var fullName = function(reversed) { @@ -7375,7 +7397,8 @@ setTimeout(function() { // ................................ Reset ................................ $("#result").empty(); -done(); + if (assert.async) { done() } else { start() } + }, 0); }, 0); }, 0); @@ -11995,7 +12018,8 @@ QUnit.test("{^{props}} basic", function(assert) { }); QUnit.test("{^{props}} modifying content, through arrayChange/propertyChange on target array", function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } $.views.settings.advanced({_jsv: true}); // For using cbBindings store @@ -12095,7 +12119,8 @@ setTimeout(function() { $.views.settings.advanced({_jsv: false}); -done(); + if (assert.async) { done() } else { start() } + }, 0); }, 0); }); @@ -14603,7 +14628,8 @@ QUnit.test('{^{on}}', function(assert) { }); QUnit.test('data-link="{tag...} and {^{tag}} in same template"', function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } // ................................ Reset ................................ person1._firstName = "Jo"; // reset Prop @@ -14784,7 +14810,8 @@ setTimeout(function() { // TODO ADDITIONAL TESTS: // 1: link(null, data) to link whole document -done(); + if (assert.async) { done() } else { start() } + }, 0); }); @@ -20124,7 +20151,8 @@ QUnit.test("Modifying content, initializing widgets/tag controls, using data-lin }); QUnit.test('two-way bound tag controls', function(assert) { -var done = assert.async(); +var done; +if (assert.async) { done = assert.async() } else { stop() } $.views.settings.trigger(false); @@ -21148,7 +21176,8 @@ setTimeout(function() { $.views.settings.trigger(true); -done(); + if (assert.async) { done() } else { start() } + }, 0); }, 0); }, 0); @@ -21519,8 +21548,9 @@ QUnit.test("Tag options versus setting in init()", function(assert) { QUnit.test("Global trigger=false local trigger=true - triggers after keydown: ", function(assert) { // =============================== Arrange =============================== $.views.settings.trigger(false); - var done = assert.async(), - res = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var res = "", person = {name: "Jo"}; $.templates('').link("#result", person); @@ -21565,14 +21595,16 @@ QUnit.test("Global trigger=false local trigger=true - triggers after keydown: : handlers are removed by $.unlink(container)'); - done(); + if (assert.async) { done() } else { start() } + }, 0); }); QUnit.test("Global trigger=true local trigger=false - does not trigger after keydown: ", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - res = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var res = "", person = {name: "Jo"}; $.templates('').link("#result", person); @@ -21610,14 +21642,16 @@ QUnit.test("Global trigger=true local trigger=false - does not trigger after key assert.ok($._data(linkedElem).events === undefined, 'Data link using: : No handlers after $.unlink(container)'); - done(); + if (assert.async) { done() } else { start() } + }, 0); }); QUnit.test("Global trigger=true - triggers after keydown: ", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - res = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var res = "", person = {name: "Jo"}; $.templates('').link("#result", person); @@ -21661,14 +21695,16 @@ QUnit.test("Global trigger=true - triggers after keydown: ", function(as assert.ok($._data(linkedElem).events === undefined, 'Data link using: : handlers are removed by $.unlink(container)'); - done(); + if (assert.async) { done() } else { start() } + }, 0); }); QUnit.test("Global trigger=true - ", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - res = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var res = "", person = {member: true}; $.templates('').link("#result", person); @@ -21703,15 +21739,16 @@ QUnit.test("Global trigger=true - ", function(assert) { // ................................ Act .................................. $.unlink("#result"); - done(); + if (assert.async) { done() } else { start() } }, 0); }); QUnit.test("trigger=\'keydown\' - triggers after keydown: ", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - res = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var res = "", person = {name: "Jo"}; $.templates('').link("#result", person); @@ -21755,15 +21792,16 @@ QUnit.test("trigger=\'keydown\' - triggers after keydown: ", function(as assert.ok($._data(linkedElem).events === undefined, 'Data link using: : handlers are removed by $.unlink(container)'); - done(); + if (assert.async) { done() } else { start() } }, 0); }); QUnit.test("Global trigger=true - triggers after keydown: {^{twoWayTag}}", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - before = "", + var done; +if (assert.async) { done = assert.async() } else { stop() } + var before = "", person = {name: "Jo"}; $.templates({ @@ -21811,15 +21849,16 @@ QUnit.test("Global trigger=true - triggers after keydown: {^{twoWayTag}}", funct assert.ok($._data(linkedElem).events === undefined, 'Top-level data link using: {^{twoWayTag name convertBack=~lower/}}: handlers are removed by $.unlink(container)'); - done(); + if (assert.async) { done() } else { start() } }, 0); }); QUnit.test("Global trigger=true - triggers - after keydown: {^{textbox}}", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - before = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var before = "", person = {name: "Jo"}; $.views.tags({ @@ -21881,7 +21920,7 @@ QUnit.test("Global trigger=true - triggers - after keydown: {^{textbox}}", funct assert.ok($._data(linkedElem).events === undefined, 'Top-level data link using: {^{textbox name convertBack=~lower/}}: handlers are removed by $.unlink(container)'); - done(); + if (assert.async) { done() } else { start() } }, 0); }); @@ -21889,8 +21928,9 @@ QUnit.test("Global trigger=true - triggers - after keydown: {^{textbox}}", funct QUnit.test("Custom tag trigger:... option", function(assert) { // =============================== Arrange =============================== - var done = assert.async(), - before = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var before = "", person = {name: "Jo", trig:true}; $.views.tags({ @@ -21938,7 +21978,7 @@ QUnit.test("Custom tag trigger:... option", function(assert) { "Jo|Jo|NewName2|AnotherNewName1", '{^{textbox/}} with option trigger:false - triggers after change, not after keydown. But {^{textbox trigger=true/}} overrides option and triggers on keydown'); - done(); + if (assert.async) { done() } else { start() } }, 0); }, 0); @@ -21948,8 +21988,9 @@ QUnit.test("Global trigger=true - triggers after keydown: {^{contentEditable}}", // =============================== Arrange =============================== $.views.settings.trigger(true); - var done = assert.async(), - before = "", +var done; +if (assert.async) { done = assert.async() } else { stop() } + var before = "", person = {name: "Jo Smith"}; $.views.tags({ @@ -22025,7 +22066,7 @@ setTimeout(function() { $.views.settings.trigger(true); - done(); + if (assert.async) { done() } else { start() } }, 0); }, 0); }, 0); @@ -25309,7 +25350,16 @@ QUnit.test('Custom Tag Controls - two-way binding, with array-valued properties' onBind: function(tagCtx) { var tag = this; tagCtx.mainElem.on("change", function(ev) { - var selected = Array.apply(null, ev.target.selectedOptions).map(function(el) { return el.value; }); +// debugger; +// var selected = Array.apply(null, ev.target.selectedOptions).map(function(el) { +// return el.value; +// }); + var selected = Array.apply(null, ev.target.options).filter(function(el) { + return el.selected; + }) + .map(function(el) { + return el.value; + }); tag.updateValues(selected); ev.preventDefault(); }); @@ -25350,7 +25400,7 @@ QUnit.test('Custom Tag Controls - two-way binding, with array-valued properties' getSelection(); $("#result select").eq(1).val(["a"]).change(); getSelection(); - $("#result select").eq(1).val(["a", "b"]).change(); + $("#result select").eq(1).val(["a", "b"]).change(); // Gives "ab-::v:t:m|", should give abab- a b a b:a,b:v:t:m" getSelection(); $("#result select").eq(1).val(["a", "b", "c"]).change(); getSelection(); diff --git a/typescript/jsviews/index.d.ts b/typescript/jsviews/index.d.ts index 0494e67..991c8de 100644 --- a/typescript/jsviews/index.d.ts +++ b/typescript/jsviews/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for JsViews 1.0 -// Version: "v1.0.10" +// Version: "v1.0.11" // Project: http://www.jsviews.com/#jsviews // Definitions by: Boris Moore // Definitions: https://www.jsviews.com/download/typescript/jsviews/index.d.ts