-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathjquery.views.min.js.map
1 lines (1 loc) · 240 KB
/
jquery.views.min.js.map
1
{"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","slice","$inArray","value","checked","splice","push","length","apply","undefined","$isArray","arg0","STRING","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","rSplitBindings","_jsvTr","delegateTarget","activeBody","type","attr","_jsvChg","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","lastIndex","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","select2","filtered","add","find","withMarkers","contentView","prevIsFirstNode","lastSibling","childTags","_gm","constructor","prototype","indexFrom","newVal","_bdArgs","base","_bdVals","isArray","inArray","bindToLength","extra","domChange","forOrIfTagCtx","linkTag","domChangeNotification","tagParElem","hasListener","_data","events","triggerHandler","onDomChange","isTop","parentElement","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","linkExpr","propParams","useDisable","disabled","checkboxgroup","lateRender","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","_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,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QoX,GAAKpX,GAAQqX,IAGtBnJ,GAAeQ,UACdsI,SAAU,YACVM,UAAU,EACV7X,YAAY,EAIZwX,KACCC,QAAS,EAAG,+BAAgC,aAC5CK,QAAS,EAAG,aAAc,eAC1BzG,MAAO,EAAG,QAAS,UACnBM,OAAQ,EAAG,WAAY,aACvBjB,OAAQ,EAAG,UAAW,YACtBE,IAAK,EAAG,iBAAkB,oBAC1BgH,IAAK,EAAG,qBAAsB,yBAC9BtG,KAAM,EAAG,mCAAoC,uBAC7CL,QAAS,EAAG,QAAS,UAGrBpR,IAAKvZ,EAAEyxB,QAAQC,eAAiB,EAAG,GAAI,KAAO,EAAG,SAAU,WAE5DtiB,KACCoa,OACCla,KAAMmS,EAAahgB,GAAIuG,IAExB2pB,SAAUjI,GACVhH,OAAQgH,GACRe,UACChpB,GAAI,YAKCzB,GACLipB","file":"jquery.views.min.js","sourcesContent":["/*! jquery.views.js v1.0.15: http://jsviews.com/ */\n/*\n * Interactive data-driven views using JsRender 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 2024, 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 <script> tag\n\t\tfactory(global, false);\n\t}\n} (\n\n// factory (for jquery.views.js)\nfunction(global, $, jsr, jso) {\n\"use strict\";\n\n//========================== Top-level vars ==========================\n\n// global var is the this object, which is window when running in the usual browser environment\nvar setGlobals = $ === false; // Only set globals if script block in browser (not AMD and not CommonJS)\n\njsr = jsr || setGlobals && global.jsrender;\n$ = $ || global.jQuery;\n\nvar versionNumber = \"v1.0.15\",\n\trequiresStr = \"jquery.views.js requires \";\n\nif (!$ || !$.fn) {\n\t// jQuery is not loaded.\n\tthrow requiresStr + \"jQuery\"; // We require jQuery\n}\n\nif (jsr && !jsr.fn) {\n\tjsr.views.sub._jq($); // map over from jsrender namespace to jQuery namespace\n}\n\nvar $observe, $observable,\n\t$isArray = $.isArray,\n\t$views = $.views;\n\nif (!$.render) {\n\t// JsRender is not loaded.\n\tthrow requiresStr + \"jsrender.js\"; // jsrender.js must be loaded before JsViews and after jQuery\n}\nif ($views.jsviews !== versionNumber) {\n\tthrow requiresStr + \"query.observable.js \" + versionNumber; // Wrong version number\n}\n\n\nif (!$views || !$views.map || $views.jsviews !== versionNumber) {\n\t// JsRender is not loaded.\n\tthrow requiresStr + \"jsrender.js \" + versionNumber; // jsrender.js must be loaded before JsViews and after jQuery\n}\n\nvar document = global.document,\n\t$viewsSettings = $views.settings,\n\t$sub = $views.sub,\n\t$subSettings = $sub.settings,\n\t$extend = $sub.extend,\n\t$isFunction = $.isFunction,\n\t$expando = $.expando,\n\t$converters = $views.converters,\n\t$tags = $views.tags,\n\t$subSettingsAdvanced = $subSettings.advanced,\n\n\t// These two settings can be overridden on settings after loading jsRender, and prior to loading jquery.observable.js and/or JsViews\n\tpropertyChangeStr = $sub.propChng = $sub.propChng || \"propertyChange\",\n\tarrayChangeStr = $sub.arrChng = $sub.arrChng || \"arrayChange\",\n\n\tSTRING = \"string\",\n\tHTML = \"html\",\n\t_ocp = \"_ocp\", // Observable contextual parameter\n\tsyntaxError = $sub.syntaxErr,\n\trFirstElem = /<(?!script)(\\w+)[>\\s]/,\n\terror = $sub._er,\n\tonRenderError = $sub._err,\n\tdelimOpenChar0, delimOpenChar1, delimCloseChar0, delimCloseChar1, linkChar, topView,\n\trEscapeQuotes = /['\"\\\\]/g; // Escape quotes and \\ character\nif ($.link) { return $; } // JsViews is already loaded\n\n$subSettings.trigger = true;\n\nvar activeBody, rTagDatalink, $view, $viewsLinkAttr, linkViewsSel, wrapMap, viewStore, oldAdvSet, useInput,\n\tisIE = window.navigator.userAgent,\n\tTEXTCONTENT = document.textContent !== undefined ? \"textContent\" : \"innerText\",\n\tjsvAttrStr = \"data-jsv\",\n\telementChangeStr = \"change.jsv\",\n\tonBeforeChangeStr = \"onBeforeChange\",\n\tonAfterChangeStr = \"onAfterChange\",\n\tonAfterCreateStr = \"onAfterCreate\",\n\tCHECKED = \"checked\",\n\tCHECKBOX = \"checkbox\",\n\tRADIO = \"radio\",\n\tRADIOINPUT = \"input[type=\",\n\tCHECKBOXINPUT = RADIOINPUT + CHECKBOX + \"]\", // input[type=checkbox]\n\tNONE = \"none\",\n\tVALUE = \"value\",\n\tSCRIPT = \"SCRIPT\",\n\tTRUE = \"true\",\n\tcloseScript = '\"></script>',\n\topenScript = '<script type=\"jsv',\n\tdeferAttr = jsvAttrStr + \"-df\",\n\tbindElsSel = \"script,[\" + jsvAttrStr + \"]\",\n\tfnSetters = {\n\t\tvalue: \"val\",\n\t\tinput: \"val\",\n\t\thtml: HTML,\n\t\ttext: \"text\"\n\t},\n\tvalueBinding = {from: VALUE, to: VALUE},\n\tisCleanCall = 0,\n\toldCleanData = $.cleanData,\n\toldJsvDelimiters = $viewsSettings.delimiters,\n\tlinkExprStore = {}, // Compiled functions for data-link expressions\n\tsafeFragment = document.createDocumentFragment(),\n\tqsa = document.querySelector,\n\n\t// elContent maps tagNames which have only element content, so may not support script nodes.\n\telContent = {ol: 1, ul: 1, table: 1, tbody: 1, thead: 1, tfoot: 1, tr: 1, colgroup: 1, dl: 1, select: 1, optgroup: 1, svg: 1, svg_ns: 1},\n\tbadParent = {tr: \"table\"},\n\tvoidElems = {br: 1, img: 1, input: 1, hr: 1, area: 1, base: 1, col: 1, link: 1, meta: 1,\n\t\tcommand: 1, embed: 1, keygen: 1, param: 1, source: 1, track: 1, wbr: 1},\n\tdisplayStyles = {},\n\tbindingStore = {},\n\tbindingKey = 1,\n\trViewPath = /^#(view\\.?)?/,\n\trConvertMarkers = /((\\/>)|<\\/(\\w+)>|)(\\s*)([#/]\\d+(?:_|(\\^)))`(\\s*)(<\\w+(?=[\\s\\/>]))?|\\s*(?:(<\\w+(?=[\\s\\/>]))|<\\/(\\w+)>(\\s*)|(\\/>)\\s*|(>)|$)/g,\n\trOpenViewMarkers = /(#)()(\\d+)(_)/g,\n\trOpenMarkers = /(#)()(\\d+)([_^])/g,\n\trViewMarkers = /(?:(#)|(\\/))(\\d+)(_)/g,\n\trTagMarkers = /(?:(#)|(\\/))(\\d+)(\\^)/g,\n\trOpenTagMarkers = /(#)()(\\d+)(\\^)/g,\n\trMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g,\n\trShallowArrayPath = /^[^.]*$/, // No '.' in path\n\tgetComputedStyle = global.getComputedStyle,\n\t$inArray = $.inArray;\n\nRADIOINPUT += RADIO + \"]\"; // input[type=radio]\nisIE = isIE.indexOf('MSIE ')>0 || isIE.indexOf('Trident/')>0;\n\n$observable = $.observable;\n\nif (!$observable) {\n\t// JsObservable is not loaded.\n\tthrow requiresStr + \"jquery.observable.js\"; // jquery.observable.js must be loaded before JsViews\n}\n\n$observe = $observable.observe;\n\n$subSettings._clFns = function() {\n\tlinkExprStore = {};\n};\n\n//========================== Top-level functions ==========================\n\n//===============\n// Event handlers\n//===============\n\nfunction updateValues(sourceValues, tagElse, async, bindId, ev) {\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.updateValues(val1, val2, val3, ...) - this: tag\n\tvar linkCtx, cvtBack, cnvtName, target, view, binding, sourceValue, origVals, sourceElem, sourceEl,\n\t\ttos, to, tcpTag, exprOb, contextCb, l, m, tag, vals, ind;\n\n\tif (bindId && bindId._tgId) {\n\t\ttag = bindId;\n\t\tbindId = tag._tgId;\n\t\tif (!tag.bindTo) {\n\t\t\tdefineBindToDataTargets(bindingStore[bindId], tag); // If this tag is updating for the first time, we need to create the 'to' bindings first\n\t\t\ttag.bindTo = [0];\n\t\t}\n\t}\n\tif ((binding = bindingStore[bindId]) && (tos = binding.to)) {\n\t\ttos = tos[tagElse||0];\n\t\t// The binding has a 'to' field, which is of the form [tosForElse0, tosForElse1, ...]\n\t\t// where tosForElseX is of the form [[[targetObject, toPath], [targetObject, toPath], ...], cvtBack]\n\t\tlinkCtx = binding.linkCtx;\n\t\tsourceElem = linkCtx.elem;\n\t\tview = linkCtx.view;\n\t\ttag = linkCtx.tag;\n\t\tif (!tag && tos._cxp) {\n\t\t\ttag = tos._cxp.path !== _ocp && tos._cxp.tag;\n\t\t\tsourceValue = sourceValues[0];\n\t\t\tsourceValues = [];\n\t\t\tsourceValues[tos._cxp.ind] = sourceValue;\n\t\t}\n\n\t\tif (tag) {\n\t\t\ttag._.chg = 1; // Set 'changing' marker to prevent tag update from updating itself\n\t\t\tif (cnvtName = tag.convertBack) {\n\t\t\t\tif ($isFunction(cnvtName)) {\n\t\t\t\t\tcvtBack = cnvtName;\n\t\t\t\t} else {\n\t\t\t\t\tcvtBack = view.getRsc(\"converters\", cnvtName);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (sourceElem.nodeName === \"SELECT\") {\n\t\t\t// data-link <select> to string or (multiselect) array of strings\n\t\t\tif (sourceElem.multiple && sourceValues[0] === null) {\n\t\t\t\t// Case where sourceValues was undefined, and set to [null] by $source[setter]() above\n\t\t\t\tsourceValues = [[]];\n\t\t\t}\n\t\t\tsourceElem._jsvSel = sourceValues;\n\t\t} else if (sourceElem._jsvSel) {\n\t\t\t// Checkbox group (possibly using {{checkboxgroup}} tag) data-linking to array of strings\n\t\t\tvals = sourceElem._jsvSel.slice();\n\t\t\tind = $inArray(sourceElem.value, vals);\n\t\t\tif (ind > -1 && !sourceElem.checked) {\n\t\t\t\tvals.splice(ind, 1); // Unchecking this checkbox\n\t\t\t} else if (ind < 0 && sourceElem.checked) {\n\t\t\t\tvals.push(sourceElem.value); // Checking this checkbox\n\t\t\t}\n\t\t\tsourceValues = [vals];\n\t\t}\n\t\torigVals = sourceValues;\n\t\tl = tos.length;\n\t\tif (cvtBack) {\n\t\t\tsourceValues = cvtBack.apply(tag, sourceValues);\n\t\t\tif (sourceValues === undefined) {\n\t\t\t\ttos = []; // If cvtBack does not return anything, do not update target.\n\t\t\t\t//(But cvtBack may be designed to modify observable values from code as a side effect)\n\t\t\t}\n\t\t\tif (!$isArray(sourceValues) || (sourceValues.arg0 !== false && (l === 1 || sourceValues.length !== l || sourceValues.arg0))) {\n\t\t\t\tsourceValues = [sourceValues];\n\t\t\t\t// If there are multiple tos (e.g. multiple args on data-linked input) then cvtBack can update not only\n\t\t\t\t// the first arg, but all of them by returning an array.\n\t\t\t}\n\t\t}\n\n\t\twhile (l--) {\n\t\t\tif (to = tos[l]) {\n\t\t\t\tto = typeof to === STRING ? [linkCtx.data, to] : to; // [object, path]\n\t\t\t\ttarget = to[0];\n\t\t\t\ttcpTag = to.tag; // If this is a tag contextual parameter - the owner tag\n\t\t\t\tsourceValue = (target && target._ocp && !target._vw\n\t\t\t\t\t? origVals // If to target is for tag contextual parameter set to static expression (or uninitialized) - we are\n\t\t\t\t\t// binding to tag.ctx.foo._ocp - and we use original values, without applying cvtBack converter\n\t\t\t\t\t: sourceValues // Otherwise use the converted value\n\t\t\t\t)[l];\n\t\t\t\tif (sourceValue !== undefined && (!tag || !tag.onBeforeUpdateVal || tag.onBeforeUpdateVal(ev, {\n\t\t\t\t\t\tchange: \"change\",\n\t\t\t\t\t\tdata: target,\n\t\t\t\t\t\tpath: to[1],\n\t\t\t\t\t\tindex: l,\n\t\t\t\t\t\ttagElse: tagElse,\n\t\t\t\t\t\tvalue: sourceValue\n\t\t\t\t\t}) !== false)) {\n\t\t\t\t\tif (tcpTag) { // We are modifying a tag contextual parameter ~foo (e.g. from within block) so update 'owner' tag: tcpTag\n\t\t\t\t\t\tif ((m = tcpTag._.toIndex[to.ind]) !== undefined) {\n\t\t\t\t\t\t\ttcpTag.updateValue(sourceValue, m, to.tagElse, undefined, undefined, ev); // if doesn't map, don't update, or update scoped tagCtxPrm. But should initialize from outer from binding...\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttcpTag.setValue(sourceValue, to.ind, to.tagElse);\n\t\t\t\t\t} else if (sourceValue !== undefined && target) {\n\t\t\t\t\t\tif ((tcpTag = ev && (sourceEl = ev.target)._jsvInd === l && sourceEl._jsvLkEl) && (m = tcpTag._.fromIndex[l]) !== undefined) {\n\t\t\t\t\t\t\t// The source is a tag linkedElem (linkedElement: [..., \"elemSelector\", ...], which is updating\n\t\t\t\t\t\t\ttcpTag.setValue(origVals[l], m, sourceEl._jsvElse);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (target._cpfn) {\n\t\t\t\t\t\t\tcontextCb = linkCtx._ctxCb; // This is the exprOb for a computed property\n\t\t\t\t\t\t\texprOb = target;\n\t\t\t\t\t\t\ttarget = linkCtx.data;\n\t\t\t\t\t\t\tif (exprOb._cpCtx) { // Computed value for a contextual parameter\n\t\t\t\t\t\t\t\ttarget = exprOb.data; // The data for the contextual view (where contextual param expression evaluated/assigned)\n\t\t\t\t\t\t\t\tcontextCb = exprOb._cpCtx; // Context callback for contextual view\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twhile (exprOb && exprOb.sb) { // Step through chained computed values to leaf one...\n\t\t\t\t\t\t\t\ttarget = contextCb(exprOb);\n\t\t\t\t\t\t\t\texprOb = exprOb.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$observable(target, async).setProperty(to[1], sourceValue, undefined, to.isCpfn); // 2way binding change event - observably updating bound object\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (tag) {\n\t\ttag._.chg = undefined; // Clear marker\n\t\treturn tag;\n\t}\n}\n\nfunction onElemChange(ev) {\n\tvar bindId, val,\n\t\tsource = ev.target,\n\t\tfromAttr = defaultAttr(source),\n\t\tsetter = fnSetters[fromAttr],\n\t\trSplitBindings = /&(\\d+)\\+?/g;\n\n\tif (!source._jsvTr || ev.delegateTarget !== activeBody && source.type !== \"number\" || ev.type === \"input\") {\n\t\t// If this is an element using trigger, ignore event delegated (bubbled) to activeBody\n\t\tval = $isFunction(fromAttr)\n\t\t\t? fromAttr(source)\n\t\t\t: setter\n\t\t\t\t? $(source)[setter]()\n\t\t\t\t: $(source).attr(fromAttr);\n\n\t\tsource._jsvChg = 1; // // Set 'changing' marker to prevent linkedElem change event triggering its own refresh\n\t\twhile (bindId = rSplitBindings.exec(source._jsvBnd)) {\n\t\t\t// _jsvBnd is a string with the syntax: \"&bindingId1&bindingId2\"\n\t\t\tupdateValue(val, source._jsvInd, source._jsvElse, undefined, bindId[1], ev);\n\t\t}\n\t\tsource._jsvChg = undefined; // Clear marker\n\t}\n}\n\nfunction onDataLinkedTagChange(ev, eventArgs) {\n\t// Update or initial rendering of any tag (including {{:}}) whether inline or data-linked element.\n\tvar attr, sourceValue, noUpdate, forceUpdate, hasError, onError, bindEarly, tagCtx, l,\n\t\tlinkCtx = this,\n\t\tlinkFn = linkCtx.fn,\n\t\ttag = linkCtx.tag,\n\t\tsource = linkCtx.data,\n\t\ttarget = linkCtx.elem,\n\t\tcvt = linkCtx.convert,\n\t\tparentElem = target.parentNode,\n\t\tview = linkCtx.view,\n\t\toldLinkCtx = view._lc,\n\t\tonEvent = eventArgs && changeHandler(view, onBeforeChangeStr, tag);\n\n\tif (parentElem && (!onEvent || onEvent.call(tag || linkCtx, ev, eventArgs) !== false)\n\t\t\t// If data changed, the ev.data is set to be the path. Use that to filter the handler action...\n\t\t\t&& (!eventArgs || ev.data.prop === \"*\" || ev.data.prop === eventArgs.path)) {\n\n\t\t// Set linkCtx on view, dynamically, just during this handler call\n\t\tview._lc = linkCtx;\n\n\t\tif (eventArgs || linkCtx._toLk) {\n\t\t\t// If eventArgs are defined, this is a data update\n\t\t\t// Otherwise this is the initial data-link rendering call. Bind on this the first time it gets called\n\t\t\tlinkCtx._toLk = 0; // Remove flag to skip unneccessary rebinding next time\n\t\t\tif (linkFn._er) {\n\t\t\t\t// data-link=\"exprUsingTagOrCvt with onerror=...\" - e.g. {tag ... {cvt:... {:... convert='cvt'\n\t\t\t\ttry {\n\t\t\t\t\tsourceValue = linkFn(source, view, $sub); // Compiled link expression\n\t\t\t\t\t// For data-link=\"{:xxx}\" with no cvt or cvtBk returns value. Otherwise returns tagCtxs\n\t\t\t\t} catch (e) {\n\t\t\t\t\thasError = linkFn._er;\n\t\t\t\t\tonError = onRenderError(e,view,(new Function(\"data,view\", \"return \" + hasError + \";\"))(source, view));\n\t\t\t\t\tsourceValue = [{props: {}, args: [onError], tag: tag}];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsourceValue = linkFn(source, view, $sub); // Compiled link expression\n\t\t\t\t// For data-link=\"{:xxx}\" with no cvt or cvtBk returns value. Otherwise returns tagCtxs\n\t\t\t}\n\t\t\t// Compiled link expression for linkTag: return value for data-link=\"{:xxx}\" with no cvt or cvtBk, otherwise tagCtx or tagCtxs\n\t\t\tattr = tag && tag.attr || linkCtx.attr || (linkCtx._dfAt = defaultAttr(target, true, cvt !== undefined));\n\t\t\tif (linkCtx._dfAt === VALUE && (tag && tag.parentElem || linkCtx.elem).type === CHECKBOX) {\n\t\t\t\tattr = CHECKED; // This is a single checkbox (not in a checkboxgroup - which might have data-link=\"value{:...}\" so linkCtx.attr === VALUE, but would not have _dfAt === VALUE)\n\t\t\t}\n\t\t\t// For {{: ...}} without a convert or convertBack, (tag and linkFn._tag undefined) we already have the sourceValue, and we are done\n\t\t\tif (tag) {\n\t\t\t\t// Existing tag instance\n\t\t\t\tforceUpdate = hasError || tag._er;\n\t\t\t\t// If the new tagCtxs hasError or the previous tagCtxs had error, then force update\n\t\t\t\tsourceValue = sourceValue[0] ? sourceValue : [sourceValue];\n\n\t\t\t\t// Tag will update unless tag.onUpdate is false or is a function which returns false\n\t\t\t\tnoUpdate = !forceUpdate && (tag.onUpdate === false || eventArgs && $isFunction(tag.onUpdate) && tag.onUpdate(ev, eventArgs, sourceValue) === false);\n\n\t\t\t\tmergeCtxs(tag, sourceValue, forceUpdate); // Merge new tagCtxs (in sourceValue var) with current tagCtxs on tag instance\n\n\t\t\t\tif (tag._.chg && (attr === HTML || attr === VALUE) || noUpdate || attr === NONE) {\n\t\t\t\t\t// This is an update coming from the tag itself (linkedElem change), or else onUpdate returned false, or attr === \"none\"\n\t\t\t\t\tcallAfterLink(tag, ev, eventArgs);\n\t\t\t\t\tif (!tag._.chg) {\n\t\t\t\t\t\t// onUpdate returned false, or attr === \"none\" - so don't refresh the tag: we just use the new tagCtxs merged\n\t\t\t\t\t\t// from the sourceValue (which may optionally have been modifed in onUpdate()...) and then bind, and we are done\n\t\t\t\t\t\tobserveAndBind(linkCtx, source, target);\n\t\t\t\t\t}\n\t\t\t\t\t// Remove dynamically added linkCtx from view\n\t\t\t\t\tview._lc = oldLinkCtx;\n\t\t\t\t\tif (eventArgs && (onEvent = changeHandler(view, onAfterChangeStr, tag))) {\n\t\t\t\t\t\tonEvent.call(tag || linkCtx, ev, eventArgs);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag.tagCtx.props.dataMap) {\n\t\t\t\t\t\ttag.tagCtx.props.dataMap.map(tag.tagCtx.args[0], tag.tagCtx, tag.tagCtx.map, isRenderCall || !tag._.bnd);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\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, ev, eventArgs);\n\t\t\t\t}\n\n\t\t\t\ttag.linkedElems = tag.linkedElem = tag.mainElem = tag.displayElem = undefined;\n\t\t\t\tl = tag.tagCtxs.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\ttagCtx = tag.tagCtxs[l];\n\t\t\t\t\ttagCtx.linkedElems = tagCtx.mainElem = tagCtx.displayElem = undefined;\n\t\t\t\t}\n\n\t\t\t\tsourceValue = tag.tagName === \":\" // Call convertVal if it is a {{cvt:...}} - otherwise call renderTag\n\t\t\t\t\t? $sub._cnvt(tag.convert, view, sourceValue[0]) // convertVal(converter, view, tagCtx, onError)\n\t\t\t\t\t: $sub._tag(tag, view, view.tmpl, sourceValue, true, onError); // renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError)\n\t\t\t} else if (linkFn._tag) {\n\t\t\t\t// For {{: ...}} with either cvt or cvtBack we call convertVal to get the sourceValue and instantiate the tag\n\t\t\t\t// If cvt is undefined then this is a tag, and we call renderTag to get the rendered content and instantiate the tag\n\t\t\t\tcvt = cvt === \"\" ? TRUE : cvt; // If there is a cvtBack but no cvt, set cvt to \"true\"\n\t\t\t\tsourceValue = cvt // Call convertVal if it is a {{cvt:...}} - otherwise call renderTag\n\t\t\t\t\t? $sub._cnvt(cvt, view, sourceValue[0] || sourceValue) // convertVal(converter, view, tagCtx, onError)\n\t\t\t\t\t: $sub._tag(linkFn._tag, view, view.tmpl, sourceValue, true, onError); // renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError)\n\n\t\t\t\taddLinkMethods(tag = linkCtx.tag); // In both convertVal and renderTag we have instantiated a tag\n\t\t\t\tattr = linkCtx.attr || attr; // linkCtx.attr may have been set to tag.attr during tag instantiation in renderTag\n\t\t\t}\n\t\t\tif (bindEarly = tag && (!tag.inline || linkCtx.fn._lr) && tag.template) {\n\t\t\t\t// Data-linked tags with templated contents need to be data-linked before their contents, so that observable updates\n\t\t\t\t// will trigger the parent tags before the child tags.\n\t\t\t\tobserveAndBind(linkCtx, source, target);\n\t\t\t}\n\t\t\tupdateContent(sourceValue, linkCtx, attr, tag);\n\t\t\tlinkCtx._noUpd = 0; // For data-link=\"^{...}\" remove _noUpd flag so updates on subsequent calls\n\n\t\t\tif (tag) {\n\t\t\t\ttag._er = hasError;\n\t\t\t\tcallAfterLink(tag, ev, eventArgs);\n\t\t\t}\n\t\t}\n\n\t\tif (!bindEarly) {\n\t\t\tobserveAndBind(linkCtx, source, target);\n\t\t}\n\n\t\tif (tag && tag._.ths) {\n\t\t\t// Tag has a this=expr binding for which we have created an additional 'to' (defineBindToDataTargets) target (at index bindTo.length)\n\t\t\t// We now have the this pointer, so we push it to the binding, using updateValue(index)\n\t\t\ttag.updateValue(tag, tag.bindTo ? tag.bindTo.length : 1); // If bindTo not defined yet, it will be [0], so length 1\n\t\t}\n\n\t\tif (eventArgs && (onEvent = changeHandler(view, onAfterChangeStr, tag))) {\n\t\t\tonEvent.call(tag || linkCtx, ev, eventArgs);\n\t\t}\n\t\t// Remove dynamically added linkCtx from view\n\t\tview._lc = oldLinkCtx;\n\t}\n}\n\nfunction setDefer(elem, value) {\n\telem._df = value; // Use both an expando and an attribute to track deferred tokens. Attribute is needed for querySelectorAll for getViewInfos (childTags)\n\telem[(value ? \"set\" : \"remove\") + \"Attribute\"](deferAttr, \"\");\n}\n\nfunction updateContent(sourceValue, linkCtx, attr, tag) {\n\t// When called for a tag, either in tag.refresh() or onDataLinkedTagChange(), returns tag\n\t// When called (in onDataLinkedTagChange) for target HTML returns true\n\t// When called (in onDataLinkedTagChange) for other targets returns boolean for \"change\"\n\tvar setter, prevNode, nextNode, late, nodesToRemove, useProp, tokens, id, openIndex, closeIndex, testElem, nodeName, cStyle, jsvSel,\n\t\trenders = attr !== NONE && sourceValue !== undefined && !linkCtx._noUpd && !((attr === VALUE || attr === HTML) && (!tag && linkCtx.elem._jsvChg)),\n\t\t// For data-link=\"^{...}\", don't update the first time (no initial render) - e.g. to leave server rendered values.\n\t\tsource = linkCtx.data,\n\t\ttarget = tag && tag.parentElem || linkCtx.elem,\n\t\ttargetParent = target.parentNode,\n\t\t$target = $(target),\n\t\tview = linkCtx.view,\n\t\ttargetVal = linkCtx._val,\n\t\tchange = tag;\n\n\tif (tag) {\n\t\t// Initialize the tag with element references\n\t\ttag._.unlinked = true; // Set to unlinked, so initialization is triggered after re-rendering, e.g. for setting linkedElem, and calling onBind\n\t\ttag.parentElem = tag.parentElem || (linkCtx.expr || tag._elCnt) ? target : targetParent;\n\t\tprevNode = tag._prv;\n\t\tnextNode = tag._nxt;\n\t}\n\tif (!renders) {\n\t\tlinkCtx._val = sourceValue;\n\t\treturn;\n\t}\n\n\tif (attr === \"visible\") {\n\t\tattr = \"css-display\";\n\t}\n\tif (/^css-/.test(attr)) {\n\t\tif (linkCtx.attr === \"visible\") {\n\t\t\t// Get the current display style\n\t\t\tcStyle = (target.currentStyle || getComputedStyle.call(global, target, \"\")).display;\n\n\t\t\tif (sourceValue) {\n\t\t\t\t// We are showing the element.\n\t\t\t\t// Get the cached 'visible' display value from the -jsvd expando\n\t\t\t\tsourceValue = target._jsvd\n\t\t\t\t\t// Or, if not yet cached, get the current display value\n\t\t\t\t\t|| cStyle;\n\t\t\t\tif (sourceValue === NONE && !(sourceValue = displayStyles[nodeName = target.nodeName])) {\n\t\t\t\t\t// Currently display value is 'none', and the 'visible' style has not been cached.\n\t\t\t\t\t// We create an element to find the correct 'visible' display style for this nodeName\n\t\t\t\t\ttestElem = document.createElement(nodeName);\n\t\t\t\t\tdocument.body.appendChild(testElem);\n\n\t\t\t\t\t// Get the default style for this HTML tag to use as 'visible' style\n\t\t\t\t\tsourceValue\n\t\t\t\t\t\t// and cache it as a hash against nodeName\n\t\t\t\t\t\t= displayStyles[nodeName]\n\t\t\t\t\t\t= (testElem.currentStyle || getComputedStyle.call(global, testElem, \"\")).display;\n\t\t\t\t\tdocument.body.removeChild(testElem);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We are hiding the element.\n\t\t\t\t// Cache the current display value as 'visible' style, on _jsvd expando, for when we show the element again\n\t\t\t\ttarget._jsvd = cStyle;\n\t\t\t\tsourceValue = NONE; // Hide the element\n\t\t\t}\n\t\t}\n\t\tif (change = change || targetVal !== sourceValue) {\n\t\t\t$.style(target, attr.slice(4), sourceValue);\n\t\t}\n\t} else if (attr !== \"link\") { // attr === \"link\" is for tag controls which do data binding but have no rendered output or target\n\t\tif (/^data-/.test(attr)) {\n\t\t\t$.data(target, attr.slice(5), sourceValue); // Support for binding to data attributes: data-foo{:expr}: data-foo attribute will be\n\t\t\t// expr.toString(), but $.data(element, \"foo\") and $(element).data(\"foo\") will actually return value of expr, even if of type object\n\t\t} else if (/^prop-/.test(attr)) {\n\t\t\tuseProp = true;\n\t\t\tattr = attr.slice(5);\n\t\t} else if (attr === CHECKED) {\n\t\t\tuseProp = true;\n\t\t\tif (target.name && $isArray(sourceValue)) {\n\t\t\t\ttarget._jsvSel = sourceValue; // Checkbox group (possibly using {{checkboxgroup}} tag) data-linking to array of strings\n\t\t\t\tsourceValue = $inArray(target.value, sourceValue) > -1;\n\t\t\t} else {\n\t\t\t\tsourceValue = sourceValue && sourceValue !== \"false\";\n\t\t\t}\n\t\t\t// The string value \"false\" can occur with data-link=\"checked{attr:expr}\" - as a result of attr, and hence using convertVal()\n\t\t\t// We will set the \"checked\" property\n\t\t\t// We will compare this with the current value\n\t\t} else if (attr === RADIO) {\n\t\t\t// This is a special binding attribute for radio buttons, which corresponds to the default 'to' binding.\n\t\t\t// This allows binding both to value (for each input) and to the default checked radio button (for each input in named group,\n\t\t\t// e.g. binding to parent data).\n\t\t\t// Place value binding first: <input type=\"radio\" data-link=\"value{:name} {:#get('data').data.currency:} \" .../>\n\t\t\t// or (allowing any order for the binding expressions):\n\t\t\t// <input type=\"radio\" value=\"{{:name}}\" data-link=\"{:#get('data').data.currency:} value^{:name}\" .../>\n\t\t\tuseProp = true;\n\t\t\tattr = CHECKED;\n\t\t\tsourceValue = target.value === sourceValue;\n\t\t\t// If the data value corresponds to the value attribute of this radio button input, set the checked property to true\n\t\t\t// Otherwise set the checked property to false\n\t\t} else if (attr === \"selected\" || attr === \"disabled\" || attr === \"multiple\" || attr === \"readonly\") {\n\t\t\tsourceValue = (sourceValue && sourceValue !== \"false\") ? attr : null;\n\t\t\t// Use attr, not prop, so when the options (for example) are changed dynamically, but include the previously selected value,\n\t\t\t// they will still be selected after the change\n\t\t} else if (attr === VALUE && target.nodeName === \"SELECT\") {\n\t\t\ttarget._jsvSel = $isArray(sourceValue)\n\t\t\t\t? sourceValue\n\t\t\t\t: \"\" + sourceValue; // If not array, coerce to string\n\t\t}\n\n\t\tif (setter = fnSetters[attr]) {\n\t\t\tif (attr === HTML) {\n\t\t\t\tif (tag && tag.inline) {\n\t\t\t\t\tnodesToRemove = tag.nodes(true);\n\t\t\t\t\tif (tag._elCnt) {\n\t\t\t\t\t\tif (prevNode && prevNode !== nextNode) { // nextNode !== prevNode\n\t\t\t\t\t\t\t// This prevNode will be removed from the DOM, so transfer the view tokens on prevNode to nextNode of this 'viewToRefresh'\n\t\t\t\t\t\t\ttransferViewTokens(prevNode, nextNode, target, tag._tgId, \"^\", true);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// nextNode === prevNode, or there is no nextNode and so the target._df may have tokens\n\t\t\t\t\t\t\ttokens = prevNode ? prevNode.getAttribute(jsvAttrStr) : target._df;\n\t\t\t\t\t\t\tid = tag._tgId + \"^\";\n\t\t\t\t\t\t\topenIndex = tokens.indexOf(\"#\" + id) + 1;\n\t\t\t\t\t\t\tcloseIndex = tokens.indexOf(\"/\" + id);\n\n\t\t\t\t\t\t\tif (openIndex && closeIndex > 0) {\n\t\t\t\t\t\t\t\t// If prevNode, or target._df, include tokens referencing view and tag bindings contained within the open and close tokens\n\t\t\t\t\t\t\t\t// of the updated tag control, they need to be processed (disposed)\n\t\t\t\t\t\t\t\topenIndex += id.length;\n\t\t\t\t\t\t\t\tif (closeIndex > openIndex) {\n\t\t\t\t\t\t\t\t\tdisposeTokens(tokens.slice(openIndex, closeIndex)); // Dispose view and tag bindings\n\t\t\t\t\t\t\t\t\ttokens = tokens.slice(0, openIndex) + tokens.slice(closeIndex);\n\n\t\t\t\t\t\t\t\t\tif (prevNode) {\n\t\t\t\t\t\t\t\t\t\tprevNode.setAttribute(jsvAttrStr, tokens); // Remove tokens of replaced content\n\t\t\t\t\t\t\t\t\t} else if (target._df) { // Remove tokens of replaced content\n\t\t\t\t\t\t\t\t\t\tsetDefer(target, tokens);\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}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tprevNode = prevNode\n\t\t\t\t\t\t\t? prevNode.previousSibling\n\t\t\t\t\t\t\t: nextNode\n\t\t\t\t\t\t\t\t? nextNode.previousSibling\n\t\t\t\t\t\t\t\t: target.lastChild;\n\t\t\t\t\t}\n\t\t\t\t\t// Remove HTML nodes\n\t\t\t\t\t$(nodesToRemove).remove(); // Note if !tag._elCnt removing the nodesToRemove will process and dispose view and tag bindings contained within the updated tag control\n\n\t\t\t\t\t// Insert and link new content\n\t\t\t\t\tlate = view.link(view.data, target, prevNode, nextNode, sourceValue, tag && {tag: tag._tgId});\n\t\t\t\t} else {\n\t\t\t\t\t// data-linked value targeting innerHTML: data-link=\"html{:expr}\" or contenteditable=\"true\"\n\t\t\t\t\trenders = renders && targetVal !== sourceValue;\n\t\t\t\t\tif (renders) {\n\t\t\t\t\t\t$target.empty();\n\t\t\t\t\t\tlate = view.link(source, target, prevNode, nextNode, sourceValue, tag && {tag: tag._tgId});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (target._jsvSel) {\n\t\t\t\t$target[setter](sourceValue); // <select> (or multiselect)\n\t\t\t} else {\n\t\t\t\tif (change = change || targetVal !== sourceValue) {\n\t\t\t\t\tif (attr === \"text\" && target.children && !target.children[0]) {\n\t\t\t\t\t\t// This code is faster then $target.text()\n\t\t\t\t\t\ttarget[TEXTCONTENT] = sourceValue === null ? \"\" : sourceValue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$target[setter](sourceValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ((jsvSel = targetParent._jsvSel) !== undefined\n\t\t\t\t\t// Setting value of <option> element\n\t\t\t\t\t&& (attr === VALUE || $target.attr(VALUE) === undefined)) { // Setting value attribute, or setting textContent if attribute is null\n\t\t\t\t\t// Set/unselect selection based on value set on parent <select>. Works for multiselect too\n\t\t\t\t\ttarget.selected = $inArray(\"\" + sourceValue, $isArray(jsvSel) ? jsvSel : [jsvSel]) > -1;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (change = change || targetVal !== sourceValue) {\n\t\t\t// Setting an attribute to undefined should remove the attribute\n\t\t\t$target[useProp ? \"prop\" : \"attr\"](attr, sourceValue === undefined && !useProp ? null : sourceValue);\n\t\t}\n\t}\n\tlinkCtx._val = sourceValue;\n\tlateLink(late); // Do any deferred linking (lateRender)\n\treturn change;\n}\n\nfunction arrayChangeHandler(ev, eventArgs) { // array change handler for 'array' views\n\tvar self = this,\n\t\tonBeforeChange = changeHandler(self, onBeforeChangeStr, self.tag),\n\t\tonAfterChange = changeHandler(self, onAfterChangeStr, self.tag);\n\tif (!onBeforeChange || onBeforeChange.call(self, ev, eventArgs) !== false) {\n\t\tif (eventArgs) {\n\t\t\t// This is an observable action (not a trigger/handler call from pushValues, or similar, for which eventArgs will be null)\n\t\t\tvar action = eventArgs.change,\n\t\t\t\tindex = eventArgs.index,\n\t\t\t\titems = eventArgs.items;\n\t\t\tself._.srt = eventArgs.refresh; // true if part of a 'sort' on refresh\n\t\t\tswitch (action) {\n\t\t\t\tcase \"insert\":\n\t\t\t\t\tself.addViews(index, items, eventArgs._dly);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"remove\":\n\t\t\t\t\tself.removeViews(index, items.length, undefined, eventArgs._dly);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"move\":\n\t\t\t\t\tself.moveViews(eventArgs.oldIndex, index, items.length);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"refresh\":\n\t\t\t\t\tself._.srt = undefined;\n\t\t\t\t\tself.fixIndex(0);\n\t\t\t\t\t// Other cases: (e.g.undefined, for setProperty on observable object) etc. do nothing\n\t\t\t}\n\t\t}\n\t\tif (onAfterChange) {\n\t\t\tonAfterChange.call(self, ev, eventArgs);\n\t\t}\n\t}\n}\n\n//=============================\n// Utilities for event handlers\n//=============================\n\nfunction setArrayChangeLink(view) {\n\t// Add/remove arrayChange handler on view\n\tvar handler, arrayBinding,\n\t\ttype = view.type, // undefined if view is being removed\n\t\tdata = view.data,\n\t\tbound = view._.bnd; // true for top-level link() or data-link=\"{for}\", or the for tag instance for {^{for}} (or for any custom tag that has an onArrayChange handler)\n\n\tif (!view._.useKey && bound) {\n\t\t// This is an array view. (view._.useKey not defined => data is array), and is data-bound to collection change events\n\n\t\tif (arrayBinding = view._.bndArr) {\n\t\t\t// First remove the current handler if there is one\n\t\t\t$([arrayBinding[1]]).off(arrayChangeStr, arrayBinding[0]);\n\t\t\tview._.bndArr = undefined;\n\t\t}\n\t\tif (bound !== !!bound) {\n\t\t\t// bound is not a boolean, so it is the data-linked tag that 'owns' this array binding - e.g. {^{for...}}\n\t\t\tif (type) {\n\t\t\t\tbound._.arrVws[view._.id] = view;\n\t\t\t} else {\n\t\t\t\tdelete bound._.arrVws[view._.id]; // if view.type is undefined, view is being removed\n\t\t\t}\n\t\t} else if (type && data) {\n\t\t\t// If this view is not being removed, but the data array has been replaced, then bind to the new data array\n\t\t\thandler = function(ev) {\n\t\t\t\tif (!(ev.data && ev.data.off)) {\n\t\t\t\t\t// Skip if !!ev.data.off: - a handler that has already been removed (maybe was on handler collection at call time - then removed by another handler)\n\t\t\t\t\t// If view.type is undefined, do nothing. (Corresponds to case where there is another handler on the same data whose\n\t\t\t\t\t// effect was to remove this view, and which happened to precede this event in the trigger sequence. So although this\n\t\t\t\t\t// event has been removed now, it is still called since already on the trigger sequence)\n\t\t\t\t\tarrayChangeHandler.apply(view, arguments);\n\t\t\t\t}\n\t\t\t};\n\t\t\t$([data]).on(arrayChangeStr, handler);\n\t\t\tview._.bndArr = [handler, data];\n\t\t}\n\t}\n}\n\nfunction defaultAttr(elem, to, linkGetVal) {\n\t// to: true - default attribute for setting data value on HTML element; false: default attribute for getting value from HTML element\n\t// Merge in the default attribute bindings for this target element\n\tvar nodeName = elem.nodeName.toLowerCase(),\n\t\tattr =\n\t\t\t$subSettingsAdvanced._fe[nodeName] // get form element binding settings for input textarea select or optgroup\n\t\t\t|| elem.contentEditable === TRUE && {to: HTML, from: HTML}; // Or if contentEditable set to \"true\" set attr to \"html\"\n\treturn attr\n\t\t? (to\n\t\t\t? ((nodeName === \"input\" && elem.type === RADIO) // For radio buttons, bind from value, but bind to 'radio' - special value.\n\t\t\t\t? RADIO\n\t\t\t\t: attr.to)\n\t\t\t: attr.from)\n\t\t: to\n\t\t\t? linkGetVal ? \"text\" : HTML // Default innerText for data-link=\"a.b.c\" or data-link=\"{:a.b.c}\" (with or without converters)- otherwise innerHTML\n\t\t\t: \"\"; // Default is not to bind from\n}\n\n//==============================\n// Rendering and DOM insertion\n//==============================\n\nfunction renderAndLink(view, index, tmpl, views, data, context, refresh) {\n\tvar html, linkToNode, prevView, nodesToRemove, bindId,\n\t\tparentNode = view.parentElem,\n\t\tprevNode = view._prv,\n\t\tnextNode = view._nxt,\n\t\telCnt = view._elCnt;\n\n\tif (prevNode && prevNode.parentNode !== parentNode) {\n\t\terror(\"Missing parentNode\");\n\t\t// Abandon, since node has already been removed, or wrapper element has been inserted between prevNode and parentNode\n\t}\n\n\tif (refresh) {\n\t\tnodesToRemove = view.nodes();\n\t\tif (elCnt && prevNode && prevNode !== nextNode) {\n\t\t\t// This prevNode will be removed from the DOM, so transfer the view tokens on prevNode to nextNode of this 'viewToRefresh'\n\t\t\ttransferViewTokens(prevNode, nextNode, parentNode, view._.id, \"_\", true);\n\t\t}\n\t\t// Remove child views\n\t\tview.removeViews(undefined, undefined, true);\n\t\tlinkToNode = nextNode;\n\n\t\tif (elCnt) {\n\t\t\tprevNode = prevNode\n\t\t\t\t? prevNode.previousSibling\n\t\t\t\t: nextNode\n\t\t\t\t\t? nextNode.previousSibling\n\t\t\t\t\t: parentNode.lastChild;\n\t\t}\n\n\t\t// Remove HTML nodes\n\t\t$(nodesToRemove).remove();\n\n\t\tfor (bindId in view._.bnds) {\n\t\t\t// The view bindings may have already been removed above in: $(nodesToRemove).remove();\n\t\t\t// If not, remove them here:\n\t\t\tremoveViewBinding(bindId);\n\t\t}\n\t} else {\n\t\t// addViews. Only called if view is of type \"array\"\n\t\tif (index) {\n\t\t\t// index is a number, so indexed view in view array\n\t\t\tprevView = views[index - 1];\n\t\t\tif (!prevView) {\n\t\t\t\treturn false; // If subview for provided index does not exist, do nothing\n\t\t\t}\n\t\t\tprevNode = prevView._nxt;\n\t\t}\n\t\tif (elCnt) {\n\t\t\tlinkToNode = prevNode;\n\t\t\tprevNode = linkToNode\n\t\t\t\t? linkToNode.previousSibling // There is a linkToNode, so insert after previousSibling, or at the beginning\n\t\t\t\t: parentNode.lastChild; // If no prevView and no prevNode, index is 0 and the container is empty,\n\t\t\t\t// so prevNode = linkToNode = null. But if prevView._nxt is null then we set prevNode to parentNode.lastChild\n\t\t\t\t// (which must be before the prevView) so we insert after that node - and only link the inserted nodes\n\t\t} else {\n\t\t\tlinkToNode = prevNode.nextSibling;\n\t\t}\n\t}\n\thtml = tmpl.render(data, context, view._.useKey && refresh, view, refresh || index, true);\n\t// Pass in view._.useKey as test for noIteration (which corresponds to when self._.useKey > 0 and self.data is an array)\n\n\t// Link the new HTML nodes to the data\n\tlateLink(view.link(data, parentNode, prevNode, linkToNode, html, prevView));\n}\n\n//=====================\n// addBindingMarkers\n//=====================\n\nfunction addBindingMarkers(value, view, tag) {\n\t// Insert binding markers into the rendered template output, which will get converted to appropriate\n\t// data-jsv attributes (element-only content) or script marker nodes (phrasing or flow content), in convertMarkers,\n\t// within view.link, prior to inserting into the DOM. Linking will then bind based on these markers in the DOM.\n\t// Added view markers: #m_...VIEW.../m_\n\t// Added tag markers: #m^...TAG..../m^\n\tvar id, end;\n\tif (tag) {\n\t\t// This is a binding marker for a data-linked tag {^{...}}\n\t\tend = \"^`\";\n\t\taddLinkMethods(tag); // This is {^{>...}} or {^{tag ...}}, {{cvt:...} or {^{:...}}, and tag was defined in convertVal or renderTag\n\t\tid = tag._tgId;\n\t\tif (!id) {\n\t\t\tbindingStore[id = bindingKey++] = tag; // Store the tag temporarily, ready for databinding.\n\t\t\t// During linking, in addDataBinding, the tag will be attached to the linkCtx,\n\t\t\t// and then in observeAndBind, bindingStore[bindId] will be replaced by binding info.\n\t\t\ttag._tgId = \"\" + id;\n\t\t}\n\t} else {\n\t\t// This is a binding marker for a view\n\t\t// Add the view to the store of current linked views\n\t\tend = \"_`\";\n\t\tviewStore[id = view._.id] = view;\n\t}\n\t// Example: \"#23^TheValue/23^\"\n\treturn \"#\" + id + end\n\t\t+ (value != undefined ? value : \"\") // For {^{:name}} this gives the equivalent semantics to compiled\n\t\t\t\t\t\t\t\t\t\t\t// (v=data.name)!=null?v:\"\"; used in {{:name}} or data-link=\"name\"\n\t\t+ \"/\" + id + end;\n}\n\n//==============================\n// Data-linking and data binding\n//==============================\n\n//---------------\n// observeAndBind\n//---------------\n\nfunction observeAndBind(linkCtx, source, target) {\n\tvar binding, l, k, linkedElem, exprFnDeps, exprOb, prop, propDeps, depends, tagDepends, bindId, linkedElems,\n\t\ttag = linkCtx.tag,\n\t\tallowArray = !tag,\n\t\tcvtBk = linkCtx.convertBack,\n\t\thandler = linkCtx._hdl;\n\tsource = typeof source === \"object\" && source; // If not an object set to false\n\n\tif (tag) {\n\t\t// Use the 'depends' paths set on linkCtx.tag, or on the converter\n\t\t// - which may have been set on declaration or in events: init, render, onAfterLink etc.\n\t\tif (depends = tag.convert) {\n\t\t\tdepends = depends === TRUE ? tag.tagCtx.props.convert : depends;\n\t\t\tdepends = linkCtx.view.getRsc(\"converters\", depends) || depends;\n\t\t\tdepends = depends && depends.depends;\n\t\t\tdepends = depends && $sub._dp(depends, source, handler); // dependsPaths\n\t\t}\n\t\tif (tagDepends = tag.tagCtx.props.depends || tag.depends) {\n\t\t\ttagDepends = $sub._dp(tagDepends, tag, handler);\n\t\t\tdepends = depends ? depends.concat(tagDepends) : tagDepends;\n\t\t}\n\t\tlinkedElems = tag.linkedElems;\n\t}\n\tdepends = depends || [];\n\tif (!linkCtx._depends || (\"\" + linkCtx._depends !== \"\" + depends)) {\n\t\t// Only bind the first time, or if the new depends (toString) has changed from when last bound\n\n\t\texprFnDeps = linkCtx.fn.deps.slice(); // Make a copy of the dependency paths for the compiled linkCtx expression - to pass to observe(). In getInnerCb(),\n\t\t// (and whenever the object is updated, in innerCb), we will set exprOb.ob to the current object returned by that computed expression, for this view.\n\n\t\tif (linkCtx._depends) {\n\t\t\tbindId = linkCtx._depends.bdId;\n\t\t\t// Unobserve previous binding\n\t\t\t$observable._apply(1, [source], exprFnDeps, linkCtx._depends, handler, linkCtx._ctxCb, true);\n\t\t}\n\n\t\tif (tag) {\n\t\t\t// Add dependency paths for declared boundProps (so no need to write ^myprop=... to get binding) and for linkedProp too if there is one\n\t\t\tl = tag.boundProps.length;\n\t\t\twhile (l--) {\n\t\t\t\tprop = tag.boundProps[l];\n\t\t\t\tk = tag._.bnd.paths.length;\n\t\t\t\twhile (k--) { // Iterate across tagCtxs\n\t\t\t\t\tpropDeps = tag._.bnd.paths[k][\"_\" + prop];\n\t\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\t\texprFnDeps = exprFnDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tallowArray = tag.onArrayChange === undefined || tag.onArrayChange === true;\n\t\t}\n\n\t\tl = exprFnDeps.length;\n\t\twhile (l--) {\n\t\t\texprOb = exprFnDeps[l];\n\t\t\tif (exprOb._cpfn) {\n\t\t\t\t// This path is an 'exprOb', corresponding to a computed property returning an object. We replace the exprOb by\n\t\t\t\t// a view-binding-specific exprOb instance. The current object will be stored as exprOb.ob.\n\t\t\t\texprFnDeps[l] = $extend({}, exprOb);\n\t\t\t}\n\t\t}\n\t\tbinding = $observable._apply(\n\t\t\tallowArray ? 0 : 1, // 'this' pointer for observeAndBind, used to set allowArray to 1 or 0.\n\t\t\t[source],\n\t\t\texprFnDeps, // flatten the paths - to gather all the dependencies across args and bound params\n\t\t\tdepends,\n\t\t\thandler,\n\t\t\tlinkCtx._ctxCb);\n\t\t// The binding returned by $observe has a bnd array with the source objects of the individual bindings.\n\n\t\tif (!bindId) {\n\t\t\tbindId = linkCtx._bndId || \"\" + bindingKey++;\n\t\t\tlinkCtx._bndId = undefined;\n\t\t\t// Store the binding key on the view and on the element, for disposal when the view is removed\n\t\t\ttarget._jsvBnd = (target._jsvBnd || \"\") + \"&\" + bindId;\n\t\t\tlinkCtx.view._.bnds[bindId] = bindId;\n\t\t}\n\n\t\tbinding.elem = target; // The target of all the individual bindings\n\t\tbinding.linkCtx = linkCtx;\n\t\tbinding._tgId = bindId;\n\n\t\tdepends.bdId = bindId;\n\t\tlinkCtx._depends = depends;\n\t\t// Store the binding.\n\t\tbindingStore[bindId] = binding; // Note: If this corresponds to a data-linked tag, we are replacing the\n\t\t// temporarily stored tag by the stored binding. The tag will now be at binding.linkCtx.tag\n\n\t\tif (linkedElems || cvtBk !== undefined || tag && tag.bindTo) {\n\t\t\tdefineBindToDataTargets(binding, tag, cvtBk);\n\t\t}\n\t\tif (linkedElems) {\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tk = linkedElem && linkedElem.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tif (linkedElem[k]._jsvLkEl) {\n\t\t\t\t\t\tif (!linkedElem[k]._jsvBnd) {\n\t\t\t\t\t\t\tlinkedElem[k]._jsvBnd = \"&\" + bindId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\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}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlinkedElem[k]._jsvLkEl = tag;\n\t\t\t\t\t\tbindLinkedElChange(tag, linkedElem[k]);\n\t\t\t\t\t\tlinkedElem[k]._jsvBnd = \"&\" + bindId + \"+\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (cvtBk !== undefined) {\n\t\t\tbindLinkedElChange(tag, target);\n\t\t}\n\n\t\tif (tag && !tag.inline) {\n\t\t\tif (!tag.flow) {\n\t\t\t\ttarget.setAttribute(jsvAttrStr, (target.getAttribute(jsvAttrStr)||\"\") + \"#\" + bindId + \"^/\" + bindId + \"^\");\n\t\t\t}\n\t\t\ttag._tgId = \"\" + bindId;\n\t\t}\n\t}\n}\n\n//-------\n// $.link\n//-------\n\nfunction lateLink(late) {\n\t// Do any deferred linking (lateRender)\n\tvar lnkCtx;\n\tif (late) {\n\t\twhile (lnkCtx = late.pop()) {\n\t\t\tlnkCtx._hdl();\n\t\t}\n\t}\n}\n\nfunction tmplLink(to, from, context, noIteration, parentView, prevNode, nextNode) {\n\treturn $link(this, to, from, context, noIteration, parentView, prevNode, nextNode);\n}\n\nfunction $link(tmplOrLinkExpr, to, from, context, noIteration, parentView, prevNode, nextNode) {\n\t// When linking from a template, prevNode and nextNode parameters are ignored\n\tif (context === true) {\n\t\tnoIteration = context; // passing boolean as third param - noIteration\n\t\tcontext = undefined;\n\t} else if (typeof context !== \"object\") {\n\t\tcontext = undefined; // context must be a boolean (noIteration) or a plain object\n\t} else {\n\t\tcontext = $extend({}, context);\n\t}\n\tif (tmplOrLinkExpr && to) {\n\t\tto = to.jquery ? to : $(to); // to is a jquery object or an element or selector\n\n\t\tif (!activeBody) {\n\t\t\tactiveBody = document.body;\n\t\t\tuseInput = \"oninput\" in activeBody;\n\t\t\t$(activeBody)\n\t\t\t\t.on(elementChangeStr, onElemChange)\n\t\t\t\t.on('blur.jsv', '[contenteditable]', onElemChange);\n\t\t}\n\n\t\tvar i, k, html, vwInfos, view, placeholderParent, targetEl, refresh, late, prntView,\n\t\t\tonRender = addBindingMarkers,\n\t\t\treplaceMode = context && context.target === \"replace\",\n\t\t\tl = to.length;\n\n\t\twhile (l--) { // iterate over 'to' targets. (Usually one, but can be multiple)\n\t\t\ttargetEl = to[l];\n\n\t\t\tprntView = parentView || $view(targetEl);\n\t\t\tif (typeof tmplOrLinkExpr === STRING) {\n\t\t\t\t// tmplOrLinkExpr is a string: treat as data-link expression.\n\t\t\t\taddDataBinding(late = [], tmplOrLinkExpr, targetEl, prntView, undefined, \"expr\", from, context);\n\t\t\t} else {\n\t\t\t\tif (tmplOrLinkExpr.markup !== undefined) {\n\t\t\t\t\t// This is a call to template.link()\n\t\t\t\t\tif (replaceMode) {\n\t\t\t\t\t\tplaceholderParent = targetEl.parentNode;\n\t\t\t\t\t}\n\t\t\t\t\tprntView._.scp = true; // Set scope flag on prntView for link() call - used to set view.isTop for outermost view of created linked content\n\t\t\t\t\thtml = tmplOrLinkExpr.render(from, context, noIteration, prntView, undefined, onRender, true);\n\t\t\t\t\tprntView._.scp = undefined;\n\t\t\t\t\t// TODO Consider finding a way to bind data (link) within template without html being different for each view, the HTML can\n\t\t\t\t\t// be evaluated once outside the while (l--), and pushed into a document fragment, then cloned and inserted at each target.\n\n\t\t\t\t\tif (placeholderParent) {\n\t\t\t\t\t\t// This is target=\"replace\" mode\n\t\t\t\t\t\tprevNode = targetEl.previousSibling;\n\t\t\t\t\t\tnextNode = targetEl.nextSibling;\n\t\t\t\t\t\t$.cleanData([targetEl], true);\n\t\t\t\t\t\tplaceholderParent.removeChild(targetEl);\n\n\t\t\t\t\t\ttargetEl = placeholderParent;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprevNode = nextNode = undefined; // When linking from a template, prevNode and nextNode parameters are ignored\n\t\t\t\t\t\t$(targetEl).empty();\n\t\t\t\t\t}\n\t\t\t\t} else if (tmplOrLinkExpr === true && prntView === topView) {\n\t\t\t\t\t// $.link(true, selector, data, ctx) - where selector points to elem in top-level content. (If not top-level content, no-op)\n\t\t\t\t\trefresh = {lnk: \"top\"};\n\t\t\t\t} else {\n\t\t\t\t\tbreak; // no-op - $.link(true, selector, data, ctx) targeting within previously linked rendered template\n\t\t\t\t}\n\n// TODO Consider deferred linking API feature on per-template basis - {@{ instead of {^{ which allows the user to see the rendered content\n// before that content is linked, with better perceived perf. Have view.link return a deferred, and pass that to onAfterLink...\n// or something along those lines.\n// setTimeout(function() {\n\n\t\t\t\tif (targetEl._df && !nextNode) {\n\t\t\t\t\t// We are inserting new content and the target element has some deferred binding annotations,and there is no nextNode.\n\t\t\t\t\t// Those views may be stale views (that will be recreated in this new linking action) so we will first remove them\n\t\t\t\t\t// (if not already removed).\n\t\t\t\t\tvwInfos = viewInfos(targetEl._df, true, rOpenViewMarkers);\n\n\t\t\t\t\tfor (i = 0, k = vwInfos.length; i < k; i++) {\n\t\t\t\t\t\tview = vwInfos[i];\n\t\t\t\t\t\tif ((view = viewStore[view.id]) && view.data !== undefined) {\n\t\t\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t\t\t// - unless view.data is undefined, in which case it is already being removed\n\t\t\t\t\t\t\tview.parent.removeViews(view._.key, undefined, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsetDefer(targetEl); // remove defer tokens\n\t\t\t\t}\n\n\t\t\t\t// Link the content of the element, since this is a call to template.link(), or to $(el).link(true, ...),\n\t\t\t\tlate = prntView.link(from, targetEl, prevNode, nextNode, html, refresh, context);\n//});\n\t\t\t}\n\t\t\tlateLink(late); // Do any deferred linking (lateRender)\n\t\t}\n\t}\n\treturn to; // Allow chaining, to attach event handlers, etc.\n}\n\n//----------\n// view.link\n//----------\n\nfunction viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, context, validateOnly) {\n\t// Optionally insert HTML into DOM using documentFragments (and wrapping HTML appropriately).\n\t// Data-link existing contents of parentNode, or the inserted HTML, if provided\n\n\t// Depending on the content model for the HTML elements, the standard data-linking markers inserted in the HTML by addBindingMarkers during\n\t// template rendering will be converted either to script marker nodes or, for element-only content sections, to data-jsv element annotations.\n\n\t// Data-linking will then add _prv and _nxt to views, where:\n\t// _prv: References the previous node (script element of type \"jsv123\"), or (for elCnt=true), the first element node in the view (or if none, set _prv = _nxt)\n\t// _nxt: References the last node (script element of type \"jsv/123\"), or (for elCnt=true), the next element node after the view.\n\n\t//==== nested functions ====\n\tfunction convertMarkers(all, preceding, selfClose, closeTag, spaceBefore, id, boundId, spaceAfter, tag1, tag2, closeTag2, spaceAfterClose, selfClose2, endOpenTag) {\n\t\t// rConvertMarkers = /(^|(\\/>)|<\\/(\\w+)>|)(\\s*)([#/]\\d+(?:_|(\\^)))`(\\s*)(<\\w+(?=[\\s\\/>]))?|\\s*(?:(<\\w+(?=[\\s\\/>]))|<\\/(\\w+)>(\\s*)|(\\/>)\\s*|(>))/g,\n\t\t// prec, slfCl, clsTag, spBefore, id, bndId spAfter,tag1, tag2, clTag2,sac slfCl2, endOpenTag\n\t\t// Convert the markers that were included by addBindingMarkers in template output, to appropriate DOM annotations:\n\t\t// data-jsv attributes (for element-only content) or script marker nodes (within phrasing or flow content).\n\n// TODO consider detecting 'quoted' contexts (attribute strings) so that attribute encoding does not need to encode >\n// Currently rAttrEncode = /[><\"'&]/g includes '>' encoding in order to avoid erroneous parsing of <span title=\"<a/>\"></span>\">\n\t\tvar errorMsg, bndId,\n\t\t\tendOfElCnt = \"\";\n\t\tif (endOpenTag) {\n\t\t\tinTag = 0;\n\t\t\treturn all;\n\t\t}\n\t\ttag = (tag1 || tag2 || \"\").toLowerCase();\n\t\tcloseTag = closeTag || closeTag2;\n\t\tselfClose = selfClose || selfClose2;\n\t\tif (isVoid && !selfClose && (!all || closeTag || tag || id && !inTag)) { // !all = end of string\n\t\t\tisVoid = undefined;\n\t\t\tparentTag = tagStack.shift(); // preceding tag was a void element, with no closing slash, such as <br>.\n\t\t}\n\t\tcloseTag = closeTag || selfClose;\n\t\tif (closeTag) {\n\t\t\tcloseTag = closeTag.toLowerCase();\n\t\t\tinTag = 0;\n\t\t\tisVoid = undefined;\n\t\t\t// TODO: smart insertion of <tbody> - to be completed for robust insertion of deferred bindings etc.\n\t\t\t//if (closeTag === \"table\" && parentTag === \"tbody\") {\n\t\t\t//\tpreceding = \"</tbody>\" + preceding;\n\t\t\t//\tparentTag = \"table\";\n\t\t\t//\ttagStack.shift();\n\t\t\t//}\n\t\t\tif (validate) {\n\t\t\t\tif (selfClose || selfClose2) {\n\t\t\t\t\tif (!voidElems[parentTag] && !/;svg;|;math;/.test(\";\" + tagStack.join(\";\") + \";\")) {\n\t\t\t\t\t\t// Only self-closing elements must be legitimate void elements, such as <br/>, per HTML schema,\n\t\t\t\t\t\t// or under svg or math foreign namespace elements.\n\t\t\t\t\t\terrorMsg = \"'<\" + parentTag + \".../\";\n\t\t\t\t\t}\n\t\t\t\t} else if (voidElems[closeTag]) {\n\t\t\t\t\terrorMsg = \"'</\" + closeTag; // closing tag such as </input>\n\t\t\t\t} else if (!tagStack.length || closeTag !== parentTag) {\n\t\t\t\t\terrorMsg = \"Mismatch: '</\" + closeTag;\n\t\t\t\t}\n\t\t\t\tif (errorMsg) {\n\t\t\t\t\tsyntaxError(errorMsg + \">' in:\\n\" + html);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n\t\t\tparentTag = tagStack.shift();\n\t\t\telCnt = elContent[parentTag];\n\t\t\tcloseTag2 = closeTag2 ? (\"</\" + closeTag2 + \">\") : \"\";\n\t\t\tif (prevElCnt) {\n\t\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\t\tdefer += ids;\n\t\t\t\tids = \"\";\n\t\t\t\tif (!elCnt) {\n\t\t\t\t\tendOfElCnt = closeTag2 + openScript + \"@\" + defer + closeScript + (spaceAfterClose || \"\");\n\t\t\t\t\tdefer = deferStack.shift();\n\t\t\t\t} else {\n\t\t\t\t\tdefer += \"-\"; // Will be used for stepping back through deferred tokens\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (elCnt && !inTag) {\n\t\t\t// elContent maps tagNames which have only element content, so may not support script nodes.\n\t\t\t// We are in element-only content, can remove white space, and use data-jsv attributes on elements as markers\n\t\t\t// Example: <tr data-jsv=\"/2_#6_\"> - close marker for view 2 and open marker for view 6\n\n\t\t\tif (id) {\n\t\t\t\t// append marker for this id, to ids string\n\t\t\t\tids += id;\n\t\t\t} else {\n\t\t\t\tpreceding = (closeTag2 || selfClose2 || \"\");\n\t\t\t}\n\t\t\tif (tag) {\n\t\t\t\t// TODO: smart insertion of <tbody> - to be completed for robust insertion of deferred bindings etc.\n\t\t\t\t//if (tag === \"<tr\" && parentTag === \"table\") {\n\t\t\t\t//\ttagStack.unshift(parentTag);\n\t\t\t\t//\tparentTag = \"tbody\";\n\t\t\t\t//\tpreceding += \"<\" + parentTag + \">\";\n\t\t\t\t//\tif (defer) {\n\t\t\t\t//\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t\t//\t}\n\t\t\t\t//\t// TODO: move this to design-time validation check\n\t\t\t\t//\t//\terror('\"' + parentTag + '\" has incorrect parent tag');\n\t\t\t\t//}\n\t\t\t\tpreceding += tag;\n\t\t\t\tif (ids) {\n\t\t\t\t\tpreceding += ' ' + jsvAttrStr + '=\"' + ids + '\"';\n\t\t\t\t\tids = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// We are in phrasing or flow content, so use script marker nodes\n\t\t\t// Example: <script type=\"jsv3/\"></script> - 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// \"<table {{if ...}}...{{/if}}... >\" or \"<table {{if ...}}...> ...{{/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 <tbody>\n\t\t\t\t// TODO: replace this by smart insertion of <tbody> tags\n\t\t\t\terror('Parent of <tr> must be <tbody>');\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 <span> as child of <tr>, 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? (typeof parentNode === STRING\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. <input data-link=\"{:firstName:} title{>~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}\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(typeof node === STRING\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 = typeof trig === STRING ? 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. <input data-link=\"~wd\"/> 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, select2) {\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 select2\t\t\t\t\t\t\t// select2 is optional selector for an additional filtering. e.g checkboxgroup with\n\t\t\t? nodes.filter(select2)\t\t// selector for binding to subset of checkbox <input> elements\n\t\t\t: 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 (typeof key === STRING) {\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(forOrIfTagCtx, linkCtx, eventArgs, ev) {\n\t\t\t// domChange notification support, called by {^{for}}, onArrayChange, {^{if}} onAfterLink etc.\n\t\t\tvar bindId, linkTag, view, elem,\n\t\t\t\ttag = theTag,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\",\n\t\t\t\trSplitBindings = /&(\\d+)\\+?/g,\n\t\t\t\ttagParElem = tag.parentElem,\n\t\t\t\thasListener = $._data(tagParElem).events;\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// If the parent element of this tag has a 'jsv-domchange' event handler binding, we will trigger it.\n\t\t\t\t// e.g. <ul data-link=\"{on 'jsv-domchange' ~root.domchange}\">, or <select data-link=\"selected\">...\n\t\t\t\t$(tagParElem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t\twhile (tagParElem !== activeBody) { // Step up through inline tags, whether unlinked, or data-linked with same 'tagParElem' parentElem\n\t\t\t\twhile (tag && (!tag.parentElem || tag.parentElem === tagParElem)) {\n\t\t\t\t\tif (tag.onDomChange) { // If inline tag has an onDomChange method, invoke it\n\t\t\t\t\t\ttag.onDomChange(tagCtx, linkCtx, eventArgs, ev);\n\t\t\t\t\t}\n\t\t\t\t\tview = tag.tagCtx.view || topView;\n\t\t\t\t\ttag = view.tag;\n\t\t\t\t\twhile (!tag && view.parent && !view.isTop) { // Step up through parent views, and find next parent tag\n\t\t\t\t\t\tview = view.parent;\n\t\t\t\t\t\ttag = view.tag;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telem = tagParElem; // We will step through elements from the parentElem of the previous tag\n\t\t\t\ttagParElem = tag && tag.parentElem || activeBody; // We will stop on element inside the parentElem of the next tag\n\t\t\t\twhile (elem && elem !== tagParElem) { // Step up through parentElements\n\t\t\t\t\twhile (bindId = rSplitBindings.exec(elem._jsvBnd)) { // Step through linked tag bindings on this elem (_jsvBnd has syntax: \"&bindingId1&bindingId2\")\n\t\t\t\t\t\tif (linkTag = bindingStore[bindId[1]]) {\n\t\t\t\t\t\t\tlinkTag = linkTag.linkCtx.tag;\n\t\t\t\t\t\t\tif (linkTag && linkTag.onDomChange) { // If linked tag has an onDomChange method, invoke it\n\t\t\t\t\t\t\t\tlinkTag.onDomChange(tagCtx, linkCtx, eventArgs, ev);\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\telem = elem.parentElement;\n\t\t\t\t}\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 (; i<l && !$isFunction(args[i]); i++); // Handler is first arg of type function\n\t\t\ttag._hi = l>i && 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 <button> element\n\t\t\t\t\t// (Otherwise we will attach the handler to the element content after data-linking)\n\t\t\t\t\ttag.template = \"<button>\" + (content || tagCtx.params.args[i] || \"noop\") + \"</button>\";\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 <button>. Make it the mainElem, so we can set id, size or class\n\t\t\t\tthis.mainElem = this.contents(\"button\");\n\t\t\t}\n\t\t},\n\t\tonAfterLink: function(tagCtx, linkCtx) {\n\t\t\tvar handler, params, find, activeElem,\n\t\t\t\ttag = this,\n\t\t\t\ti = tag._hi,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length,\n\t\t\t\tprops = tagCtx.props,\n\t\t\t\tdata = props.data,\n\t\t\t\tview = tagCtx.view,\n\t\t\t\tcontextOb = props.context; // Context ('this' pointer) for attached handler\n\n\t\t\tif (i) { // There is a handler\n\t\t\t\thandler = args[i-1];\n\t\t\t\tparams = args.slice(i); // Subsequent args are params\n\t\t\t\targs = args.slice(0, i-1); // Preceding args (if any) are events and selector\n\t\t\t\ttag._sel = args[1]; // Selector for descendant elements - for delegated events on those elements, delegating to the activeElem\n\n\t\t\t\tactiveElem = tag.activeElem = tag.activeElem || $(tag.inline\n\t\t\t\t\t? (tag._sel = args[1] || \"*\", tag.parentElem)\n\t\t\t\t\t// If inline, attach to child elements of tag parent element (filtered by selector argument if provided.\n\t\t\t\t\t// (In handler we'll filter out events from sibling elements preceding or following tag.)\n\t\t\t\t\t// This allows us to use the delegated pattern where the attached event works even for added elements satisfying the selector\n\t\t\t\t\t: linkCtx.elem);\n\n\t\t\t\tif (!contextOb) {\n\t\t\t\t\t// Get the path for the preceding object (context object) of handler (which is the last arg), compile function\n\t\t\t\t\t// to return that context object, and run compiled function against data\n\t\t\t\t\tcontextOb = /^(.*)[.^][\\w$]+$/.exec(tagCtx.params.args.slice(-params.length - 1)[0]);\n\t\t\t\t\tcontextOb = contextOb && $sub.tmplFn(delimOpenChar1 + \":\" + contextOb[1] + delimCloseChar0, view.tmpl, true)(linkCtx.data, view, $sub);\n\t\t\t\t}\n\n\t\t\t\tif (tag._evs) {\n\t\t\t\t\ttag.onUnbind(tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\n\t\t\t\tactiveElem.on(\n\t\t\t\t\ttag._evs = args[0] || \"click\", // events defaults to \"click\"\n\t\t\t\t\ttag._sel,\n\t\t\t\t\tdata == undefined ? null : data,\n\t\t\t\t\ttag._hlr = function hndlr(ev) {\n\t\t\t\t\t\tvar nodes, length,\n\t\t\t\t\t\t\tfound = !tag.inline;\n\n\t\t\t\t\t\tif (!found) { // If inline, filter out events from sibling elements preceding or following tag.\n\t\t\t\t\t\t\tnodes = tag.contents(\"*\");\n\t\t\t\t\t\t\tl = nodes.length;\n\t\t\t\t\t\t\twhile (!found && l--) {\n\t\t\t\t\t\t\t\tif (nodes[l].contains(ev.target)) {\n\t\t\t\t\t\t\t\t\tfound = true;\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\tif (found) { // target elem is indeed within the tag, so call the {on} handler\n\t\t\t\t\t\t\treturn handler.apply(contextOb || linkCtx.data, [].concat(\n\t\t\t\t\t\t\t\tparams, // e.g. par1, par2\n\t\t\t\t\t\t\t\tev,\n\t\t\t\t\t\t\t\t{change: ev.type, view: view, linkCtx: linkCtx},\n\t\t\t\t\t\t\t\tparams.slice.call(arguments, 1) // If triggering event (e.g. jsv-domchange) has additional arguments after ev, pass them too\n\t\t\t\t\t\t\t));\n\t\t\t\t\t\t\t// for {on 'click' handler par1 par2} use handler(par1, par2, ev, domchangeEventArgs)\n\t\t\t\t\t\t\t// for {on 'jsv-domchange' handler par1 par2} use handler(par1, par2, ev, domchangeEventArgs, tagCtx, linkCtx, observableEventArgs)\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\tonUpdate: false,\n\t\tonArrayChange: false,\n\t\tonUnbind: function() {\n\t\t\tvar self = this,\n\t\t\t\toldIsCleanCall = isCleanCall;\n\t\t\tif (self.activeElem) {\n\t\t\t\tisCleanCall = 0; // Needed when using jquery-1.x, to avoid bug where jQuery calls cleanData on elements that are not being removed\n\t\t\t\tself.activeElem.off(self._evs, self._sel, self._hlr);\n\t\t\t\tisCleanCall = oldIsCleanCall;\n\t\t\t}\n\t\t},\n\t\tcontentCtx: true,\n\t\tsetSize: true,\n\t\tdataBoundOnly: true\n\t},\n\tradiogroup: {\n\t\tboundProps: [\"disabled\"],\n\t\tinit: function(tagCtx) {\n\t\t\tthis.name = tagCtx.props.name || (Math.random() + \"jsv\").slice(9);\n\t\t},\n\t\tonBind: function(tagCtx, linkCtx) {\n\t\t\tvar $linkedElem, l,\n\t\t\t\ttag = this,\n\t\t\t\tfilter = tagCtx.args[1], // args[1] is an optional selector to choose a filtered subset of radio buttons\n\t\t\t\tlinkExpr = tagCtx.params.args[0],\n\t\t\t\tpropParams = tagCtx.params.props,\n\t\t\t\tuseDisable = propParams && propParams.disabled;\n\n\t\t\tif (tag.inline) {\n\t\t\t\t$linkedElem = tag.contents(true, RADIOINPUT, filter);\n\t\t\t} else {\n\t\t\t\t$linkedElem = $(RADIOINPUT, linkCtx.elem);\n\t\t\t\tif (filter) {\n\t\t\t\t\t$linkedElem = $linkedElem.filter(filter); // Obtain filtered list of radio inputs\n\t\t\t\t}\n\t\t\t}\n\t\t\tl = $linkedElem.length;\n\t\t\twhile (l--) {\n\t\t\t\t// Configure the name for each radio input element\n\t\t\t\t$linkedElem[l].name = $linkedElem[l].name || tag.name;\n\t\t\t}\n\t\t\t// Data-link each checkbox input element using the checkboxgroup data-link expression\n\t\t\tfor (l in propParams) {\n\t\t\t\tlinkExpr += \" \" + l + \"=\" + propParams[l];\n\t\t\t}\n\t\t\t$linkedElem.link(linkExpr, linkCtx.data, undefined, undefined, linkCtx.view); // data-link the checkboxes\n\t\t\ttag.linkedElem = $linkedElem;\n\n\t\t\t// This onDomChange method is called by nested tags such as {^{for}} or {^{if}}, when DOM contents are changed\n\t\t\ttag.onDomChange = function(forOrIfTagCtx, linkCtx, eventArgs, ev) {\n\t\t\t\tvar linkedElem, l,\n\t\t\t\t\tval = tag.cvtArgs()[0];\n\n\t\t\t\ttag.linkedElem = $linkedElem = tag.contents(true, RADIOINPUT, filter); // Obtain updated (possibly filtered) list\n\t\t\t\tl = $linkedElem.length;\n\t\t\t\t// Contents may have changed so recreate $linkedElem for any additional radio button input elements\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Configure binding and name for each radio input element\n\t\t\t\t\tlinkedElem = $linkedElem[l];\n\t\t\t\t\tif (!linkedElem._jsvLkEl) {\n\t\t\t\t\t\t// This is a new inserted radio button, so we will data-link it based on the radiogroup binding\n\t\t\t\t\t\tlinkedElem.name = linkedElem.name || tag.name;\n\t\t\t\t\t\tlinkedElem._jsvLkEl = tag;\n\t\t\t\t\t\tlinkedElem._jsvBnd = \"&\" + tag._tgId + \"+\";\n\t\t\t\t\t\tlinkedElem.checked = val === linkedElem.value;\n\t\t\t\t\t\tif (useDisable) {\n\t\t\t\t\t\t\tlinkedElem.disabled = !!tagCtx.props.disabled;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$.link(linkExpr, linkedElem, linkCtx.data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tonAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) {\n\t\t\tvar propParams = tagCtx.params.props;\n\t\t\tif (propParams && propParams.disabled) {\n\t\t\t\tthis.linkedElem.prop(\"disabled\", !!tagCtx.props.disabled);\n\t\t\t}\n\t\t},\n\t\tflow: true,\n\t\tonUpdate: false, // don't rerender\n\t\tcontentCtx: true,\n\t\tdataBoundOnly: true\n\t},\n\tcheckboxgroup: {\n\t\tboundProps: [\"disabled\"],\n\t\tinit: function(tagCtx) {\n\t\t\tthis.name = tagCtx.props.name || (Math.random() + \"jsv\").slice(9);\n\t\t},\n\t\tonBind: function(tagCtx, linkCtx) {\n\t\t\tvar $linkedElem, l,\n\t\t\t\ttag = this,\n\t\t\t\tfilter = tagCtx.args[1], // args[1] is an optional selector to choose a filtered subset of checkboxes\n\t\t\t\tlinkExpr = tagCtx.params.args[0],\n\t\t\t\tpropParams = tagCtx.params.props,\n\t\t\t\tuseDisable = propParams && propParams.disabled;\n\n\t\t\tif (tag.inline) {\n\t\t\t\t$linkedElem = tag.contents(true, CHECKBOXINPUT, filter); // Obtain (optionally filtered) list of checkbox elements\n\t\t\t} else {\n\t\t\t\ttag.lateRender = true;\n\t\t\t\t$linkedElem = $(CHECKBOXINPUT, linkCtx.elem); // Obtain list of checkbox inputs\n\t\t\t\tif (filter) {\n\t\t\t\t\t$linkedElem = $linkedElem.filter(filter); // Filter the list\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Configure the name for each checkbox input element\n\t\t\tl = $linkedElem.length;\n\t\t\twhile (l--) {\n\t\t\t\t$linkedElem[l].name = $linkedElem[l].name || tag.name;\n\t\t\t\t$linkedElem[l]._jsvLkEl = tag;\n\t\t\t}\n\t\t\t// Data-link each checkbox input element using the checkboxgroup data-link expression\n\t\t\tfor (l in propParams) {\n\t\t\t\tlinkExpr += \" \" + l + \"=\" + propParams[l];\n\t\t\t}\n\t\t\t$linkedElem.link(linkExpr, linkCtx.data, undefined, undefined, linkCtx.view); // data-link the checkboxes\n\t\t\ttag.linkedElem = $linkedElem;\n\n\t\t\t// This onDomChange method is called by nested tags such as {^{for}} or {^{if}}, when DOM contents are changed\n\t\t\ttag.onDomChange = function(forOrIfTagCtx, linkCtx, eventArgs, ev) {\n\t\t\t\tvar linkedElem,\n\t\t\t\t\t$linkedElem = tag.contents(true, CHECKBOXINPUT, filter), // Obtain updated (possibly filtered) list\n\t\t\t\t\tl = $linkedElem.length;\n\t\t\t\t// Contents may have changed so recreate $linkedElem for any additional checkbox input elements\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Configure binding and name for each checkbox input element\n\t\t\t\t\tlinkedElem = $linkedElem[l];\n\t\t\t\t\tif (useDisable) {\n\t\t\t\t\t\tlinkedElem.disabled = !!tagCtx.props.disabled;\n\t\t\t\t\t}\n\t\t\t\t\tif (!linkedElem._jsvSel) {\n\t\t\t\t\t\t// This is a new inserted checkbox, so we will data-link it based on the checkboxgroup binding\n\t\t\t\t\t\tlinkedElem.name = linkedElem.name || tag.name;\n\t\t\t\t\t\t$.link(linkExpr, linkedElem, linkCtx.data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tonAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) {\n\t\t\tvar propParams = tagCtx.params.props;\n\t\t\tif (propParams && propParams.disabled) {\n\t\t\t\tthis.contents(true, CHECKBOXINPUT, tagCtx.args[1]).prop(\"disabled\", !!tagCtx.props.disabled);\n\t\t\t\t// args[1] is an optional selector to choose filtered subset of checkboxes\n\t\t\t}\n\t\t},\n\t\tflow: true,\n\t\tonUpdate: false, // don't rerender\n\t\tcontentCtx: true,\n\t\tdataBoundOnly: true\n\t}\n});\n\n$extend($tags[\"for\"], {\n\t//onUpdate: function(ev, eventArgs, newTagCtxs) {\n\t\t//Consider adding filtering for perf optimization. However the below prevents update on some scenarios which _should_ update - namely when there is another array on which for also depends.\n\t\t//var i, l, tci, prevArg;\n\t\t//for (tci = 0; (prevArg = this.tagCtxs[tci]) && prevArg.args.length; tci++) {\n\t\t//\tif (prevArg.args[0] !== newTagCtxs[tci].args[0]) {\n\t\t//\t\treturn true;\n\t\t//\t}\n\t\t//}\n\t\t//return false;\n\t//},\n\tsortDataMap: $views.map({\n\t\tgetTgt: $tags[\"for\"].sortDataMap.getTgt, // getTargetSorted\n\t\tobsSrc: function(map, ev, eventArgs) {\n\t\t\tmap.update(); // refresh sorting and filtering\n\t\t},\n\t\tobsTgt: function(map, ev, eventArgs) {\n\t\t\tvar l,\n\t\t\t\titems = eventArgs.items,\n\t\t\t\tsource = map.src;\n\t\t\tif (eventArgs.change === \"remove\") {\n\t\t\t\tl = items.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t$observable(source).remove($inArray(items[l], source));\n\t\t\t\t}\n\t\t\t} else if (eventArgs.change === \"insert\") {\n\t\t\t\t$observable(source).insert(items);\n\t\t\t}\n\t\t}\n\t}),\n\tmapProps: [\"filter\", \"sort\", \"reverse\", \"start\", \"end\", \"step\"],\n\tbindTo: [\"paged\", \"sorted\"],\n\tbindFrom: [0],\n\n\tonArrayChange: function(ev, eventArgs, tagCtx, linkCtx) {\n\t\tvar arrayView, propsArr,\n\t\t\ttargetLength = ev.target.length,\n\t\t\ttag = this;\n\t\tif (!tag.rendering) {\n\t\t\tif (tag._.noVws // Child views not supported because target is not html - e.g. data-link=\"title{for ...}\"\n\t\t\t\t|| tag.tagCtxs[1] && ( // There is an {{else}}\n\t\t\t\t\teventArgs.change === \"insert\" && targetLength === eventArgs.items.length // inserting, and new length is same as inserted length, so going from 0 to n\n\t\t\t\t\t|| eventArgs.change === \"remove\" && !targetLength) // removing, and new length 0, so going from n to 0\n\t\t\t\t) {\n\t\t\t\tpropsArr = tagCtx.map && tagCtx.map.propsArr; // Used by {{props}}, which derives from {{for}}\n\t\t\t\ttag.refresh();\n\t\t\t\tif (propsArr) {\n\t\t\t\t\ttagCtx.map.propsArr = propsArr; // Keep previous propsArr with new map\n\t\t\t\t}\n\t\t\t} else for (arrayView in tag._.arrVws) {\n\t\t\t\tarrayView = tag._.arrVws[arrayView];\n\t\t\t\tif (arrayView.data === ev.target) {\n\t\t\t\t\tarrayChangeHandler.apply(arrayView, arguments);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttag.domChange(tagCtx, linkCtx, eventArgs, ev); // Call onDomChange method on ancestors such as checkboxgroup, to notify new content\n\t\tev.done = true;\n\t},\n\tonUpdate: function(ev, eventArgs, tagCtxs) {\n\t\tthis.setDataMap(tagCtxs);\n\t},\n\tonBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) {\n\t\tvar data,\n\t\t\ttag = this,\n\t\t\ti = 0,\n\t\t\tarrayBindings = tag._ars = tag._ars || {},\n\t\t\ttagCtxs = tag.tagCtxs,\n\t\t\tl = tagCtxs.length,\n\t\t\tselected = tag.selected || 0;\n\n\t\tfor (; i <= selected; i++) {\n\t\t\ttagCtx = tagCtxs[i]; // loop through tagCtxs up to selected\n\t\t\tdata = tagCtx.map\n\t\t\t\t? tagCtx.map.tgt // 'data' is mapped data\n\t\t\t\t: tagCtx.args.length\n\t\t\t\t\t? tagCtx.args[0] // or args[0]\n\t\t\t\t\t: tagCtx.view.data; // or defaults to current data.\n\t\t\tif (arrayBindings[i]) { // Is there was a previous binding on this tagCtx, (maybe with data different from new data)\n\t\t\t\t$observe(arrayBindings[i], true); //unobserve previous array\n\t\t\t\tdelete arrayBindings[i];\n\t\t\t}\n\t\t\tif (!arrayBindings[i] && $isArray(data)) {\n\t\t\t\t(function() {\n\t\t\t\t\tvar tagCt = tagCtx;\n\t\t\t\t\t$observe(data, arrayBindings[i] = function(ev, eventArgs) { // Store arrayChangeHandler on tag._ars[i]\n\t\t\t\t\t\ttag.onArrayChange(ev, eventArgs, tagCt, linkCtx);\n\t\t\t\t\t});\n\t\t\t\t})();\n\t\t\t}\n\t\t}\n\t\tfor (i = selected + 1; i < l; i++) { // If there were previous bindings on later tagCtxs, remove them\n\t\t\tif (arrayBindings[i]) {\n\t\t\t\t$observe(arrayBindings[i], true); //unobserve previous binding\n\t\t\t\tdelete arrayBindings[i];\n\t\t\t}\n\t\t}\n\t\tif (eventArgs) {\n\t\t\ttag.domChange(tagCtx, linkCtx, eventArgs, ev); // Call onDomChange method on ancestors such as checkboxgroup, to notify new content\n\t\t}\n\t},\n\tonAfterLink: function() {\n\t\tvar data, map, props, tagCtx,\n\t\t\ttag = this,\n\t\t\ti = 0,\n\t\t\ttagCtxs = tag.tagCtxs,\n\t\t\tl = tagCtxs.length,\n\t\t\tselected = tag.selected || 0;\n\n\t\tfor (; i <= selected; i++) {\n\t\t\ttagCtx = tagCtxs[i]; // loop through tagCtxs up to selected\n\t\t\tmap = tagCtx.map;\n\t\t\tdata = tagCtx.map\n\t\t\t\t? map.tgt // 'data' is mapped data\n\t\t\t\t: tagCtx.args.length\n\t\t\t\t\t? tagCtx.args[0] // or args[0]\n\t\t\t\t\t: tagCtx.view.data; // or defaults to current data.\n\t\t\tif ($isArray(data) && (props = tagCtx.params.props)) {\n\t\t\t\tif (props.paged && !tag.paged) {\n\t\t\t\t\t$.observable(tag).setProperty(\"paged\", data.slice());\n\t\t\t\t\ttag.updateValue(tag.paged, 0, i, true); // Update paged (async, to wait until parent tag has been datalinked)\n\t\t\t\t}\n\t\t\t\tif (props.sorted && !tag.sorted) {\n\t\t\t\t\t$.observable(tag).setProperty(\"sorted\", map && map.sorted || data.slice());\n\t\t\t\t\ttag.updateValue(tag.sorted, 1, i, true); // Update sorted (async, to wait until parent tag has been datalinked)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tonDispose: function() {\n\t\tvar l, tag = this;\n\t\tfor (l in tag._ars) {\n\t\t\t$observe(tag._ars[l], true); //unobserve\n\t\t}\n\t}\n});\n\n$extend($tags[\"if\"], {\n\tonUpdate: function(ev, eventArgs, newTagCtxs) {\n\t\tvar prevArg, different,\n\t\t\ttci = 0;\n\t\tfor (; (prevArg = this.tagCtxs[tci]); tci++) {\n\t\t\tdifferent = prevArg.props.tmpl !== newTagCtxs[tci].props.tmpl || prevArg.args.length && !(prevArg = prevArg.args[0]) !== !newTagCtxs[tci].args[0];\n\t\t\tif ((!this.convert && !!prevArg) || different) {\n\t\t\t\treturn different;\n\t\t\t\t// If there is not a change of template, and there is no converter, and newArg and prevArg are both truthy, return false to cancel update.\n\t\t\t\t// (Even if values on later elses are different, we still don't want to update, since rendered output would be unchanged)\n\t\t\t\t// If newArg and prevArg are different, return true, to update\n\t\t\t\t// If newArg and prevArg are both falsey, move to the next {{else ...}}\n\t\t\t}\n\t\t}\n\t\t// Boolean value of all args are unchanged (falsey), so return false to cancel update\n\t\treturn false;\n\t},\n\tonAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) {\n\t\tif (eventArgs) {\n\t\t\tthis.domChange(tagCtx, linkCtx, eventArgs, ev); // Call onDomChange method on ancestors such as checkboxgroup, to notify new content\n\t\t}\n\t}\n});\n\nfunction observeProps(map, ev, eventArgs) {\n\tvar target, l, props = map.options.props;\n\tupdatePropsArr(map.propsArr, eventArgs.path, eventArgs.value, eventArgs.remove);\n\tif (props.sort !== undefined || props.start !== undefined || props.end !== undefined || props.step !== undefined || props.filter || props.reverse) {\n\t\tmap.update(); // refresh sorting and filtering\n\t} else if (eventArgs.change === \"set\") {\n\t\ttarget = map.tgt;\n\t\tl = target.length;\n\t\twhile (l-- && target[l].key !== eventArgs.path) {}\n\t\tif (l === -1) {\n\t\t\tif (eventArgs.path && !eventArgs.remove) {\n\t\t\t\t$observable(target).insert({key: eventArgs.path, prop: eventArgs.value});\n\t\t\t}\n\t\t} else if (eventArgs.remove) {\n\t\t\t$observable(target).remove(l);\n\t\t} else {\n\t\t\t$observable(target[l]).setProperty(\"prop\", eventArgs.value);\n\t\t}\n\t}\n}\n\nfunction observeMappedProps(map, ev, eventArgs) {\n\tvar items, l, key, remove,\n\t\tsource = map.src,\n\t\tchange = eventArgs.change;\n\n\tif (change === \"set\") {\n\t\tif (eventArgs.path === \"prop\") {\n\t\t\t$observable(source).setProperty(ev.target.key, eventArgs.value);\n\t\t} else { // path === \"key\"\n\t\t\t$observable(source).removeProperty(eventArgs.oldValue); // When key is modified observably, remove old one and set new one\n\t\t\t$observable(source).setProperty(eventArgs.value, ev.target.prop);\n\t\t}\n\t} else if (change === \"insert\" || (remove = change === \"remove\")) {\n\t\titems = eventArgs.items;\n\t\tl = items.length;\n\t\twhile (l--) {\n\t\t\tif (key = items[l].key) {\n\t\t\t\tupdatePropsArr(map.propsArr, key, items[l].prop, remove);\n\t\t\t\tif (remove) {\n\t\t\t\t\t$observable(source).removeProperty(key);\n\t\t\t\t\tdelete source[key];\n\t\t\t\t} else {\n\t\t\t\t\t$observable(source).setProperty(key, items[l].prop);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction updatePropsArr(propsArr, key, prop, remove) {\n\tvar l = propsArr.length;\n\twhile (l-- && propsArr[l].key !== key) {}\n\tif (l === -1) {\n\t\tif (key && !remove) {\n\t\t\tpropsArr.push({key: key, prop: prop});\n\t\t}\n\t} else if (remove) {\n\t\tpropsArr.splice(l, 1);\n\t}\n}\n\nfunction shallowArrayFilter(path /*, object, parentObs*/) { // Filter used by {{props}} for the mappedProps target array\n\treturn rShallowArrayPath.test(path); // No '.' in path\n}\n\n$tags(\"props\", {\n\tbaseTag: \"for\",\n\tdataMap: $views.map({\n\t\tgetTgt: $tags.props.dataMap.getTgt, // getTargetProps\n\t\tobsSrc: observeProps,\n\t\tobsTgt: observeMappedProps,\n\t\ttgtFlt: shallowArrayFilter\n\t}),\n\tflow: true\n});\n\n//========================\n// Extend jQuery namespace\n//========================\n\n$extend($, {\n\n\t//=======================\n\t// jQuery $.view() plugin\n\t//=======================\n\n\tview: $view = function(node, inner, type) {\n\t\t// $.view() returns top view\n\t\t// $.view(node) returns view that contains node\n\t\t// $.view(selector) returns view that contains first selected element\n\t\t// $.view(nodeOrSelector, type) returns nearest containing view of given type\n\t\t// $.view(nodeOrSelector, \"root\") returns root containing view (child of top view)\n\t\t// $.view(nodeOrSelector, true, type) returns nearest inner (contained) view of given type\n\n\t\tfunction getInnerView(nd, isVl) {\n\t\t\tif (nd) {\n\t\t\t\tvwInfos = viewInfos(nd, isVl, rOpenViewMarkers);\n\t\t\t\tfor (j = 0, k = vwInfos.length; j < k; j++) {\n\t\t\t\t\tif ((view = viewStore[vwInfos[j].id]) && (view = view && type ? view.get(true, type) : view)) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (inner !== !!inner) {\n\t\t\t// inner not boolean, so this is view(nodeOrSelector, type)\n\t\t\ttype = inner;\n\t\t\tinner = undefined;\n\t\t}\n\t\tvar view, vwInfos, i, j, k, l, elems,\n\t\t\tlevel = 0,\n\t\t\tbody = document.body;\n\n\t\tif (node && node !== body && topView._.useKey > 1) {\n\t\t\t// Perf optimization for common cases\n\n\t\t\tnode = typeof node === STRING\n\t\t\t\t? $(node)[0]\n\t\t\t\t: node.jquery\n\t\t\t\t\t? node[0]\n\t\t\t\t\t: node;\n\n\t\t\tif (node) {\n\t\t\t\tif (inner) {\n\t\t\t\t\tgetInnerView(node._df, true);\n\t\t\t\t\tif (!view && node.tagName) { // Not a text node\n\t\t\t\t\t\t// Treat supplied node as a container element and return the first view encountered.\n\t\t\t\t\t\telems = qsa ? node.querySelectorAll(bindElsSel) : $(bindElsSel, node).get();\n\t\t\t\t\t\tl = elems.length;\n\t\t\t\t\t\tfor (i = 0; !view && i < l; i++) {\n\t\t\t\t\t\t\tgetInnerView(elems[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn view;\n\t\t\t\t}\n\t\t\t\twhile (node) {\n\t\t\t\t\t// Move back through siblings and up through parents to find preceding node which is a _prv (prevNode)\n\t\t\t\t\t// script marker node for a non-element-content view, or a _prv (first node) for an elCnt view\n\t\t\t\t\tif (vwInfos = viewInfos(node, undefined, rViewMarkers)) {\n\t\t\t\t\t\tl = vwInfos.length;\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tview = vwInfos[l];\n\t\t\t\t\t\t\tif (view.open) {\n\t\t\t\t\t\t\t\tif (level < 1) {\n\t\t\t\t\t\t\t\t\tview = viewStore[view.id];\n\t\t\t\t\t\t\t\t\treturn view && type ? view.get(type) : view || topView;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlevel--;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// level starts at zero. If we hit a view.close, then we move level to 1, and we don't return a view until\n\t\t\t\t\t\t\t\t// we are back at level zero (or a parent view with level < 0)\n\t\t\t\t\t\t\t\tlevel++;\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\tnode = node.previousSibling || node.parentNode;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn topView;\n\t},\n\n\tlink: $link,\n\tunlink: $unlink,\n\n\t//=====================\n\t// override $.cleanData\n\t//=====================\n\tcleanData: function(elems) {\n\t\tif (elems.length && isCleanCall) {\n\t\t\t// Remove JsViews bindings. Also, remove from the DOM any corresponding script marker nodes\n\t\t\tclean(elems);\n\t\t}\n\t\toldCleanData.apply($, arguments);\n\t}\n});\n\n// Possible future addition - e.g. for ckeditor tag control\n//$views.utility = {\n//\tvalidate: function(html) {\n//\t\ttry {\n//\t\t\ttopView.link(undefined, document.createElement(\"div\"), undefined, undefined, html, undefined, undefined, 1);\n//\t\t}\n//\t\tcatch (e) {\n//\t\t\treturn e.message;\n//\t\t}\n//\t}\n//};\n\n//===============================\n// Extend jQuery instance plugins\n//===============================\n\n$extend($.fn, {\n\tlink: function(expr, from, context, noIteration, parentView, prevNode, nextNode) {\n\t\treturn $link(expr, this, from, context, noIteration, parentView, prevNode, nextNode);\n\t},\n\tunlink: function() {\n\t\treturn $unlink(this);\n\t},\n\tview: function(inner, type) {\n\t\treturn $view(this[0], inner, type);\n\t}\n});\n\n//==============================================================================\n// Override jQuery methods that call our overridden cleanData, for disposal etc.\n//==============================================================================\n\n$.each([HTML, \"replaceWith\", \"empty\", \"remove\"], function(i, name) {\n\tvar oldFn = $.fn[name];\n\t$.fn[name] = function() {\n\t\tvar result;\n\t\tisCleanCall++; // Make sure cleanData does disposal only when coming from these calls.\n\t\ttry {\n\t\t\tresult = oldFn.apply(this, arguments);\n\t\t}\n\t\tfinally {\n\t\t\tisCleanCall--;\n\t\t}\n\t\treturn result;\n\t};\n});\n\n//===============\n// Extend topView\n//===============\n\n$extend(topView = $sub.topView, {tmpl: {links: {}}});\n\nviewStore = {0: topView}; // Top-level view\n\n//===================\n// Extend $.views.sub\n//===================\n\n$sub._glt = function(elem) { // get linked tags (Used in validate.js)\n\tvar linkCtx,\n\t\tregEx = /#(\\d*)\\^\\/\\1\\^/g,\n\t\tlinkCtxs = [],\n\t\ttokens = markerNodeInfo(elem);\n\n\twhile (linkCtx = regEx.exec(tokens)) {\n\t\tif (linkCtx = bindingStore[linkCtx[1]]) {\n\t\t\tlinkCtxs.push(linkCtx.linkCtx.tag);\n\t\t}\n\t}\n\treturn linkCtxs;\n};\n\n$sub._gccb = function(view) { // Return a callback for accessing the context of a template/data-link expression - and converting ~foo, #foo etc.\n\t// TODO Consider exposing or allowing override, as public API\n\treturn function(path, depth) {\n\t\t// TODO consider only calling the contextCb on the initial token in path '~a.b.c' and not calling again on\n\t\t// the individual tokens, 'a', 'b', 'c'... Currently it is called multiple times\n\t\tvar tokens, tag, items, helper, last, nextPath, l, obsCtxPrm, addedTagCpDep, key, bindTo;\n\t\tif (view && path) {\n\t\t\tif (path._cpfn) {\n\t\t\t\ttry {\n\t\t\t\t\treturn $subSettingsAdvanced.cache ? view.getCache(path._cpKey) : path._cpfn.call(view.tmpl, view.data, view, $sub); // exprOb for computed property\n\t\t\t\t} catch(e) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (path.charAt(0) === \"~\") {\n\t\t\t\t// We return new items to insert into the sequence, replacing the \"~a.b.c\" string:\n\t\t\t\t// [helperObject 'a', \"a.b.c\" currentDataItem] so currentDataItem becomes the object for subsequent paths.\n\t\t\t\tif (path.slice(0, 4) === \"~tag\") {\n\t\t\t\t\ttag = view.ctx;\n\t\t\t\t\tif (path.charAt(4) === \".\") {\n\t\t\t\t\t\t// \"~tag.xxx\"\n\t\t\t\t\t\ttokens = path.slice(5);\n\t\t\t\t\t\ttag = tag.tag;\n\t\t\t\t\t} else if (path.slice(0, 8) === \"~tagCtx.\") {\n\t\t\t\t\t\t// \"~tagCtx.xxx\"\n\t\t\t\t\t\ttokens = path.slice(8);\n\t\t\t\t\t\ttag = tag.tagCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (tokens) {\n\t\t\t\t\t\treturn tag ? [tag, tokens] : [];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpath = path.slice(1).split(\".\");\n\t\t\t\tif (helper = view.ctxPrm(last = path.shift(), undefined, true)) {\n\t\t\t\t\tif (obsCtxPrm = helper._cxp) { // helper for (contextual parameter ~foo=...) is an array - [view, ctxPrmDependencies ...]\n\t\t\t\t\t\tif (path.length) {\n\t\t\t\t\t\t\tnextPath = \".\" + path.join(\".\");\n\t\t\t\t\t\t\tlast = helper[l = helper.length-1];\n\t\t\t\t\t\t\tif (last._cpfn) {\n\t\t\t\t\t\t\t\tlast.sb = nextPath;\n\t\t\t\t\t\t\t\tlast.bnd = !!depth;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thelper[l] = (last + nextPath).replace(\"#data.\", \"\");\n\t\t\t\t\t\t\t\tif (last.slice(0, 5) === \"#view\") {\n\t\t\t\t\t\t\t\t\thelper[l] = helper[l].slice(6);\n\t\t\t\t\t\t\t\t\thelper.splice(l, 0, view);\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\titems = [helper]; // Contextual parameter\n\t\t\t\t\t\tif ((tag = obsCtxPrm.tag) && tag.convert) {\n\t\t\t\t\t\t\t// If there is a converter, it might mix inputs, so tag contextual param needs to depend on all bound args/props.\n\t\t\t\t\t\t\tbindTo = tag.bindTo || [0];\n\t\t\t\t\t\t\tl = bindTo.length;\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tif (depth !== undefined && l !== obsCtxPrm.ind) {\n\t\t\t\t\t\t\t\t\tkey = bindTo[l];\n\t\t\t\t\t\t\t\t\taddedTagCpDep = [helper[0], tag.tagCtx.params[+key === key ? \"args\" : \"props\"]];\n\t\t\t\t\t\t\t\t\taddedTagCpDep._cxp = obsCtxPrm;\n\t\t\t\t\t\t\t\t\titems.push(addedTagCpDep); // Added dependency for tag contextual parameter\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} else if (path.length || $isFunction(helper)) {\n\t\t\t\t\t\titems = [helper, path.join(\".\")]; // 2way bindng on ~foo.helperLeafProperty or ~computed() or ~contextualParam\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn items || [];\n\t\t\t}\n\t\t\tif (path.charAt(0) === \"#\") {\n\t\t\t\t// We return new items to insert into the sequence, replacing the \"#a.b.c\" string: [view, \"a.b.c\" currentDataItem]\n\t\t\t\t// so currentDataItem becomes the object for subsequent paths. The 'true' flag makes the paths bind only to leaf changes.\n\t\t\t\treturn path === \"#data\" ? [] : [view, path.replace(rViewPath, \"\")];\n\t\t\t}\n\t\t}\n\t};\n};\n\n//===================\n// ctxPrm helpers\n//===================\n// The following helper functions for observable contextual parameters are needed by render.js in data-linking scenarios\n// Implemented here rather than in render.js to keep render.js size down, and exposed via $.sub...\n\n$sub._cp = function(paramVal, paramExpr, view, tagCtxPrm) { // Create tag or inline contextual parameter\n\t// Called for inline contextual parameter ~foo=expression, from compiled function for expression. (tagCtxPrm is undefined)\n\t// Called for tag parameter (two-way binding), from renderTag. (tagCtxPrm is {tag: ..., ind: ...})\n\tif (view.linked) { // In JsViews, returns [view, linkFn] where linkFn is compiled function for expression, or observable contextual parameter object\n\t\tif (tagCtxPrm && (tagCtxPrm.cvt || tagCtxPrm.tag._.toIndex[tagCtxPrm.ind] === undefined)) {\n\t\t\tparamVal = [{_ocp: paramVal}]; // With convert, or with bindTo/bindFrom different, the tag contextual parameter object will be 'local' to the tag.\n\t\t\t\t// It will be updated by bindFrom binding, and by tag.setValue(...), but not by tag.updateValue() (which will update bindTo value externally)\n\t\t\ttagCtxPrm.updateValue = function(val) {\n\t\t\t\t$.observable(paramVal._cxp.data).setProperty(_ocp, val); // Set the value (res[0]._ocp)\n\t\t\t\treturn this;\n\t\t\t};\n\t\t} else if (paramExpr) { // With no convert/convertBack and no bindTo/bindFrom difference, tag contextual parameter 2way binds to bindTo/bindFrom value.\n\t\t\t\t// So tag.updateValue() updates external value, which updates contextual parameter through 2way binding\n\t\t\tvar params = delimOpenChar1 + \":\" + paramExpr + delimCloseChar0,\n\t\t\t\tlinkFn = linkExprStore[params];\n\t\t\tif (!linkFn) {\n\t\t\t\tlinkExprStore[params] = linkFn = $sub.tmplFn(params.replace(rEscapeQuotes, \"\\\\$&\"), view.tmpl, true);\n\t\t\t}\n\t\t\tparamVal = linkFn.deps[0]\n\t\t\t\t? [view, linkFn] // compiled expression\n\t\t\t\t: [{_ocp: tagCtxPrm ? paramVal : linkFn()}]; // Static value - no deps - returns observable contextual parameter object\n\t\t} else {\n\t\t\tparamVal = [{_ocp: paramVal}]; // Uninitialized observable contextual parameter object\n\t\t}\n\t\tparamVal._cxp = tagCtxPrm || {\n\t\t\tupdateValue: function(val) {\n\t\t\t\t$observable(paramVal._cxp.data).setProperty(paramVal._cxp.path, val);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t};\n\t}\n\treturn paramVal; // In JsRender returns evaluated expression\n};\n\n$sub._ucp = function(key, value, view, obsCtxPrm) {\n\tvar tag = obsCtxPrm.tag,\n\t\tindex = tag ? $inArray(key, tag.linkedCtxParam) : 0;\n\tif (!obsCtxPrm.path) {\n\t\tresolveDataTargetPath(\"~\" + key, view.data, $sub._gccb(view));\n\t}\n\treturn (obsCtxPrm.updateValue || tag.updateValue)(value, index, obsCtxPrm.tagElse, undefined, tag);\n};\n\n$sub._ceo = function cloneExprObjects(obs) { // Clone exprObs so that each referenced contextual parameter ~foo uses its own exprOb instances\n\tvar ob,\n\t\tclones = [],\n\t\tl = obs.length;\n\twhile (l--) {\n\t\tob = obs[l];\n\t\tif (ob._cpfn) {\n\t\t\tob = $extend({}, ob); // If an exprOb, clone it. If a string, keep as is\n\t\t\tob.prm = cloneExprObjects(ob.prm); // Recursively clone exprObs in parameters, too\n\t\t}\n\t\tclones.unshift(ob);\n\t}\n\treturn clones;\n};\n\n//=========================\n// Extend $.views.settings\n//=========================\n\noldAdvSet = $sub.advSet;\n\n$sub.advSet = function() { // refresh advanced settings\n\toldAdvSet.call($sub);\n\tglobal._jsv = $subSettingsAdvanced._jsv\n\t\t? $extend(global._jsv || {}, { // create global _jsv, for accessing views, etc\n\t\t\t\tviews: viewStore,\n\t\t\t\tbindings: bindingStore\n\t\t\t})\n\t\t: undefined; // In IE8 cannot do delete global._jsv\n\t$viewsLinkAttr = $subSettingsAdvanced.linkAttr;\n\tlinkViewsSel = bindElsSel + \",[\" + $viewsLinkAttr + \"]\";\n\twrapMap = $subSettingsAdvanced._wm;\n\twrapMap.optgroup = wrapMap.option;\n\twrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n\twrapMap.th = wrapMap.td;\n};\n\n$viewsSettings.advanced({\n\tlinkAttr: \"data-link\",\n\tuseViews: false,\n\tnoValidate: false,\n\t// wrapMap provide appropriate wrappers for inserting innerHTML, used in insertBefore\n\t// We have to close these tags to support XHTML (#13200)\n\t// TODO investigate whether more recent jQuery implementation using wrapMap in domManip/$().html() etc. is better optimized now...\n\t_wm: {\n\t\toption: [1, \"<select multiple='multiple'>\", \"</select>\"],\n\t\tlegend: [1, \"<fieldset>\", \"</fieldset>\"],\n\t\tarea: [1, \"<map>\", \"</map>\"],\n\t\tparam: [1, \"<object>\", \"</object>\"],\n\t\tthead: [1, \"<table>\", \"</table>\"],\n\t\ttr: [2, \"<table><tbody>\", \"</tbody></table>\"],\n\t\ttd: [3, \"<table><tbody><tr>\", \"</tr></tbody></table>\"],\n\t\tcol: [2, \"<table><tbody></tbody><colgroup>\", \"</colgroup></table>\"],\n\t\tsvg_ns: [1, \"<svg>\", \"</svg>\"],\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<div>\", \"</div>\"]\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"]}