forked from BorisMoore/jsviews
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsviews.min.js.map
1 lines (1 loc) · 326 KB
/
jsviews.min.js.map
1
{"version":3,"sources":["jsviews.js"],"names":["factory","global","eval","$","jQuery","define","amd","exports","module","getDerivedMethod","baseMethod","method","ret","tag","this","prevBase","base","apply","arguments","getMethod","$isFunction","_d","noop","tagHandlersFromProps","tagCtx","prop","props","rHasHandlers","test","retVal","val","dbgBreak","e","baseApply","dbgMode","debugMode","$viewsSettings","_dbgMode","JsViewsError","message","name","link","$extend","target","source","$viewsDelimiters","openChars","closeChars","delimOpenChar0","charAt","delimOpenChar1","delimCloseChar0","delimCloseChar1","linkChar","rTag","$sub","RegExp","rTmplString","getView","inner","type","undefined","views","i","l","found","view","root","_","useKey","get","length","parent","getNestedIndex","index","getIndex","getHelper","helper","wrapped","ctx","linkCtx","res","$helpers","_wrp","convertVal","converter","onError","value","boundTag","tmpl","bnds","args","data","$views","_tg","inline","bnd","unlinked","tagName","cvt","flow","extendCtx","_er","cvtArgs","convert","onRender","convertArgs","getRsc","error","slice","depends","getDeps","getResource","resourceType","itemName","store","renderTag","parentView","tagCtxs","isUpdate","topView","tagDef","template","tags","attr","parentTag","itemRet","tagCtxCtx","content","callInit","mapDef","thisMap","initialTmpl","tagDataMap","parentTmpl","_is","tmpls","render","renderContent","$templates","_ctr","init","dataMap","fn","arrVws","dataBoundOnly","map","parents","parentTags","rendering","src","unmap","tgt","noVws","HTML","$converters","html","View","context","key","contentTmpl","parentView_","self_","self","isArray","id","viewId","linked","indexStr","push","splice","compileChildResources","storeName","resources","resourceName","resource","settings","compile","onStore","jsvStores","compileTag","Tag","baseTag","compiledDef","$tags","prototype","constructor","_parentTmpl","compileTmpl","options","lookupTemplate","currentName","nodeType","elem","document","getElementById","find","innerHTML","getAttribute","tmplAttr","jsvTmpl","tmplName","setAttribute","compiledTmpl","tmplOrMarkup","markup","tmplObject","tmplFn","replace","rEscapeQuotes","$render","Map","getTgt","baseMap","htmlTag","wrapMap","links","rFirstElem","exec","toLowerCase","div","trim","registerStore","storeSettings","theStore","item","thisStore","OBJECT","storeNames","noIteration","isTopRenderCall","prevData","prevIndex","result","isRenderCall","useViews","renderWithViews","$isArray","setItemVar","newCtx","itemVar","newView","childView","itemResult","swapContent","outerOnRender","syntaxError","helpers","it","fallback","Err","isLinkExpr","convertBack","hasElse","pushprecedingContent","shift","loc","substr","rNewLine","blockTagCheck","block","parseTag","all","bind","colon","comment","codeTag","params","slash","closeBlock","pathBindings","ctxProps","paramsArgs","paramsProps","paramsCtxProps","useTrigger","allowCode","rUnescapeQuotes","rTestElseIf","current","substring","stack","pop","parseParams","rBuildHash","onerror","isCtx","keyToken","keyValue","arg","param","hasHandlers","newNode","parsedParam","astTop","buildCode","setPaths","pathsArr","paths","deps","concat","paramStructure","parts","parseTokens","lftPrn0","lftPrn","bound","path","operator","err","eq","path2","prn","comma","lftPrn2","apos","quot","rtPrn","rtPrnDot","prn2","space","full","parsePath","allPath","not","object","viewProperty","pathTokens","leafToken","subPath","bindings","binds","named","bindto","_jsvto","bndCtx","bd","theOb","_jsv","sb","pathStart","parenDepth","expr","exprFn","newOb","aposed","quoted","boundName","bndStack","prm","tmplLinks","indexOf","paramIndex","split","join","rPath","fnCall","rParams","ast","node","hasTag","hasEncoder","getsVal","hasCnvt","useCnvt","tmplBindings","boundOnErrStart","boundOnErrEnd","tagRender","nestedTmpls","nestedTmpl","tagAndElses","nextIsElse","oldCode","isElse","isGetVal","tagCtxFn","tagStart","trigger","tmplBindingKey","templates","converters","code","tmplOptions","debug","Function","_tag","parentContext","getCharEntity","ch","charEntities","charCodeAt","getTargetProps","toJSON","$fnRender","tmplElem","jquery","selector","call","htmlEncode","text","rIsHtml","rHtmlEncode","elemChangeHandler","ev","sourceValue","setter","cancel","fromAttr","cvtBack","cnvtName","$source","binding","oldLinkCtx","onBeforeChange","onAfterChange","to","eventArgs","exprOb","_jsvBnd","splitBindings","bindingStore","hlp","onBeforeChangeStr","onAfterChangeStr","defaultAttr","fnSetters","change","oldValue","_val","_ctxCb","chging","$observable","setProperty","propertyChangeHandler","linkFn","noUpdate","forceUpdate","hasError","parentElem","parentNode","onEvent","_toLk","getTargetVal","onUpdate","mergeCtxs","NONE","onBeforeLink","callAfterLink","observeAndBind","_cnvt","TRUE","updateContent","_noUpd","currentValue","css","$target","style","parseInt","CHECKBOX","CHECKED","RADIO","setDefer","_df","deferAttr","prevNode","nextNode","promise","nodesToRemove","useProp","tokens","openIndex","closeIndex","testElem","nodeName","cStyle","renders","targetVal","_elCnt","_prv","_nxt","currentStyle","getComputedStyle","display","_jsvd","displayStyles","createElement","body","appendChild","removeChild","nodes","transferViewTokens","_tgId","disposeTokens","previousSibling","lastChild","remove","lazyLink","empty","children","textContent","innerText","arrayChangeHandler","action","items","addViews","removeViews","refresh","setArrayChangeLink","handler","arrayBinding","bndArr","off","arrayChangeStr","on","linkGetVal","merge","contentEditable","from","renderAndLink","linkToNode","prevView","bindId","elCnt","removeViewBinding","nextSibling","addBindingMarkers","end","bindingKey","viewStore","linkedElem","exprFnDeps","cvtBk","_bndId","_hdl","_depends","_apply","bindTo","onAfterBind","jsvAttrStr","radio","_jsvLkEl","tmplLink","$link","tmplOrLinkTag","activeBody","elementChangeStr","k","vwInfos","placeholderParent","targetEl","topLevelCall","replaceMode","$view","addDataBinding","cleanData","lnk","viewInfos","rOpenViewMarkers","viewLink","outerData","validateOnly","convertMarkers","preceding","selfClose","closeTag","spaceBefore","boundId","spaceAfter","tag1","tag2","closeTag2","spaceAfterClose","selfClose2","endOpenTag","errorMsg","bndId","endOfElCnt","inTag","isVoid","tagStack","validate","voidElems","prevElCnt","elContent","defer","ids","openScript","closeScript","deferStack","unshift","badParent","processViewInfos","targetParent","deferPath","deferChar","bindChar","onAftCr","deep","addedBindEls","_tkns","len","vwInfo","j","open","onArrayChange","removeSubStr","onAfterCreate","bindEls","getViewInfos","level","tagDepth","dataLink","wrap","linkViewsSel","elems","qsa","querySelectorAll","prevNodes","markerNodeInfo","contains","isLink","rViewMarkers","skip","processInfos","$viewsLinkAttr","rOpenTagMarkers","unmarkPrevOrNextNode","resolve","prevIds","linkInfo","token","nextView","depth","fragment","copiedNode","firstTag","wrapper","thisId","onAfterCreateStr","Deferred","noValidate","markPrevOrNextNode","namespaceURI","noDomLevel0","rConvertMarkers","safeFragment","createDocumentFragment","firstChild","insertBefore","setTimeout","linkMarkup","currentView","boundTagId","trimLen","tagExpr","rTagIndex","linkExpressions","bindDataLinkTarget","normalizeLinkTag","rTagDatalink","lastIndex","isLk","noArray","getContextCb","str","SCRIPT","isVal","rBinding","getInfos","close","elPath","infos","rMarkerTokens","removeAttribute","marker","twoway","$linkedElem","radioButtons","linkedTag","oldTrig","newTrig","onAfterLink","targetTag","noVal","setSize","height","width","addClass","_jsvTr","bindElChange","asyncElemChangeHandler","$elem","trig","onoff","pathIndex","lastPath","bindtoOb","newCtxs","newTagCtx","_ths","clean","elemArray","linkedElemTag","objId","obsId","cbId","propertyChangeStr","onDispose","_cbBnds","$unlink","getElementsByTagName","each","innerView","tmplUnlink","rViewPath","inputAttrib","viewOrTagChar","viewOrTag","precedingLength","emptyView","vwItem","rOpenMarkers","observeProps","insert","observeMappedProps","removeProperty","shallowArrayFilter","setGlobals","jsvStoreName","$observe","versionNumber","rAttrEncode","&","<",">","\u0000","'","\"","`","jsr","jsrender","jsrToJq","jsviews","jsv","sub","parse","extend","syntaxErr","_err","Error","observable","renderFile","__express","isFunction","ob","Array","obj","toJq","jq","delimiters","if","done","selected","for","finalElse","include","*",":*","dbg","url","encodeURI","observe","$eventSpecial","event","special","$expando","expando","PARSEINT","rNotWhite","propChng","arrChng","cbBindingsStore","observeStr","observeObjKey","observeCbKey","observeInnerCbKey","$hasData","hasData","$data","getCbKey","cb","_cId","ObjectObservable","_data","ArrayObservable","wrapArray","resolvePathObjects","nextObj","out","removeCbBindings","cbBindings","cbBindingsId","onObservableChange","isOb","allowArray","filter","parentObs","observeAll","array","_path","observe_apply","ns","$observeAll","namespace","unobserve","$unobserveAll","objMap","observeArrayItems","arr","unobs","newAllPath","filterAndObserveAll","nestedArray","newObject","newParentObs","_fltr","nextParentObs","updatedTgt","wrappedCb","oldItems","isObject","obId","notRemoving","un","shallowFilter","$unobserve","innerObserve","observeOnOff","pathStr","isArrayBinding","evData","obIdExpando","boundObOrArr","prntObs","allPth","initialNs","events","el","callback","fullPath","inArray","getInnerCb","origRt","contextCb","newObj","bindArray","unbind","relPath","prevObj","prevAllPath","p","dep","innerCb","initNsArr","initNsArrLen","lastArg","_inId","match","origRoot","set","Object","unobserveAll","nonStrict","pair","_setProperty","leaf","getter","removeProp","property","Date","_trigger","triggerHandler","_insert","oldLength","numToRemove","_remove","move","oldIndex","newIndex","numToMove","_move","newItems","_refresh","$_data","handleObj","unbound","changing","update","obsSrc","obs","srcFlt","obsTgt","obt","tgtFlt","_def","linkMethods","bindElsSel","input","valueBinding","isCleanCall","oldCleanData","oldJsvDelimiters","querySelector","ol","ul","table","tbody","thead","tfoot","tr","colgroup","dl","select","optgroup","svg","svg_ns","br","img","hr","area","col","meta","command","embed","keygen","track","wbr","requiresStr","contents","filtered","add","withMarkers","prevIsFirstNode","lastSibling","childTags","disposed","unlink","domChange","hasListener","domChangeNotification","delimChars","dataItems","viewsCount","itemsCount","keepNodes","removeView","viewToRemove","regularExpression","toggle","elemType","label","contextOb","activeElem","_evs","_sel","_hlr","arrayView","targetLength","arrHandler","arrBinding","arrayBindings","_ars","tagCt","tci","prevArg","different","getInnerView","nd","isVl","utility","oldFn","option","legend","td","support","htmlSerialize","linkAttr","textarea","jsrDbgMode","caption","th"],"mappings":";;CAcC,SAASA,GAET,GAAIC,IAAU,EAAGC,MAAM,QACtBC,EAAIF,EAAOG,MAEU,mBAAXC,SAAyBA,OAAOC,IAC1CD,QAAQ,UAAWL,GACU,gBAAZO,SACjBC,OAAOD,QAAUJ,EACdH,EAAQG,GACR,SAASA,GACV,MAAOH,GAAQG,IAGjBH,GAAQ,IAKV,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AAQhsB,GAAQksB,SAAWlsB,GAAQuwB,QAAUvwB,GAAQ+rB,MAC7E/rB,GAAQwwB,GAAKxwB,GAAQiwB,MAIhBr9B","file":"jsviews.min.js","sourcesContent":["/*! jsviews.js v1.0.0-beta.65 (Beta Candidate) single-file version: http://jsviews.com/ */\n/*! includes JsRender, JsObservable and JsViews - see: http://jsviews.com/#download */\n\n/* Interactive data-driven views using JsRender templates */\n\n//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsRender >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n/* JsRender:\n * See http://jsviews.com/#jsrender and http://github.com/BorisMoore/jsrender\n * Copyright 2015, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041\n\n(function(factory) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar global = (0, eval)('this'), // jshint ignore:line\n\t\t$ = global.jQuery;\n\n\tif (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine([\"jquery\"], factory);\n\t} else if (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory($)\n\t\t\t: function($) { // If no global jQuery, take jQuery passed as parameter: require(\"jsviews\")(jQuery)\n\t\t\t\treturn factory($);\n\t\t\t};\n\t} else { // Browser using plain <script> tag\n\t\tfactory(false);\n\t}\n} (\n\n// factory (for jsviews.js)\nfunction($) {\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 global = (0, eval)('this'), // jshint ignore:line\n\tsetGlobals = $ === false; // Only set globals if script block in browser (not AMD and not CommonJS)\n\n$ = $ || global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery.\n\nif (!$ || !$.fn) {\n\t// jQuery is not loaded.\n\tthrow \"JsViews requires jQuery\"; // We require jQuery\n}\n\nvar versionNumber = \"v1.0.0-beta\",\n\n\tjsvStoreName, rTag, rTmplString, topView, $views, $observe, $observable,\n\n//TODO\ttmplFnsCache = {},\n\t$isFunction, $isArray, $templates, $converters, $helpers, $tags, $sub, $viewsSettings,\n\n\tdelimOpenChar0 = \"{\", delimOpenChar1 = \"{\", delimCloseChar0 = \"}\", delimCloseChar1 = \"}\", linkChar = \"^\",\n\n\trPath = /^(!*?)(?:null|true|false|\\d[\\d.]*|([\\w$]+|\\.|~([\\w$]+)|#(view|([\\w$]+))?)([\\w$.^]*?)(?:[.[^]([\\w$]+)\\]?)?)$/g,\n\t// not object helper view viewProperty pathTokens leafToken\n\n\trParams = /(\\()(?=\\s*\\()|(?:([([])\\s*)?(?:(\\^?)(!*?[#~]?[\\w$.^]+)?\\s*((\\+\\+|--)|\\+|-|&&|\\|\\||===|!==|==|!=|<=|>=|[<>%*:?\\/]|(=))\\s*|(!*?[#~]?[\\w$.^]+)([([])?)|(,\\s*)|(\\(?)\\\\?(?:(')|(\"))|(?:\\s*(([)\\]])(?=\\s*[.^]|\\s*$|[^\\(\\[])|[)\\]])([([]?))|(\\s+)/g,\n\t// lftPrn0 lftPrn bound path operator err eq path2 prn comma lftPrn2 apos quot rtPrn rtPrnDot prn2 space\n\t// (left paren? followed by (path? followed by operator) or (path followed by left paren?)) or comma or apos or quot or right paren or space\n\n\tisRenderCall,\n\trNewLine = /[ \\t]*(\\r\\n|\\n|\\r)/g,\n\trUnescapeQuotes = /\\\\(['\"])/g,\n\trEscapeQuotes = /['\"\\\\]/g, // Escape quotes and \\ character\n\trBuildHash = /(?:\\x08|^)(onerror:)?(?:(~?)(([\\w$_\\.]+):)?([^\\x08]+))\\x08(,)?([^\\x08]+)/gi,\n\trTestElseIf = /^if\\s/,\n\trFirstElem = /<(\\w+)[>\\s]/,\n\trAttrEncode = /[\\x00`><\"'&]/g, // Includes > encoding since rConvertMarkers in JsViews does not skip > characters in attribute strings\n\trIsHtml = /[\\x00`><\\\"'&]/,\n\trHasHandlers = /^on[A-Z]|^convert(Back)?$/,\n\trHtmlEncode = rAttrEncode,\n\tviewId = 0,\n\tcharEntities = {\n\t\t\"&\": \"&\",\n\t\t\"<\": \"<\",\n\t\t\">\": \">\",\n\t\t\"\\x00\": \"�\",\n\t\t\"'\": \"'\",\n\t\t'\"': \""\",\n\t\t\"`\": \"`\"\n\t},\n\tHTML = \"html\",\n\tOBJECT = \"object\",\n\ttmplAttr = \"data-jsv-tmpl\",\n\tjsvTmpl = \"jsvTmpl\",\n\tindexStr = \"For #index in nested block use #getIndex().\",\n\t$render = {},\n\tjsvStores = {\n\t\ttemplate: {\n\t\t\tcompile: compileTmpl\n\t\t},\n\t\ttag: {\n\t\t\tcompile: compileTag\n\t\t},\n\t\thelper: {},\n\t\tconverter: {}\n\t},\n\n\tjsr = global.jsrender,\n\tjsrToJq = jsr && $ && !$.render; // JsRender already loaded, without jQuery. but we will re-load it now to attach to jQuery\n\n\t// views object ($.views if jQuery is loaded, jsrender.views if no jQuery, e.g. in Node.js)\n\t$views = {\n\t\tjsviews: versionNumber,\n\t\tsettings: function(settings) {\n\t\t\t$extend($viewsSettings, settings);\n\t\t\tdbgMode($viewsSettings._dbgMode);\n\t\t\tif ($viewsSettings.jsv) {\n\t\t\t\t$viewsSettings.jsv();\n\t\t\t}\n\t\t},\n\t\tsub: {\n\t\t\t// subscription, e.g. JsViews integration\n\t\t\tView: View,\n\t\t\tErr: JsViewsError,\n\t\t\ttmplFn: tmplFn,\n\t\t\tparse: parseParams,\n\t\t\textend: $extend,\n\t\t\tsyntaxErr: syntaxError,\n\t\t\tonStore: {},\n\t\t\t_ths: tagHandlersFromProps,\n\t\t\t_tg: function() {} // Constructor for tagDef\n\t\t},\n\t\tmap: dataMap, // If jsObservable loaded first, use that definition of dataMap\n\t\t_cnvt: convertVal,\n\t\t_tag: renderTag,\n\t\t_err: error\n\t};\n\nfunction getDerivedMethod(baseMethod, method) {\n\treturn function() {\n\t\tvar ret,\n\t\t\ttag = this,\n\t\t\tprevBase = tag.base;\n\n\t\ttag.base = baseMethod; // Within method call, calling this.base will call the base method\n\t\tret = method.apply(tag, arguments); // Call the method\n\t\ttag.base = prevBase; // Replace this.base to be the base method of the previous call, for chained calls\n\t\treturn ret;\n\t};\n}\n\nfunction getMethod(baseMethod, method) {\n\t// For derived methods (or handlers declared declaratively as in {{:foo onChange=~fooChanged}} replace by a derived method, to allow using this.base(...)\n\t// or this.baseApply(arguments) to call the base implementation. (Equivalent to this._super(...) and this._superApply(arguments) in jQuery UI)\n\tif ($isFunction(method)) {\n\t\tmethod = getDerivedMethod(\n\t\t\t\t!baseMethod\n\t\t\t\t\t? noop // no base method implementation, so use noop as base method\n\t\t\t\t\t: baseMethod._d\n\t\t\t\t\t\t? baseMethod // baseMethod is a derived method, so us it\n\t\t\t\t\t\t: getDerivedMethod(noop, baseMethod), // baseMethod is not derived so make its base method be the noop method\n\t\t\t\tmethod\n\t\t\t);\n\t\tmethod._d = 1; // Add flag that this is a derived method\n\t}\n\treturn method;\n}\n\nfunction tagHandlersFromProps(tag, tagCtx) {\n\tfor (var prop in tagCtx.props) {\n\t\tif (rHasHandlers.test(prop)) {\n\t\t\ttag[prop] = getMethod(tag[prop], tagCtx.props[prop]);\n\t\t\t// Copy over the onFoo props, convert and convertBack from tagCtx.props to tag (overrides values in tagDef).\n\t\t\t// Note: unsupported scenario: if handlers are dynamically added ^onFoo=expression this will work, but dynamically removing will not work.\n\t\t}\n\t}\n}\n\nfunction retVal(val) {\n\treturn val;\n}\n\nfunction noop() {\n\treturn \"\";\n}\n\nfunction dbgBreak(val) {\n\t// Usage examples: {{dbg:...}}, {{:~dbg(...)}}, {{for ... onAfterLink=~dbg}}, {{dbg .../}} etc.\n\t// To break here, stop on caught exceptions.\n\ttry {\n\t\tdebugger;\n\t\tthrow \"dbg breakpoint\";\n\t}\n\tcatch (e) {}\n\treturn this.base ? this.baseApply(arguments) : val;\n}\n\nfunction dbgMode(debugMode) {\n\t$viewsSettings._dbgMode = debugMode !== false; // Pass in false to unset. Otherwise sets to true.\n}\n\nfunction JsViewsError(message) {\n\t// Error exception type for JsViews/JsRender\n\t// Override of $.views.sub.Error is possible\n\tthis.name = ($.link ? \"JsViews\" : \"JsRender\") + \" Error\";\n\tthis.message = message || this.name;\n}\n\nfunction $extend(target, source) {\n\tvar name;\n\tfor (name in source) {\n\t\ttarget[name] = source[name];\n\t}\n\treturn target;\n}\n\n(JsViewsError.prototype = new Error()).constructor = JsViewsError;\n\n//========================== Top-level functions ==========================\n\n//===================\n// views.delimiters\n//===================\nfunction $viewsDelimiters(openChars, closeChars, link) {\n\t// Set the tag opening and closing delimiters and 'link' character. Default is \"{{\", \"}}\" and \"^\"\n\t// openChars, closeChars: opening and closing strings, each with two characters\n\n\tif (this !== 0 || openChars) {\n\t\tdelimOpenChar0 = openChars ? openChars.charAt(0) : delimOpenChar0; // Escape the characters - since they could be regex special characters\n\t\tdelimOpenChar1 = openChars ? openChars.charAt(1) : delimOpenChar1;\n\t\tdelimCloseChar0 = closeChars ? closeChars.charAt(0) : delimCloseChar0;\n\t\tdelimCloseChar1 = closeChars ? closeChars.charAt(1) : delimCloseChar1;\n\t\tlinkChar = link || linkChar;\n\t\topenChars = \"\\\\\" + delimOpenChar0 + \"(\\\\\" + linkChar + \")?\\\\\" + delimOpenChar1; // Default is \"{^{\"\n\t\tcloseChars = \"\\\\\" + delimCloseChar0 + \"\\\\\" + delimCloseChar1; // Default is \"}}\"\n\t\t// Build regex with new delimiters\n\t\t// tag (followed by / space or }) or cvtr+colon or html or code\n\t\trTag = \"(?:(?:(\\\\w+(?=[\\\\/\\\\s\\\\\" + delimCloseChar0 + \"]))|(?:(\\\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\\\*)))\"\n\t\t\t+ \"\\\\s*((?:[^\\\\\" + delimCloseChar0 + \"]|\\\\\" + delimCloseChar0 + \"(?!\\\\\" + delimCloseChar1 + \"))*?)\";\n\n\t\t// make rTag available to JsViews (or other components) for parsing binding expressions\n\t\t$sub.rTag = rTag + \")\";\n\n\t\trTag = new RegExp(openChars + rTag + \"(\\\\/)?|(?:\\\\/(\\\\w+)))\" + closeChars, \"g\");\n\n\t\t// Default: bind tag converter colon html comment code params slash closeBlock\n\t\t// /{(\\^)?{(?:(?:(\\w+(?=[\\/\\s}]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^}]|}(?!}))*?)(\\/)?|(?:\\/(\\w+)))}}/g\n\n\t\trTmplString = new RegExp(\"<.*>|([^\\\\\\\\]|^)[{}]|\" + openChars + \".*\" + closeChars);\n\t\t// rTmplString looks for html tags or { or } char not preceded by \\\\, or JsRender tags {{xxx}}. Each of these strings are considered\n\t\t// NOT to be jQuery selectors\n\t}\n\treturn [delimOpenChar0, delimOpenChar1, delimCloseChar0, delimCloseChar1, linkChar];\n}\n\n//=========\n// View.get\n//=========\n\nfunction getView(inner, type) { //view.get(inner, type)\n\tif (!type) {\n\t\t// view.get(type)\n\t\ttype = inner;\n\t\tinner = undefined;\n\t}\n\n\tvar views, i, l, found,\n\t\tview = this,\n\t\troot = !type || type === \"root\";\n\t\t// If type is undefined, returns root view (view under top view).\n\n\tif (inner) {\n\t\t// Go through views - this one, and all nested ones, depth-first - and return first one with given type.\n\t\tfound = view.type === type ? view : undefined;\n\t\tif (!found) {\n\t\t\tviews = view.views;\n\t\t\tif (view._.useKey) {\n\t\t\t\tfor (i in views) {\n\t\t\t\t\tif (found = views[i].get(inner, type)) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (i = 0, l = views.length; !found && i < l; i++) {\n\t\t\t\t\tfound = views[i].get(inner, type);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else if (root) {\n\t\t// Find root view. (view whose parent is top view)\n\t\twhile (view.parent.parent) {\n\t\t\tfound = view = view.parent;\n\t\t}\n\t} else {\n\t\twhile (view && !found) {\n\t\t\t// Go through views - this one, and all parent ones - and return first one with given type.\n\t\t\tfound = view.type === type ? view : undefined;\n\t\t\tview = view.parent;\n\t\t}\n\t}\n\treturn found;\n}\n\nfunction getNestedIndex() {\n\tvar view = this.get(\"item\");\n\treturn view ? view.index : undefined;\n}\n\ngetNestedIndex.depends = function() {\n\treturn [this.get(\"item\"), \"index\"];\n};\n\nfunction getIndex() {\n\treturn this.index;\n}\n\ngetIndex.depends = \"index\";\n\n//==========\n// View.hlp\n//==========\n\nfunction getHelper(helper) {\n\t// Helper method called as view.hlp(key) from compiled template, for helper functions or template parameters ~foo\n\tvar wrapped,\n\t\tview = this,\n\t\tctx = view.linkCtx,\n\t\tres = (view.ctx || {})[helper];\n\n\tif (res === undefined && ctx && ctx.ctx) {\n\t\tres = ctx.ctx[helper];\n\t}\n\tif (res === undefined) {\n\t\tres = $helpers[helper];\n\t}\n\n\tif (res) {\n\t\tif ($isFunction(res) && !res._wrp) {\n\t\t\t// If it is of type function, and not already wrapped, we will wrap it, so if called with no this pointer it will be called with the\n\t\t\t// view as 'this' context. If the helper ~foo() was in a data-link expression, the view will have a 'temporary' linkCtx property too.\n\t\t\t// Note that helper functions on deeper paths will have specific this pointers, from the preceding path.\n\t\t\t// For example, ~util.foo() will have the ~util object as 'this' pointer\n\t\t\twrapped = function() {\n\t\t\t\treturn res.apply((!this || this === global) ? view : this, arguments);\n\t\t\t};\n\t\t\twrapped._wrp = true;\n\t\t\t$extend(wrapped, res); // Attach same expandos (if any) to the wrapped function\n\t\t}\n\t}\n\treturn wrapped || res;\n}\n\n//==============\n// views._cnvt\n//==============\n\nfunction convertVal(converter, view, tagCtx, onError) {\n\t// self is template object or linkCtx object\n\tvar tag, value,\n\t\t// if tagCtx is an integer, then it is the key for the compiled function to return the boundTag tagCtx\n\t\tboundTag = typeof tagCtx === \"number\" && view.tmpl.bnds[tagCtx-1],\n\t\tlinkCtx = view.linkCtx; // For data-link=\"{cvt:...}\"...\n\n\tif (onError !== undefined) {\n\t\ttagCtx = onError = {props: {}, args: [onError]};\n\t} else if (boundTag) {\n\t\ttagCtx = boundTag(view.data, view, $views);\n\t}\n\n\tvalue = tagCtx.args[0];\n\tif (converter || boundTag) {\n\t\ttag = linkCtx && linkCtx.tag;\n\t\tif (!tag) {\n\t\t\ttag = $extend(new $sub._tg(), {\n\t\t\t\t_: {\n\t\t\t\t\tinline: !linkCtx,\n\t\t\t\t\tbnd: boundTag,\n\t\t\t\t\tunlinked: true\n\t\t\t\t},\n\t\t\t\ttagName: \":\",\n\t\t\t\tcvt: converter,\n\t\t\t\tflow: true,\n\t\t\t\ttagCtx: tagCtx,\n\t\t\t});\n\t\t\tif (linkCtx) {\n\t\t\t\tlinkCtx.tag = tag;\n\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t}\n\t\t\ttagCtx.ctx = extendCtx(tagCtx.ctx, (linkCtx ? linkCtx.view : view).ctx);\n\t\t}\n\t\ttag._er = onError && value;\n\t\ttagHandlersFromProps(tag, tagCtx);\n\n\t\ttagCtx.view = view;\n\n\t\ttag.ctx = tagCtx.ctx || {};\n\t\ttagCtx.ctx = undefined;\n\t\t// Provide this tag on view, for addBindingMarkers on bound tags to add the tag to view._.bnds, associated with the tag id,\n\t\tview._.tag = tag;\n\n\t\tvalue = tag.cvtArgs(tag.convert || converter !== \"true\" && converter)[0]; // If there is a convertBack but no convert, converter will be \"true\"\n\n\t\t// Call onRender (used by JsViews if present, to add binding annotations around rendered content)\n\t\tvalue = boundTag && view._.onRender\n\t\t\t? view._.onRender(value, view, boundTag)\n\t\t\t: value;\n\t\tview._.tag = undefined;\n\t}\n\treturn value != undefined ? value : \"\";\n}\n\nfunction convertArgs(converter) {\n\tvar tag = this,\n\t\ttagCtx = tag.tagCtx,\n\t\tview = tagCtx.view,\n\t\targs = tagCtx.args;\n\n\tconverter = tag.convert || converter;\n\tconverter = converter && (\"\" + converter === converter\n\t\t? (view.getRsc(\"converters\", converter) || error(\"Unknown converter: '\" + converter + \"'\"))\n\t\t: converter);\n\n\targs = !args.length && !tagCtx.index // On the opening tag with no args, bind to the current data context\n\t\t? [view.data]\n\t\t: converter\n\t\t\t? args.slice() // If there is a converter, use a copy of the tagCtx.args array for rendering, and replace the args[0] in\n\t\t\t// the copied array with the converted value. But we do not modify the value of tag.tagCtx.args[0] (the original args array)\n\t\t\t: args; // If no converter, get the original tagCtx.args\n\n\tif (converter) {\n\t\tif (converter.depends) {\n\t\t\ttag.depends = $sub.getDeps(tag.depends, tag, converter.depends, converter);\n\t\t}\n\t\targs[0] = converter.apply(tag, args);\n\t}\n\treturn args;\n}\n\n//=============\n// views._tag\n//=============\n\nfunction getResource(resourceType, itemName) {\n\tvar res, store,\n\t\tview = this;\n\twhile ((res === undefined) && view) {\n\t\tstore = view.tmpl && view.tmpl[resourceType];\n\t\tres = store && store[itemName];\n\t\tview = view.parent;\n\t}\n\treturn res || $views[resourceType][itemName];\n}\n\nfunction renderTag(tagName, parentView, tmpl, tagCtxs, isUpdate, onError) {\n\tparentView = parentView || topView;\n\tvar tag, tag_, tagDef, template, tags, attr, parentTag, i, l, itemRet, tagCtx, tagCtxCtx, content, callInit, mapDef, thisMap, args, props, initialTmpl, tagDataMap,\n\t\tret = \"\",\n\t\tlinkCtx = parentView.linkCtx || 0,\n\t\tctx = parentView.ctx,\n\t\tparentTmpl = tmpl || parentView.tmpl,\n\t\t// if tagCtx is an integer, then it is the key for the compiled function to return the boundTag tagCtxs\n\t\tboundTag = typeof tagCtxs === \"number\" && parentView.tmpl.bnds[tagCtxs-1];\n\n\tif (tagName._is === \"tag\") {\n\t\ttag = tagName;\n\t\ttagName = tag.tagName;\n\t\ttagCtxs = tag.tagCtxs;\n\t\ttemplate = tag.template;\n\t} else {\n\t\ttagDef = parentView.getRsc(\"tags\", tagName) || error(\"Unknown tag: {{\" + tagName + \"}} \");\n\t\ttemplate = tagDef.template;\n\t}\n\n\tif (onError !== undefined) {\n\t\tret += onError;\n\t\ttagCtxs = onError = [{props: {}, args: []}];\n\t} else if (boundTag) {\n\t\ttagCtxs = boundTag(parentView.data, parentView, $views);\n\t}\n\n\tl = tagCtxs.length;\n\tfor (i = 0; i < l; i++) {\n\t\ttagCtx = tagCtxs[i];\n\t\tif (!linkCtx || !linkCtx.tag || i && !linkCtx.tag._.inline || tag._er) {\n\t\t\t// Initialize tagCtx\n\t\t\t// For block tags, tagCtx.tmpl is an integer > 0\n\t\t\tif (content = tagCtx.tmpl) {\n\t\t\t\tcontent = tagCtx.content = parentTmpl.tmpls[content - 1];\n\t\t\t}\n\t\t\ttagCtx.index = i;\n\t\t\ttagCtx.tmpl = template || content; // Set the tmpl property to the content of the block tag\n\t\t\ttagCtx.render = renderContent;\n\t\t\ttagCtx.view = parentView;\n\t\t\ttagCtx.ctx = extendCtx(tagCtx.ctx, ctx); // Clone and extend parentView.ctx\n\t\t}\n\t\tif (tmpl = tagCtx.props.tmpl) {\n\t\t\t// If the tmpl property is overridden, set the value (when initializing, or, in case of binding: ^tmpl=..., when updating)\n\t\t\ttmpl = \"\" + tmpl === tmpl // if a string\n\t\t\t\t? parentView.getRsc(\"templates\", tmpl) || $templates(tmpl)\n\t\t\t\t: tmpl;\n\n\t\t\ttagCtx.tmpl = tmpl;\n\t\t}\n\n\t\tif (!tag) {\n\t\t\t// This will only be hit for initial tagCtx (not for {{else}}) - if the tag instance does not exist yet\n\t\t\t// Instantiate tag if it does not yet exist\n\t\t\t// If the tag has not already been instantiated, we will create a new instance.\n\t\t\t// ~tag will access the tag, even within the rendering of the template content of this tag.\n\t\t\t// From child/descendant tags, can access using ~tag.parent, or ~parentTags.tagName\n\t\t\ttag = new tagDef._ctr();\n\t\t\tcallInit = !!tag.init;\n\n\t\t\ttag.parent = parentTag = ctx && ctx.tag;\n\t\t\ttag.tagCtxs = tagCtxs;\n\t\t\ttagDataMap = tag.dataMap;\n\n\t\t\tif (linkCtx) {\n\t\t\t\ttag._.inline = false;\n\t\t\t\tlinkCtx.tag = tag;\n\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t}\n\t\t\tif (tag._.bnd = boundTag || linkCtx.fn) {\n\t\t\t\t// Bound if {^{tag...}} or data-link=\"{tag...}\"\n\t\t\t\ttag._.arrVws = {};\n\t\t\t} else if (tag.dataBoundOnly) {\n\t\t\t\terror(\"{^{\" + tagName + \"}} tag must be data-bound\");\n\t\t\t}\n\t\t\t//TODO better perf for childTags() - keep child tag.tags array, (and remove child, when disposed)\n\t\t\t// tag.tags = [];\n\t\t}\n\t\ttagCtxs = tag.tagCtxs;\n\t\ttagDataMap = tag.dataMap;\n\n\t\ttagCtx.tag = tag;\n\t\tif (tagDataMap && tagCtxs) {\n\t\t\ttagCtx.map = tagCtxs[i].map; // Copy over the compiled map instance from the previous tagCtxs to the refreshed ones\n\t\t}\n\t\tif (!tag.flow) {\n\t\t\ttagCtxCtx = tagCtx.ctx = tagCtx.ctx || {};\n\n\t\t\t// tags hash: tag.ctx.tags, merged with parentView.ctx.tags,\n\t\t\ttags = tag.parents = tagCtxCtx.parentTags = ctx && extendCtx(tagCtxCtx.parentTags, ctx.parentTags) || {};\n\t\t\tif (parentTag) {\n\t\t\t\ttags[parentTag.tagName] = parentTag;\n\t\t\t\t//TODO better perf for childTags: parentTag.tags.push(tag);\n\t\t\t}\n\t\t\ttags[tag.tagName] = tagCtxCtx.tag = tag;\n\t\t}\n\t}\n\tif (boundTag || linkCtx) {\n\t\t// Provide this tag on view, for addBindingMarkers on bound tags to add the tag to view._.bnds, associated with the tag id\n\t\tparentView._.tag = tag;\n\t}\n\tif (!(tag._er = onError)) {\n\t\ttagHandlersFromProps(tag, tagCtxs[0]);\n\t\ttag.rendering = {}; // Provide object for state during render calls to tag and elses. (Used by {{if}} and {{for}}...)\n\t\tfor (i = 0; i < l; i++) {\n\t\t\ttagCtx = tag.tagCtx = tagCtxs[i];\n\t\t\tprops = tagCtx.props;\n\t\t\targs = tag.cvtArgs();\n\n\t\t\tif (mapDef = props.dataMap || tagDataMap) {\n\t\t\t\tif (args.length || props.dataMap) {\n\t\t\t\t\tthisMap = tagCtx.map;\n\t\t\t\t\tif (!thisMap || thisMap.src !== args[0] || isUpdate) {\n\t\t\t\t\t\tif (thisMap && thisMap.src) {\n\t\t\t\t\t\t\tthisMap.unmap(); // only called if observable map - not when only used in JsRender, e.g. by {{props}}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthisMap = tagCtx.map = mapDef.map(args[0], props, undefined, !tag._.bnd);\n\t\t\t\t\t}\n\t\t\t\t\targs = [thisMap.tgt];\n\t\t\t\t}\n\t\t\t}\n\t\t\ttag.ctx = tagCtx.ctx;\n\n\t\t\tif (!i) {\n\t\t\t\tif (callInit) {\n\t\t\t\t\tinitialTmpl = tag.template;\n\t\t\t\t\ttag.init(tagCtx, linkCtx, tag.ctx);\n\t\t\t\t\tcallInit = undefined;\n\t\t\t\t\tif (tag.template !== initialTmpl) {\n\t\t\t\t\t\ttag._.tmpl = tag.template; // This will override the tag.template and also tagCtx.props.tmpl for all tagCtxs\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (linkCtx) {\n\t\t\t\t\t// Set attr on linkCtx to ensure outputting to the correct target attribute.\n\t\t\t\t\t// Setting either linkCtx.attr or this.attr in the init() allows per-instance choice of target attrib.\n\t\t\t\t\tlinkCtx.attr = tag.attr = linkCtx.attr || tag.attr;\n\t\t\t\t}\n\t\t\t\tattr = tag.attr;\n\t\t\t\ttag._.noVws = attr && attr !== HTML;\n\t\t\t}\n\n\t\t\titemRet = undefined;\n\t\t\tif (tag.render) {\n\t\t\t\titemRet = tag.render.apply(tag, args);\n\t\t\t}\n\t\t\tif (!args.length) {\n\t\t\t\targs = [parentView]; // no arguments - get data context from view.\n\t\t\t}\n\t\t\tif (itemRet === undefined) {\n\t\t\t\titemRet = tagCtx.render(args.length ? args[0] : parentView, true) || (isUpdate ? undefined : \"\");\n\t\t\t}\n\t\t\t// No return value from render, and no template/content tagCtx.render(...), so return undefined\n\t\t\tret = ret ? ret + (itemRet || \"\") : itemRet; // If no rendered content, this will be undefined\n\t\t}\n\t\ttag.rendering = undefined;\n\t}\n\ttag.tagCtx = tagCtxs[0];\n\ttag.ctx = tag.tagCtx.ctx;\n\n\tif (tag._.noVws) {\n\t\t\tif (tag._.inline) {\n\t\t\t// inline tag with attr set to \"text\" will insert HTML-encoded content - as if it was element-based innerText\n\t\t\tret = attr === \"text\"\n\t\t\t\t? $converters.html(ret)\n\t\t\t\t: \"\";\n\t\t}\n\t}\n\treturn boundTag && parentView._.onRender\n\t\t// Call onRender (used by JsViews if present, to add binding annotations around rendered content)\n\t\t? parentView._.onRender(ret, parentView, boundTag)\n\t\t: ret;\n}\n\n//=================\n// View constructor\n//=================\n\nfunction View(context, type, parentView, data, template, key, contentTmpl, onRender) {\n\t// Constructor for view object in view hierarchy. (Augmented by JsViews if JsViews is loaded)\n\tvar views, parentView_, tag, self_,\n\t\tself = this,\n\t\tisArray = type === \"array\";\n\n\tself.content = contentTmpl;\n\tself.views = isArray ? [] : {};\n\tself.parent = parentView;\n\tself.type = type || \"top\";\n\tself.data = data;\n\tself.tmpl = template;\n\t// If the data is an array, this is an 'array view' with a views array for each child 'item view'\n\t// If the data is not an array, this is an 'item view' with a views 'hash' object for any child nested views\n\t// ._.useKey is non zero if is not an 'array view' (owning a data array). Use this as next key for adding to child views hash\n\t\tself_ = self._ = {\n\t\tkey: 0,\n\t\tuseKey: isArray ? 0 : 1,\n\t\tid: \"\" + viewId++,\n\t\tonRender: onRender,\n\t\tbnds: {}\n\t};\n\tself.linked = !!onRender;\n\tif (parentView) {\n\t\tviews = parentView.views;\n\t\tparentView_ = parentView._;\n\t\tif (parentView_.useKey) {\n\t\t\t// Parent is an 'item view'. Add this view to its views object\n\t\t\t// self._key = is the key in the parent view hash\n\t\t\tviews[self_.key = \"_\" + parentView_.useKey++] = self;\n\t\t\tself.index = indexStr;\n\t\t\tself.getIndex = getNestedIndex;\n\t\t\ttag = parentView_.tag;\n\t\t\tself_.bnd = isArray && (!tag || !!tag._.bnd && tag); // For array views that are data bound for collection change events, set the\n\t\t\t// view._.bnd property to true for top-level link() or data-link=\"{for}\", or to the tag instance for a data-bound tag, e.g. {^{for ...}}\n\t\t} else if (views.length === (self_.key = self.index = key)) { // Parent is an 'array view'. Add this view to its views array\n\t\t\tviews.push(self); // Use push when possible (better perf than splice)\n\t\t} else {\n\t\t\tviews.splice(key, 0, self);\n\t\t}\n\t\t// If no context was passed in, use parent context\n\t\t// If context was passed in, it should have been merged already with parent context\n\t\tself.ctx = context || parentView.ctx;\n\t} else {\n\t\tself.ctx = context;\n\t}\n}\n\nView.prototype = {\n\tget: getView,\n\tgetIndex: getIndex,\n\tgetRsc: getResource,\n\thlp: getHelper,\n\t_is: \"view\"\n};\n\n//=============\n// Registration\n//=============\n\nfunction compileChildResources(parentTmpl) {\n\tvar storeName, resources, resourceName, resource, settings, compile, onStore;\n\tfor (storeName in jsvStores) {\n\t\tsettings = jsvStores[storeName];\n\t\tif ((compile = settings.compile) && (resources = parentTmpl[storeName + \"s\"])) {\n\t\t\tfor (resourceName in resources) {\n\t\t\t\t// compile child resource declarations (templates, tags, tags[\"for\"] or helpers)\n\t\t\t\tresource = resources[resourceName] = compile(resourceName, resources[resourceName], parentTmpl, 0);\n\t\t\t\tresource._is = storeName; // Only do this for compiled objects (tags, templates...)\n\t\t\t\tif (resource && (onStore = $sub.onStore[storeName])) {\n\t\t\t\t\t// e.g. JsViews integration\n\t\t\t\t\tonStore(resourceName, resource, compile);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction compileTag(name, tagDef, parentTmpl) {\n\tvar tmpl, baseTag, prop,\n\t\tcompiledDef = new $sub._tg();\n\n\tfunction Tag() {\n\t\tvar tag = this;\n\t\ttag._ = {\n\t\t\tinline: true,\n\t\t\tunlinked: true\n\t\t};\n\n\t\ttag.tagName = name;\n\t}\n\n\tif ($isFunction(tagDef)) {\n\t\t// Simple tag declared as function. No presenter instantation.\n\t\ttagDef = {\n\t\t\tdepends: tagDef.depends,\n\t\t\trender: tagDef\n\t\t};\n\t} else if (\"\" + tagDef === tagDef) {\n\t\ttagDef = {template: tagDef};\n\t}\n\tif (baseTag = tagDef.baseTag) {\n\t\ttagDef.flow = !!tagDef.flow; // Set flow property, so defaults to false even if baseTag has flow=true\n\t\ttagDef.baseTag = baseTag = \"\" + baseTag === baseTag\n\t\t\t? (parentTmpl && parentTmpl.tags[baseTag] || $tags[baseTag])\n\t\t\t: baseTag;\n\n\t\tcompiledDef = $extend(compiledDef, baseTag);\n\n\t\tfor (prop in tagDef) {\n\t\t\tcompiledDef[prop] = getMethod(baseTag[prop], tagDef[prop]);\n\t\t}\n\t} else {\n\t\tcompiledDef = $extend(compiledDef, tagDef);\n\t}\n\n\t// Tag declared as object, used as the prototype for tag instantiation (control/presenter)\n\tif ((tmpl = compiledDef.template) !== undefined) {\n\t\tcompiledDef.template = \"\" + tmpl === tmpl ? ($templates[tmpl] || $templates(tmpl)) : tmpl;\n\t}\n\tif (compiledDef.init !== false) {\n\t\t// Set init: false on tagDef if you want to provide just a render method, or render and template, but no constuctor or prototype.\n\t\t// so equivalent to setting tag to render function, except you can also provide a template.\n\t\t(Tag.prototype = compiledDef).constructor = compiledDef._ctr = Tag;\n\t}\n\n\tif (parentTmpl) {\n\t\tcompiledDef._parentTmpl = parentTmpl;\n\t}\n\treturn compiledDef;\n}\n\nfunction baseApply(args) {\n\t// In derived method (or handler declared declaratively as in {{:foo onChange=~fooChanged}} can call base method,\n\t// using this.baseApply(arguments) (Equivalent to this._superApply(arguments) in jQuery UI)\n\treturn this.base.apply(this, args);\n}\n\nfunction compileTmpl(name, tmpl, parentTmpl, options) {\n\t// tmpl is either a template object, a selector for a template script block, the name of a compiled template, or a template object\n\n\t//==== nested functions ====\n\tfunction lookupTemplate(value) {\n\t\t// If value is of type string - treat as selector, or name of compiled template\n\t\t// Return the template object, if already compiled, or the markup string\n\t\tvar currentName, tmpl;\n\t\tif ((\"\" + value === value) || value.nodeType > 0 && (elem = value)) {\n\t\t\tif (!elem) {\n\t\t\t\tif (/^\\.\\/[^\\\\:*?\"<>]*$/.test(value)) {\n\t\t\t\t\t// tmpl=\"./some/file.html\"\n\t\t\t\t\t// If the template is not named, use \"./some/file.html\" as name.\n\t\t\t\t\tif (tmpl = $templates[name = name || value]) {\n\t\t\t\t\t\tvalue = tmpl;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// BROWSER-SPECIFIC CODE (not on Node.js):\n\t\t\t\t\t\t// Look for server-generated script block with id \"./some/file.html\"\n\t\t\t\t\t\telem = document.getElementById(value);\n\t\t\t\t\t}\n\t\t\t\t} else if ($.fn && !rTmplString.test(value)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\telem = $(document).find(value)[0]; // if jQuery is loaded, test for selector returning elements, and get first element\n\t\t\t\t\t} catch (e) {}\n\t\t\t\t}// END BROWSER-SPECIFIC CODE\n\t\t\t} //BROWSER-SPECIFIC CODE\n\t\t\tif (elem) {\n\t\t\t\t// Generally this is a script element.\n\t\t\t\t// However we allow it to be any element, so you can for example take the content of a div,\n\t\t\t\t// use it as a template, and replace it by the same content rendered against data.\n\t\t\t\t// e.g. for linking the content of a div to a container, and using the initial content as template:\n\t\t\t\t// $.link(\"#content\", model, {tmpl: \"#content\"});\n\t\t\t\tif (options) {\n\t\t\t\t\t// We will compile a new template using the markup in the script element\n\t\t\t\t\tvalue = elem.innerHTML;\n\t\t\t\t} else {\n\t\t\t\t\t// We will cache a single copy of the compiled template, and associate it with the name\n\t\t\t\t\t// (renaming from a previous name if there was one).\n\t\t\t\t\tcurrentName = elem.getAttribute(tmplAttr);\n\t\t\t\t\tif (currentName) {\n\t\t\t\t\t\tif (currentName !== jsvTmpl) {\n\t\t\t\t\t\t\tvalue = $templates[currentName];\n\t\t\t\t\t\t\tdelete $templates[currentName];\n\t\t\t\t\t\t} else if ($.fn) {\n\t\t\t\t\t\t\tvalue = $.data(elem)[jsvTmpl];\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tname = name || ($.fn ? jsvTmpl : value);\n\t\t\t\t\t\tvalue = compileTmpl(name, elem.innerHTML, parentTmpl, options);\n\t\t\t\t\t}\n\t\t\t\t\tvalue.tmplName = name = name || currentName;\n\t\t\t\t\tif (name !== jsvTmpl) {\n\t\t\t\t\t\t$templates[name] = value;\n\t\t\t\t\t}\n\t\t\t\t\telem.setAttribute(tmplAttr, name);\n\t\t\t\t\tif ($.fn) {\n\t\t\t\t\t\t$.data(elem, jsvTmpl, value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} // END BROWSER-SPECIFIC CODE\n\t\t\telem = undefined;\n\t\t} else if (!value.fn) {\n\t\t\tvalue = undefined;\n\t\t\t// If value is not a string. HTML element, or compiled template, return undefined\n\t\t}\n\t\treturn value;\n\t}\n\n\tvar elem, compiledTmpl,\n\t\ttmplOrMarkup = tmpl = tmpl || \"\";\n\n\t//==== Compile the template ====\n\tif (options === 0) {\n\t\toptions = undefined;\n\t\ttmplOrMarkup = lookupTemplate(tmplOrMarkup); // Top-level compile so do a template lookup\n\t}\n\n\t// If options, then this was already compiled from a (script) element template declaration.\n\t// If not, then if tmpl is a template object, use it for options\n\toptions = options || (tmpl.markup ? tmpl : {});\n\toptions.tmplName = name;\n\tif (parentTmpl) {\n\t\toptions._parentTmpl = parentTmpl;\n\t}\n\t// If tmpl is not a markup string or a selector string, then it must be a template object\n\t// In that case, get it from the markup property of the object\n\tif (!tmplOrMarkup && tmpl.markup && (tmplOrMarkup = lookupTemplate(tmpl.markup))) {\n\t\tif (tmplOrMarkup.fn) {\n\t\t\t// If the string references a compiled template object, need to recompile to merge any modified options\n\t\t\ttmplOrMarkup = tmplOrMarkup.markup;\n\t\t}\n\t}\n\tif (tmplOrMarkup !== undefined) {\n\t\tif (tmplOrMarkup.fn || tmpl.fn) {\n\t\t\t// tmpl is already compiled, so use it\n\t\t\tif (tmplOrMarkup.fn) {\n\t\t\t\tcompiledTmpl = tmplOrMarkup;\n\t\t\t}\n\t\t} else {\n\t\t\t// tmplOrMarkup is a markup string, not a compiled template\n\t\t\t// Create template object\n\t\t\ttmpl = tmplObject(tmplOrMarkup, options);\n\t\t\t// Compile to AST and then to compiled function\n\t\t\ttmplFn(tmplOrMarkup.replace(rEscapeQuotes, \"\\\\$&\"), tmpl);\n\t\t}\n\t\tif (!compiledTmpl) {\n\t\t\tcompileChildResources(options);\n\n\t\t\tcompiledTmpl = $extend(function() {\n\t\t\t\treturn tmpl.render.apply(tmpl, arguments);\n\t\t\t}, tmpl);\n\t\t}\n\t\tif (name && !parentTmpl && name !== jsvTmpl) {\n\t\t\t$render[name] = compiledTmpl;\n\t\t}\n\t\treturn compiledTmpl;\n\t}\n}\n\nfunction dataMap(mapDef) {\n\tfunction Map(source, options) {\n\t\tthis.tgt = mapDef.getTgt(source, options);\n\t}\n\n\tif ($isFunction(mapDef)) {\n\t\t// Simple map declared as function\n\t\tmapDef = {\n\t\t\tgetTgt: mapDef\n\t\t};\n\t}\n\n\tif (mapDef.baseMap) {\n\t\tmapDef = $extend($extend({}, mapDef.baseMap), mapDef);\n\t}\n\n\tmapDef.map = function(source, options) {\n\t\treturn new Map(source, options);\n\t};\n\treturn mapDef;\n}\n\n//==== /end of function compile ====\n\nfunction tmplObject(markup, options) {\n\t// Template object constructor\n\tvar htmlTag,\n\t\twrapMap = $viewsSettings.wrapMap || {}, // Only used in JsViews. Otherwise empty: {}\n\t\ttmpl = $extend(\n\t\t\t{\n\t\t\t\ttmpls: [],\n\t\t\t\tlinks: {}, // Compiled functions for link expressions\n\t\t\t\tbnds: [],\n\t\t\t\t_is: \"template\",\n\t\t\t\trender: renderContent\n\t\t\t},\n\t\t\toptions\n\t\t);\n\n\ttmpl.markup = markup;\n\tif (!options.htmlTag) {\n\t\t// Set tmpl.tag to the top-level HTML tag used in the template, if any...\n\t\thtmlTag = rFirstElem.exec(markup);\n\t\ttmpl.htmlTag = htmlTag ? htmlTag[1].toLowerCase() : \"\";\n\t}\n\thtmlTag = wrapMap[tmpl.htmlTag];\n\tif (htmlTag && htmlTag !== wrapMap.div) {\n\t\t// When using JsViews, we trim templates which are inserted into HTML contexts where text nodes are not rendered (i.e. not 'Phrasing Content').\n\t\t// Currently not trimmed for <li> tag. (Not worth adding perf cost)\n\t\ttmpl.markup = $.trim(tmpl.markup);\n\t}\n\n\treturn tmpl;\n}\n\nfunction registerStore(storeName, storeSettings) {\n\n\tfunction theStore(name, item, parentTmpl) {\n\t\t// The store is also the function used to add items to the store. e.g. $.templates, or $.views.tags\n\n\t\t// For store of name 'thing', Call as:\n\t\t// $.views.things(items[, parentTmpl]),\n\t\t// or $.views.things(name, item[, parentTmpl])\n\n\t\tvar onStore, compile, itemName, thisStore;\n\n\t\tif (name && typeof name === OBJECT && !name.nodeType && !name.markup && !name.getTgt) {\n\t\t\t// Call to $.views.things(items[, parentTmpl]),\n\n\t\t\t// Adding items to the store\n\t\t\t// If name is a hash, then item is parentTmpl. Iterate over hash and call store for key.\n\t\t\tfor (itemName in name) {\n\t\t\t\ttheStore(itemName, name[itemName], item);\n\t\t\t}\n\t\t\treturn $views;\n\t\t}\n\t\t// Adding a single unnamed item to the store\n\t\tif (item === undefined) {\n\t\t\titem = name;\n\t\t\tname = undefined;\n\t\t}\n\t\tif (name && \"\" + name !== name) { // name must be a string\n\t\t\tparentTmpl = item;\n\t\t\titem = name;\n\t\t\tname = undefined;\n\t\t}\n\t\tthisStore = parentTmpl ? parentTmpl[storeNames] = parentTmpl[storeNames] || {} : theStore;\n\t\tcompile = storeSettings.compile;\n\t\tif (item === null) {\n\t\t\t// If item is null, delete this entry\n\t\t\tif (name) {\n\t\t\t\tdelete thisStore[name];\n\t\t\t}\n\t\t} else {\n\t\t\titem = compile ? compile(name, item, parentTmpl, 0) : item;\n\t\t\tif (name) {\n\t\t\t\tthisStore[name] = item;\n\t\t\t}\n\t\t}\n\t\tif (compile && item) {\n\t\t\titem._is = storeName; // Only do this for compiled objects (tags, templates...)\n\t\t}\n\t\tif (item && (onStore = $sub.onStore[storeName])) {\n\t\t\t// e.g. JsViews integration\n\t\t\tonStore(name, item, compile);\n\t\t}\n\t\treturn item;\n\t}\n\n\tvar storeNames = storeName + \"s\";\n\n\t$views[storeNames] = theStore;\n}\n\n//==============\n// renderContent\n//==============\n\nfunction renderContent(data, context, noIteration, parentView, key, onRender) {\n\tvar i, l, tag, tmpl, tagCtx, isTopRenderCall, prevData, prevIndex,\n\t\tview = parentView,\n\t\tresult = \"\";\n\n\tif (context === true) {\n\t\tnoIteration = context; // passing boolean as second 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}\n\n\tif (tag = this.tag) {\n\t\t// This is a call from renderTag or tagCtx.render(...)\n\t\ttagCtx = this;\n\t\ttmpl = tag._.tmpl || tagCtx.tmpl;\n\t\tview = view || tagCtx.view;\n\t\tif (!arguments.length) {\n\t\t\tdata = view;\n\t\t}\n\t} else {\n\t\t// This is a template.render(...) call\n\t\ttmpl = this;\n\t}\n\n\tif (tmpl) {\n\t\tif (!view && data && data._is === \"view\") {\n\t\t\tview = data; // When passing in a view to render or link (and not passing in a parent view) use the passed-in view as parentView\n\t\t}\n\n\t\tif (view) {\n\t\t\tif (data === view) {\n\t\t\t\t// Inherit the data from the parent view.\n\t\t\t\t// This may be the contents of an {{if}} block\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t}\n\n\t\tif (!tmpl.fn) {\n\t\t\t// Template has not been compiled yet, so compile it.\n\t\t\ttmpl = tag._.tmpl = $templates[tmpl] || $templates(tmpl);\n\t\t}\n\n\t\tisTopRenderCall = !view;\n\t\tisRenderCall = isRenderCall || isTopRenderCall;\n\t\tif (!view) {\n\t\t\t(context = context || {}).root = data; // Provide ~root as shortcut to top-level data.\n\t\t}\n\t\tif (!isRenderCall || $viewsSettings.useViews || tmpl.useViews || view && view !== topView) {\n\t\t\tresult = renderWithViews(tmpl, data, context, noIteration, view, key, onRender, tag);\n\t\t} else {\n\t\t\tif (view) { // In a block\n\t\t\t\tprevData = view.data;\n\t\t\t\tprevIndex = view.index;\n\t\t\t\tview.index = indexStr;\n\t\t\t} else {\n\t\t\t\tview = topView;\n\t\t\t\tview.data = data;\n\t\t\t\tview.ctx = context;\n\t\t\t}\n\t\t\tif ($isArray(data) && !noIteration) {\n\t\t\t\t// Create a view for the array, whose child views correspond to each data item. (Note: if key and parentView are passed in\n\t\t\t\t// along with parent view, treat as insert -e.g. from view.addViews - so parentView is already the view item for array)\n\t\t\t\tfor (i = 0, l = data.length; i < l; i++) {\n\t\t\t\t\tview.index = i;\n\t\t\t\t\tview.data = data[i];\n\t\t\t\t\tresult += tmpl.fn(data[i], view, $views);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tresult += tmpl.fn(data, view, $views);\n\t\t\t}\n\t\t\tview.data = prevData;\n\t\t\tview.index = prevIndex;\n\t\t}\n\t\tif (isTopRenderCall) {\n\t\t\tisRenderCall = undefined;\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction renderWithViews(tmpl, data, context, noIteration, view, key, onRender, tag) {\n\tfunction setItemVar(item) {\n\t\t// When itemVar is specified, set modified ctx with user-named ~item\n\t\tnewCtx = $extend({}, context);\n\t\tnewCtx[itemVar] = item;\n\t}\n\n\t// Render template against data as a tree of subviews (nested rendered template instances), or as a string (top-level template).\n\t// If the data is the parent view, treat as noIteration, re-render with the same data context.\n\tvar i, l, newView, childView, itemResult, swapContent, contentTmpl, outerOnRender, tmplName, itemVar, newCtx, tagCtx,\n\t\tresult=\"\" ;\n\n\tif (tag) {\n\t\t// This is a call from renderTag or tagCtx.render(...)\n\t\ttmplName = tag.tagName;\n\t\ttagCtx = tag.tagCtx;\n\t\tcontext = context ? extendCtx(context, tag.ctx) : tag.ctx;\n\t\tcontentTmpl = tagCtx.content;\n\t\tif (tagCtx.props.link === false) {\n\t\t\t// link=false setting on block tag\n\t\t\t// We will override inherited value of link by the explicit setting link=false taken from props\n\t\t\t// The child views of an unlinked view are also unlinked. So setting child back to true will not have any effect.\n\t\t\tcontext = context || {};\n\t\t\tcontext.link = false;\n\t\t}\n\t\tif (itemVar = tagCtx.props.itemVar) {\n\t\t\tif (itemVar.charAt(0) !== \"~\") {\n\t\t\t\tsyntaxError(\"Use itemVar='~myItem'\");\n\t\t\t}\n\t\t\titemVar = itemVar.slice(1);\n\t\t}\n\t}\n\n\tif (view) {\n\t\tcontentTmpl = contentTmpl || view.content; // The wrapped content - to be added as #content property on views, below\n\t\tonRender = onRender || view._.onRender;\n\t\tcontext = context || view.ctx;\n\t}\n\n\tif (key === true) {\n\t\tswapContent = true;\n\t\tkey = 0;\n\t}\n\n\t// If link===false, do not call onRender, so no data-linking marker nodes\n\tif (onRender && (context && context.link === false || tag && tag._.noVws)) {\n\t\tonRender = undefined;\n\t}\n\touterOnRender = onRender;\n\tif (onRender === true) {\n\t\t// Used by view.refresh(). Don't create a new wrapper view.\n\t\touterOnRender = undefined;\n\t\tonRender = view._.onRender;\n\t}\n\t// Set additional context on views created here, (as modified context inherited from the parent, and to be inherited by child views)\n\tcontext = tmpl.helpers\n\t\t? extendCtx(tmpl.helpers, context)\n\t\t: context;\n\n\tnewCtx = context;\n\tif ($isArray(data) && !noIteration) {\n\t\t// Create a view for the array, whose child views correspond to each data item. (Note: if key and view are passed in\n\t\t// along with parent view, treat as insert -e.g. from view.addViews - so view is already the view item for array)\n\t\tnewView = swapContent\n\t\t\t? view\n\t\t\t: (key !== undefined && view)\n\t\t\t\t|| new View(context, \"array\", view, data, tmpl, key, contentTmpl, onRender);\n\t\tif (itemVar) {\n\t\t\tnewView.it = itemVar;\n\t\t}\n\t\titemVar = newView.it;\n\t\tfor (i = 0, l = data.length; i < l; i++) {\n\t\t\t// Create a view for each data item.\n\t\t\tif (itemVar) {\n\t\t\t\tsetItemVar(data[i]); // use modified ctx with user-named ~item\n\t\t\t}\n\t\t\tchildView = new View(newCtx, \"item\", newView, data[i], tmpl, (key || 0) + i, contentTmpl, onRender);\n\n\t\t\titemResult = tmpl.fn(data[i], childView, $views);\n\t\t\tresult += newView._.onRender ? newView._.onRender(itemResult, childView) : itemResult;\n\t\t}\n\t} else {\n\t\t// Create a view for singleton data object. The type of the view will be the tag name, e.g. \"if\" or \"myTag\" except for\n\t\t// \"item\", \"array\" and \"data\" views. A \"data\" view is from programmatic render(object) against a 'singleton'.\n\t\tif (itemVar) {\n\t\t\tsetItemVar(data);\n\t\t}\n\t\tnewView = swapContent ? view : new View(newCtx, tmplName || \"data\", view, data, tmpl, key, contentTmpl, onRender);\n\t\tif (tag && !tag.flow) {\n\t\t\tnewView.tag = tag;\n\t\t}\n\t\tresult += tmpl.fn(data, newView, $views);\n\t}\n\treturn outerOnRender ? outerOnRender(result, newView) : result;\n}\n\n//===========================\n// Build and compile template\n//===========================\n\n// Generate a reusable function that will serve to render a template against data\n// (Compile AST then build template function)\n\nfunction error(e, view, fallback) {\n\tvar message = $viewsSettings.onError(e, view, fallback);\n\tif (\"\" + e === e) { // if e is a string, not an Exception, then throw new Exception\n\t\tthrow new $sub.Err(message);\n\t}\n\treturn !view.linkCtx && view.linked ? $converters.html(message) : message;\n}\n\nfunction syntaxError(message) {\n\terror(\"Syntax error\\n\" + message);\n}\n\nfunction tmplFn(markup, tmpl, isLinkExpr, convertBack, hasElse) {\n\t// Compile markup to AST (abtract syntax tree) then build the template function code from the AST nodes\n\t// Used for compiling templates, and also by JsViews to build functions for data link expressions\n\n\t//==== nested functions ====\n\tfunction pushprecedingContent(shift) {\n\t\tshift -= loc;\n\t\tif (shift) {\n\t\t\tcontent.push(markup.substr(loc, shift).replace(rNewLine, \"\\\\n\"));\n\t\t}\n\t}\n\n\tfunction blockTagCheck(tagName, block) {\n\t\tif (tagName) {\n\t\t\ttagName += '}}';\n\t\t\t//\t\t\t'{{include}} block has {{/for}} with no open {{for}}'\n\t\t\tsyntaxError((\n\t\t\t\tblock\n\t\t\t\t\t? '{{' + block + '}} block has {{/' + tagName + ' without {{' + tagName\n\t\t\t\t\t: 'Unmatched or missing {{/' + tagName) + ', in template:\\n' + markup);\n\t\t}\n\t}\n\n\tfunction parseTag(all, bind, tagName, converter, colon, html, comment, codeTag, params, slash, closeBlock, index) {\n\n\t\t// bind tag converter colon html comment code params slash closeBlock\n\t\t// /{(\\^)?{(?:(?:(\\w+(?=[\\/\\s}]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^}]|}(?!}))*?)(\\/)?|(?:\\/(\\w+)))}}/g\n\t\t// Build abstract syntax tree (AST): [tagName, converter, params, content, hash, bindings, contentMarkup]\n\t\tif (html) {\n\t\t\tcolon = \":\";\n\t\t\tconverter = HTML;\n\t\t}\n\t\tslash = slash || isLinkExpr && !hasElse;\n\n\t\tvar pathBindings = (bind || isLinkExpr) && [[]],\n\t\t\tprops = \"\",\n\t\t\targs = \"\",\n\t\t\tctxProps = \"\",\n\t\t\tparamsArgs = \"\",\n\t\t\tparamsProps = \"\",\n\t\t\tparamsCtxProps = \"\",\n\t\t\tonError = \"\",\n\t\t\tuseTrigger = \"\",\n\t\t\t// Block tag if not self-closing and not {{:}} or {{>}} (special case) and not a data-link expression\n\t\t\tblock = !slash && !colon && !comment;\n\n\t\t//==== nested helper function ====\n\t\ttagName = tagName || (params = params || \"#data\", colon); // {{:}} is equivalent to {{:#data}}\n\t\tpushprecedingContent(index);\n\t\tloc = index + all.length; // location marker - parsed up to here\n\t\tif (codeTag) {\n\t\t\tif (allowCode) {\n\t\t\t\tcontent.push([\"*\", \"\\n\" + params.replace(/^:/, \"ret+= \").replace(rUnescapeQuotes, \"$1\") + \";\\n\"]);\n\t\t\t}\n\t\t} else if (tagName) {\n\t\t\tif (tagName === \"else\") {\n\t\t\t\tif (rTestElseIf.test(params)) {\n\t\t\t\t\tsyntaxError('for \"{{else if expr}}\" use \"{{else expr}}\"');\n\t\t\t\t}\n\t\t\t\tpathBindings = current[7] && [[]];\n\t\t\t\tcurrent[8] = markup.substring(current[8], index); // contentMarkup for block tag\n\t\t\t\tcurrent = stack.pop();\n\t\t\t\tcontent = current[2];\n\t\t\t\tblock = true;\n\t\t\t}\n\t\t\tif (params) {\n\t\t\t\t// remove newlines from the params string, to avoid compiled code errors for unterminated strings\n\t\t\t\tparseParams(params.replace(rNewLine, \" \"), pathBindings, tmpl)\n\t\t\t\t\t.replace(rBuildHash, function(all, onerror, isCtx, key, keyToken, keyValue, arg, param) {\n\t\t\t\t\t\tkey = \"'\" + keyToken + \"':\";\n\t\t\t\t\t\tif (arg) {\n\t\t\t\t\t\t\targs += keyValue + \",\";\n\t\t\t\t\t\t\tparamsArgs += \"'\" + param + \"',\";\n\t\t\t\t\t\t} else if (isCtx) {\n\t\t\t\t\t\t\tctxProps += key + keyValue + \",\";\n\t\t\t\t\t\t\tparamsCtxProps += key + \"'\" + param + \"',\";\n\t\t\t\t\t\t} else if (onerror) {\n\t\t\t\t\t\t\tonError += keyValue;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (keyToken === \"trigger\") {\n\t\t\t\t\t\t\t\tuseTrigger += keyValue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tprops += key + keyValue + \",\";\n\t\t\t\t\t\t\tparamsProps += key + \"'\" + param + \"',\";\n\t\t\t\t\t\t\thasHandlers = hasHandlers || rHasHandlers.test(keyToken);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn \"\";\n\t\t\t\t\t}).slice(0, -1);\n\t\t\t}\n\n\t\t\tif (pathBindings && pathBindings[0]) {\n\t\t\t\tpathBindings.pop(); // Remove the bindings that was prepared for next arg. (There is always an extra one ready).\n\t\t\t}\n\n\t\t\tnewNode = [\n\t\t\t\t\ttagName,\n\t\t\t\t\tconverter || !!convertBack || hasHandlers || \"\",\n\t\t\t\t\tblock && [],\n\t\t\t\t\tparsedParam(paramsArgs, paramsProps, paramsCtxProps),\n\t\t\t\t\tparsedParam(args, props, ctxProps),\n\t\t\t\t\tonError,\n\t\t\t\t\tuseTrigger,\n\t\t\t\t\tpathBindings || 0\n\t\t\t\t];\n\t\t\tcontent.push(newNode);\n\t\t\tif (block) {\n\t\t\t\tstack.push(current);\n\t\t\t\tcurrent = newNode;\n\t\t\t\tcurrent[8] = loc; // Store current location of open tag, to be able to add contentMarkup when we reach closing tag\n\t\t\t}\n\t\t} else if (closeBlock) {\n\t\t\tblockTagCheck(closeBlock !== current[0] && current[0] !== \"else\" && closeBlock, current[0]);\n\t\t\tcurrent[8] = markup.substring(current[8], index); // contentMarkup for block tag\n\t\t\tcurrent = stack.pop();\n\t\t}\n\t\tblockTagCheck(!current && closeBlock);\n\t\tcontent = current[2];\n\t}\n\t//==== /end of nested functions ====\n\n\tvar result, newNode, hasHandlers,\n\t\tallowCode = $viewsSettings.allowCode || tmpl && tmpl.allowCode,\n\t\tastTop = [],\n\t\tloc = 0,\n\t\tstack = [],\n\t\tcontent = astTop,\n\t\tcurrent = [,,astTop];\n\n\tif (allowCode) {\n\t\ttmpl.allowCode = allowCode;\n\t}\n\n//TODO\tresult = tmplFnsCache[markup]; // Only cache if template is not named and markup length < ...,\n//and there are no bindings or subtemplates?? Consider standard optimization for data-link=\"a.b.c\"\n//\t\tif (result) {\n//\t\t\ttmpl.fn = result;\n//\t\t} else {\n\n//\t\tresult = markup;\n\tif (isLinkExpr) {\n\t\tmarkup = delimOpenChar0 + markup + delimCloseChar1;\n\t}\n\n\tblockTagCheck(stack[0] && stack[0][2].pop()[0]);\n\t// Build the AST (abstract syntax tree) under astTop\n\tmarkup.replace(rTag, parseTag);\n\n\tpushprecedingContent(markup.length);\n\n\tif (loc = astTop[astTop.length - 1]) {\n\t\tblockTagCheck(\"\" + loc !== loc && (+loc[8] === loc[8]) && loc[0]);\n\t}\n//\t\t\tresult = tmplFnsCache[markup] = buildCode(astTop, tmpl);\n//\t\t}\n\n\tif (isLinkExpr) {\n\t\tresult = buildCode(astTop, markup, isLinkExpr);\n\t\tsetPaths(result, [astTop[0][7]]); // With data-link expressions, pathBindings array is astTop[0][7]\n\t} else {\n\t\tresult = buildCode(astTop, tmpl);\n\t}\n\treturn result;\n}\n\nfunction setPaths(fn, pathsArr) {\n\tvar key, paths,\n\t\ti = 0,\n\t\tl = pathsArr.length;\n\tfn.deps = [];\n\tfor (; i < l; i++) {\n\t\tpaths = pathsArr[i];\n\t\tfor (key in paths) {\n\t\t\tif (key !== \"_jsvto\" && paths[key].length) {\n\t\t\t\tfn.deps = fn.deps.concat(paths[key]); // deps is the concatenation of the paths arrays for the different bindings\n\t\t\t}\n\t\t}\n\t}\n\tfn.paths = paths; // The array of paths arrays for the different bindings\n}\n\nfunction parsedParam(args, props, ctx) {\n\treturn [args.slice(0, -1), props.slice(0, -1), ctx.slice(0, -1)];\n}\n\nfunction paramStructure(parts, type) {\n\treturn '\\n\\t'\n\t\t+ (type\n\t\t\t? type + ':{'\n\t\t\t: '')\n\t\t+ 'args:[' + parts[0] + ']'\n\t\t+ (parts[1] || !type\n\t\t\t? ',\\n\\tprops:{' + parts[1] + '}'\n\t\t\t: \"\")\n\t\t+ (parts[2] ? ',\\n\\tctx:{' + parts[2] + '}' : \"\");\n}\n\nfunction parseParams(params, pathBindings, tmpl) {\n\n\tfunction parseTokens(all, lftPrn0, lftPrn, bound, path, operator, err, eq, path2, prn, comma, lftPrn2, apos, quot, rtPrn, rtPrnDot, prn2, space, index, full) {\n\t// /(\\()(?=\\s*\\()|(?:([([])\\s*)?(?:(\\^?)(!*?[#~]?[\\w$.^]+)?\\s*((\\+\\+|--)|\\+|-|&&|\\|\\||===|!==|==|!=|<=|>=|[<>%*:?\\/]|(=))\\s*|(!*?[#~]?[\\w$.^]+)([([])?)|(,\\s*)|(\\(?)\\\\?(?:(')|(\"))|(?:\\s*(([)\\]])(?=\\s*[.^]|\\s*$|\\s)|[)\\]])([([]?))|(\\s+)/g,\n\t// lftPrn0 lftPrn bound path operator err eq path2 prn comma lftPrn2 apos quot rtPrn rtPrnDot prn2 space\n\t\t// (left paren? followed by (path? followed by operator) or (path followed by paren?)) or comma or apos or quot or right paren or space\n\t\tbound = bindings && bound;\n\t\tif (bound && !eq) {\n\t\t\tpath = bound + path; // e.g. some.fn(...)^some.path - so here path is \"^some.path\"\n\t\t}\n\t\toperator = operator || \"\";\n\t\tlftPrn = lftPrn || lftPrn0 || lftPrn2;\n\t\tpath = path || path2;\n\t\t// Could do this - but not worth perf cost?? :-\n\t\t// if (!path.lastIndexOf(\"#data.\", 0)) { path = path.slice(6); } // If path starts with \"#data.\", remove that.\n\t\tprn = prn || prn2 || \"\";\n\n\t\tvar expr, exprFn, binds, theOb, newOb;\n\n\t\tfunction parsePath(allPath, not, object, helper, view, viewProperty, pathTokens, leafToken) {\n\t\t\t// rPath = /^(?:null|true|false|\\d[\\d.]*|(!*?)([\\w$]+|\\.|~([\\w$]+)|#(view|([\\w$]+))?)([\\w$.^]*?)(?:[.[^]([\\w$]+)\\]?)?)$/g,\n\t\t\t// none object helper view viewProperty pathTokens leafToken\n\t\t\tvar subPath = object === \".\";\n\t\t\tif (object) {\n\t\t\t\tpath = path.slice(not.length);\n\t\t\t\tif (!subPath) {\n\t\t\t\t\tallPath = (helper\n\t\t\t\t\t\t\t? 'view.hlp(\"' + helper + '\")'\n\t\t\t\t\t\t\t: view\n\t\t\t\t\t\t\t\t? \"view\"\n\t\t\t\t\t\t\t\t: \"data\")\n\t\t\t\t\t\t+ (leafToken\n\t\t\t\t\t\t\t? (viewProperty\n\t\t\t\t\t\t\t\t? \".\" + viewProperty\n\t\t\t\t\t\t\t\t: helper\n\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t: (view ? \"\" : \".\" + object)\n\t\t\t\t\t\t\t\t) + (pathTokens || \"\")\n\t\t\t\t\t\t\t: (leafToken = helper ? \"\" : view ? viewProperty || \"\" : object, \"\"));\n\n\t\t\t\t\tallPath = allPath + (leafToken ? \".\" + leafToken : \"\");\n\n\t\t\t\t\tallPath = not + (allPath.slice(0, 9) === \"view.data\"\n\t\t\t\t\t\t? allPath.slice(5) // convert #view.data... to data...\n\t\t\t\t\t\t: allPath);\n\t\t\t\t}\n\t\t\t\tif (bindings) {\n\t\t\t\t\tbinds = named === \"linkTo\" ? (bindto = pathBindings._jsvto = pathBindings._jsvto || []) : bndCtx.bd;\n\t\t\t\t\tif (theOb = subPath && binds[binds.length-1]) {\n\t\t\t\t\t\tif (theOb._jsv) {\n\t\t\t\t\t\t\twhile (theOb.sb) {\n\t\t\t\t\t\t\t\ttheOb = theOb.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (theOb.bnd) {\n\t\t\t\t\t\t\t\tpath = \"^\" + path.slice(1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttheOb.sb = path;\n\t\t\t\t\t\t\ttheOb.bnd = theOb.bnd || path.charAt(0) === \"^\";\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbinds.push(path);\n\t\t\t\t\t}\n\t\t\t\t\tpathStart[parenDepth] = index + (subPath ? 1 : 0);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn allPath;\n\t\t}\n\n\t\tif (err && !aposed && !quoted) {\n\t\t\tsyntaxError(params);\n\t\t} else {\n\t\t\tif (bindings && rtPrnDot && !aposed && !quoted) {\n\t\t\t\t// This is a binding to a path in which an object is returned by a helper/data function/expression, e.g. foo()^x.y or (a?b:c)^x.y\n\t\t\t\t// We create a compiled function to get the object instance (which will be called when the dependent data of the subexpression changes, to return the new object, and trigger re-binding of the subsequent path)\n\t\t\t\tif (!named || boundName || bindto) {\n\t\t\t\t\texpr = pathStart[parenDepth - 1];\n\t\t\t\t\tif (full.length - 1 > index - (expr || 0)) { // We need to compile a subexpression\n\t\t\t\t\t\texpr = full.slice(expr, index + all.length);\n\t\t\t\t\t\tif (exprFn !== true) { // If not reentrant call during compilation\n\t\t\t\t\t\t\tbinds = bindto || bndStack[parenDepth-1].bd;\n\t\t\t\t\t\t\t// Insert exprOb object, to be used during binding to return the computed object\n\t\t\t\t\t\t\ttheOb = binds[binds.length-1];\n\t\t\t\t\t\t\tif (theOb && theOb.prm) {\n\t\t\t\t\t\t\t\twhile (theOb.sb && theOb.sb.prm) {\n\t\t\t\t\t\t\t\t\ttheOb = theOb.sb;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnewOb = theOb.sb = {path: theOb.sb, bnd: theOb.bnd};\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbinds.push(newOb = {path: binds.pop()}); // Insert exprOb object, to be used during binding to return the computed object\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t // (e.g. \"some.object()\" in \"some.object().a.b\" - to be used as context for binding the following tokens \"a.b\")\n\t\t\t\t\t\t}\n\t\t\t\t\t\trtPrnDot = delimOpenChar1 + \":\" + expr // The parameter or function subexpression\n\t\t\t\t\t\t\t+ \" onerror=''\" // set onerror='' in order to wrap generated code with a try catch - returning '' as object instance if there is an error/missing parent\n\t\t\t\t\t\t\t+ delimCloseChar0;\n\t\t\t\t\t\texprFn = tmplLinks[rtPrnDot];\n\t\t\t\t\t\tif (!exprFn) {\n\t\t\t\t\t\t\ttmplLinks[rtPrnDot] = true; // Flag that this exprFn (for rtPrnDot) is being compiled\n\t\t\t\t\t\t\ttmplLinks[rtPrnDot] = exprFn = tmplFn(rtPrnDot, tmpl, true); // Compile the expression (or use cached copy already in tmpl.links)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (exprFn !== true && newOb) {\n\t\t\t\t\t\t\t// If not reentrant call during compilation\n\t\t\t\t\t\t\tnewOb._jsv = exprFn;\n\t\t\t\t\t\t\tnewOb.prm = bndCtx.bd;\n\t\t\t\t\t\t\tnewOb.bnd = newOb.bnd || newOb.path && newOb.path.indexOf(\"^\") >= 0;\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\treturn (aposed\n\t\t\t\t// within single-quoted string\n\t\t\t\t? (aposed = !apos, (aposed ? all : lftPrn2 + '\"'))\n\t\t\t\t: quoted\n\t\t\t\t// within double-quoted string\n\t\t\t\t\t? (quoted = !quot, (quoted ? all : lftPrn2 + '\"'))\n\t\t\t\t\t:\n\t\t\t\t(\n\t\t\t\t\t(lftPrn\n\t\t\t\t\t\t? (pathStart[parenDepth] = index++, bndCtx = bndStack[++parenDepth] = {bd: []}, lftPrn)\n\t\t\t\t\t\t: \"\")\n\t\t\t\t\t+ (space\n\t\t\t\t\t\t? (parenDepth\n\t\t\t\t\t\t\t? \"\"\n\t\t\t\t// New arg or prop - so insert backspace \\b (\\x08) as separator for named params, used subsequently by rBuildHash, and prepare new bindings array\n\t\t\t\t\t\t\t: (paramIndex = full.slice(paramIndex, index), named\n\t\t\t\t\t\t\t\t? (named = boundName = bindto = false, \"\\b\")\n\t\t\t\t\t\t\t\t: \"\\b,\") + paramIndex + (paramIndex = index + all.length, bindings && pathBindings.push(bndCtx.bd = []), \"\\b\")\n\t\t\t\t\t\t)\n\t\t\t\t\t\t: eq\n\t\t\t\t// named param. Remove bindings for arg and create instead bindings array for prop\n\t\t\t\t\t\t\t? (parenDepth && syntaxError(params), bindings && pathBindings.pop(), named = path, boundName = bound, paramIndex = index + all.length, bound && (bindings = bndCtx.bd = pathBindings[named] = []), path + ':')\n\t\t\t\t\t\t\t: path\n\t\t\t\t// path\n\t\t\t\t\t\t\t\t? (path.split(\"^\").join(\".\").replace(rPath, parsePath)\n\t\t\t\t\t\t\t\t\t+ (prn\n\t\t\t\t// some.fncall(\n\t\t\t\t\t\t\t\t\t\t? (bndCtx = bndStack[++parenDepth] = {bd: []}, fnCall[parenDepth] = true, prn)\n\t\t\t\t\t\t\t\t\t\t: operator)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: operator\n\t\t\t\t// operator\n\t\t\t\t\t\t\t\t\t? operator\n\t\t\t\t\t\t\t\t\t: rtPrn\n\t\t\t\t// function\n\t\t\t\t\t\t\t\t\t\t? ((fnCall[parenDepth] = false, bndCtx = bndStack[--parenDepth], rtPrn)\n\t\t\t\t\t\t\t\t\t\t\t+ (prn // rtPrn and prn, e.g )( in (a)() or a()(), or )[ in a()[]\n\t\t\t\t\t\t\t\t\t\t\t\t? (bndCtx = bndStack[++parenDepth], fnCall[parenDepth] = true, prn)\n\t\t\t\t\t\t\t\t\t\t\t\t: \"\")\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t: comma\n\t\t\t\t\t\t\t\t\t\t\t? (fnCall[parenDepth] || syntaxError(params), \",\") // We don't allow top-level literal arrays or objects\n\t\t\t\t\t\t\t\t\t\t\t: lftPrn0\n\t\t\t\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t\t\t\t: (aposed = apos, quoted = quot, '\"')\n\t\t\t\t))\n\t\t\t);\n\t\t}\n\t}\n\n\tvar named, bindto, boundName,\n\t\tquoted, // boolean for string content in double quotes\n\t\taposed, // or in single quotes\n\t\tbindings = pathBindings && pathBindings[0], // bindings array for the first arg\n\t\tbndCtx = {bd: bindings},\n\t\tbndStack = {0: bndCtx},\n\t\tparamIndex = 0, // list,\n\t\ttmplLinks = tmpl ? tmpl.links : bindings && (bindings.links = bindings.links || {}),\n\t\t// The following are used for tracking path parsing including nested paths, such as \"a.b(c^d + (e))^f\", and chained computed paths such as\n\t\t// \"a.b().c^d().e.f().g\" - which has four chained paths, \"a.b()\", \"^c.d()\", \".e.f()\" and \".g\"\n\t\tparenDepth = 0,\n\t\tfnCall = {}, // We are in a function call\n\t\tpathStart = {}; // tracks the start of the current path such as c^d() in the above example\n\n\treturn (params + (tmpl ? \" \" : \"\"))\n\t\t.replace(rParams, parseTokens);\n}\n\nfunction buildCode(ast, tmpl, isLinkExpr) {\n\t// Build the template function code from the AST nodes, and set as property on the passed-in template object\n\t// Used for compiling templates, and also by JsViews to build functions for data link expressions\n\tvar i, node, tagName, converter, tagCtx, hasTag, hasEncoder, getsVal, hasCnvt, useCnvt, tmplBindings, pathBindings, params, boundOnErrStart, boundOnErrEnd,\n\t\ttagRender, nestedTmpls, tmplName, nestedTmpl, tagAndElses, content, markup, nextIsElse, oldCode, isElse, isGetVal, tagCtxFn, onError, tagStart, trigger,\n\t\ttmplBindingKey = 0,\n\t\tuseViews = $viewsSettings.useViews || tmpl.useViews || tmpl.tags || tmpl.templates || tmpl.helpers || tmpl.converters,\n\t\tcode = \"\",\n\t\ttmplOptions = {},\n\t\tl = ast.length;\n\n\tif (\"\" + tmpl === tmpl) {\n\t\ttmplName = isLinkExpr ? 'data-link=\"' + tmpl.replace(rNewLine, \" \").slice(1, -1) + '\"' : tmpl;\n\t\ttmpl = 0;\n\t} else {\n\t\ttmplName = tmpl.tmplName || \"unnamed\";\n\t\tif (tmpl.allowCode) {\n\t\t\ttmplOptions.allowCode = true;\n\t\t}\n\t\tif (tmpl.debug) {\n\t\t\ttmplOptions.debug = true;\n\t\t}\n\t\ttmplBindings = tmpl.bnds;\n\t\tnestedTmpls = tmpl.tmpls;\n\t}\n\tfor (i = 0; i < l; i++) {\n\t\t// AST nodes: [0: tagName, 1: converter, 2: content, 3: params, 4: code, 5: onError, 6: trigger, 7:pathBindings, 8: contentMarkup]\n\t\tnode = ast[i];\n\n\t\t// Add newline for each callout to t() c() etc. and each markup string\n\t\tif (\"\" + node === node) {\n\t\t\t// a markup string to be inserted\n\t\t\tcode += '\\n+\"' + node + '\"';\n\t\t} else {\n\t\t\t// a compiled tag expression to be inserted\n\t\t\ttagName = node[0];\n\t\t\tif (tagName === \"*\") {\n\t\t\t\t// Code tag: {{* }}\n\t\t\t\tcode += \";\\n\" + node[1] + \"\\nret=ret\";\n\t\t\t} else {\n\t\t\t\tconverter = node[1];\n\t\t\t\tcontent = !isLinkExpr && node[2];\n\t\t\t\ttagCtx = paramStructure(node[3], 'params') + '},' + paramStructure(params = node[4]);\n\t\t\t\tonError = node[5];\n\t\t\t\ttrigger = node[6];\n\t\t\t\tmarkup = node[8] && node[8].replace(rUnescapeQuotes, \"$1\");\n\t\t\t\tif (isElse = tagName === \"else\") {\n\t\t\t\t\tif (pathBindings) {\n\t\t\t\t\t\tpathBindings.push(node[7]);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttmplBindingKey = 0;\n\t\t\t\t\tif (tmplBindings && (pathBindings = node[7])) { // Array of paths, or false if not data-bound\n\t\t\t\t\t\tpathBindings = [pathBindings];\n\t\t\t\t\t\ttmplBindingKey = tmplBindings.push(1); // Add placeholder in tmplBindings for compiled function\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tuseViews = useViews || params[1] || params[2] || pathBindings || /view.(?!index)/.test(params[0]);\n\t\t\t\t// useViews is for perf optimization. For render() we only use views if necessary - for the more advanced scenarios.\n\t\t\t\t// We use views if there are props, contextual properties or args with #... (other than #index) - but you can force\n\t\t\t\t// using the full view infrastructure, (and pay a perf price) by opting in: Set useViews: true on the template, manually...\n\t\t\t\tif (isGetVal = tagName === \":\") {\n\t\t\t\t\tif (converter) {\n\t\t\t\t\t\ttagName = converter === HTML ? \">\" : converter + tagName;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (content) { // TODO optimize - if content.length === 0 or if there is a tmpl=\"...\" specified - set content to null / don't run this compilation code - since content won't get used!!\n\t\t\t\t\t\t// Create template object for nested template\n\t\t\t\t\t\tnestedTmpl = tmplObject(markup, tmplOptions);\n\t\t\t\t\t\tnestedTmpl.tmplName = tmplName + \"/\" + tagName;\n\t\t\t\t\t\t// Compile to AST and then to compiled function\n\t\t\t\t\t\tnestedTmpl.useViews = nestedTmpl.useViews || useViews;\n\t\t\t\t\t\tbuildCode(content, nestedTmpl);\n\t\t\t\t\t\tuseViews = nestedTmpl.useViews;\n\t\t\t\t\t\tnestedTmpls.push(nestedTmpl);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isElse) {\n\t\t\t\t\t\t// This is not an else tag.\n\t\t\t\t\t\ttagAndElses = tagName;\n\t\t\t\t\t\tuseViews = useViews || tagName && (!$tags[tagName] || !$tags[tagName].flow);\n\t\t\t\t\t\t// Switch to a new code string for this bound tag (and its elses, if it has any) - for returning the tagCtxs array\n\t\t\t\t\t\toldCode = code;\n\t\t\t\t\t\tcode = \"\";\n\t\t\t\t\t}\n\t\t\t\t\tnextIsElse = ast[i + 1];\n\t\t\t\t\tnextIsElse = nextIsElse && nextIsElse[0] === \"else\";\n\t\t\t\t}\n\t\t\t\ttagStart = onError ? \";\\ntry{\\nret+=\" : \"\\n+\";\n\t\t\t\tboundOnErrStart = \"\";\n\t\t\t\tboundOnErrEnd = \"\";\n\n\t\t\t\tif (isGetVal && (pathBindings || trigger || converter && converter !== HTML)) {\n\t\t\t\t\t// For convertVal we need a compiled function to return the new tagCtx(s)\n\t\t\t\t\ttagCtxFn = \"return {\" + tagCtx + \"};\";\n\t\t\t\t\ttagRender = 'c(\"' + converter + '\",view,';\n\t\t\t\t\ttagCtxFn = new Function(\"data,view,j,u\", \" // \" + tmplName + \" \" + tmplBindingKey + \" \" + tagName\n\t\t\t\t\t\t\t\t\t\t+ \"\\n\" + tagCtxFn);\n\t\t\t\t\ttagCtxFn._er = onError;\n\n\t\t\t\t\tboundOnErrStart = tagRender + tmplBindingKey + \",\";\n\t\t\t\t\tboundOnErrEnd = \")\";\n\n\t\t\t\t\ttagCtxFn._tag = tagName;\n\t\t\t\t\tif (isLinkExpr) {\n\t\t\t\t\t\treturn tagCtxFn;\n\t\t\t\t\t}\n\t\t\t\t\tsetPaths(tagCtxFn, pathBindings);\n\t\t\t\t\tuseCnvt = true;\n\t\t\t\t}\n\t\t\t\tcode += (isGetVal\n\t\t\t\t\t? (isLinkExpr ? (onError ? \"\\ntry{\\n\" : \"\") + \"return \" : tagStart) + (useCnvt // Call _cnvt if there is a converter: {{cnvt: ... }} or {^{cnvt: ... }}\n\t\t\t\t\t\t? (useCnvt = undefined, useViews = hasCnvt = true, tagRender + (pathBindings\n\t\t\t\t\t\t\t? ((tmplBindings[tmplBindingKey - 1] = tagCtxFn), tmplBindingKey) // Store the compiled tagCtxFn in tmpl.bnds, and pass the key to convertVal()\n\t\t\t\t\t\t\t: \"{\" + tagCtx + \"}\") + \")\")\n\t\t\t\t\t\t: tagName === \">\"\n\t\t\t\t\t\t\t? (hasEncoder = true, \"h(\" + params[0] + ')')\n\t\t\t\t\t\t\t: (getsVal = true, \"((v=\" + (params[0] || 'data') + ')!=null?v:\"\")') // Strict equality just for data-link=\"title{:expr}\" so expr=null will remove title attribute\n\t\t\t\t\t)\n\t\t\t\t\t: (hasTag = true, \"\\n{view:view,tmpl:\" // Add this tagCtx to the compiled code for the tagCtxs to be passed to renderTag()\n\t\t\t\t\t\t+ (content ? nestedTmpls.length : \"0\") + \",\" // For block tags, pass in the key (nestedTmpls.length) to the nested content template\n\t\t\t\t\t\t+ tagCtx + \"},\"));\n\n\t\t\t\tif (tagAndElses && !nextIsElse) {\n\t\t\t\t\t// This is a data-link expression or an inline tag without any elses, or the last {{else}} of an inline tag\n\t\t\t\t\t// We complete the code for returning the tagCtxs array\n\t\t\t\t\tcode = \"[\" + code.slice(0, -1) + \"]\";\n\t\t\t\t\ttagRender = 't(\"' + tagAndElses + '\",view,this,';\n\t\t\t\t\tif (isLinkExpr || pathBindings) {\n\t\t\t\t\t\t// This is a bound tag (data-link expression or inline bound tag {^{tag ...}}) so we store a compiled tagCtxs function in tmp.bnds\n\t\t\t\t\t\tcode = new Function(\"data,view,j,u\", \" // \" + tmplName + \" \" + tmplBindingKey + \" \" + tagAndElses + \"\\nreturn \" + code + \";\");\n\t\t\t\t\t\tcode._er = onError;\n\t\t\t\t\t\tcode._tag = tagAndElses;\n\t\t\t\t\t\tif (pathBindings) {\n\t\t\t\t\t\t\tsetPaths(tmplBindings[tmplBindingKey - 1] = code, pathBindings);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (isLinkExpr) {\n\t\t\t\t\t\t\treturn code; // For a data-link expression we return the compiled tagCtxs function\n\t\t\t\t\t\t}\n\t\t\t\t\t\tboundOnErrStart = tagRender + tmplBindingKey + \",undefined,\";\n\t\t\t\t\t\tboundOnErrEnd = \")\";\n\t\t\t\t\t}\n\n\t\t\t\t\t// This is the last {{else}} for an inline tag.\n\t\t\t\t\t// For a bound tag, pass the tagCtxs fn lookup key to renderTag.\n\t\t\t\t\t// For an unbound tag, include the code directly for evaluating tagCtxs array\n\t\t\t\t\tcode = oldCode + tagStart + tagRender + (tmplBindingKey || code) + \")\";\n\t\t\t\t\tpathBindings = 0;\n\t\t\t\t\ttagAndElses = 0;\n\t\t\t\t}\n\t\t\t\tif (onError) {\n\t\t\t\t\tuseViews = true;\n\t\t\t\t\tcode += ';\\n}catch(e){ret' + (isLinkExpr ? \"urn \" : \"+=\") + boundOnErrStart + 'j._err(e,view,' + onError + ')' + boundOnErrEnd + ';}\\n' + (isLinkExpr ? \"\" : 'ret=ret');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Include only the var references that are needed in the code\n\tcode = \"// \" + tmplName\n\n\t\t+ \"\\nvar v\"\n\t\t+ (hasTag ? \",t=j._tag\" : \"\") // has tag\n\t\t+ (hasCnvt ? \",c=j._cnvt\" : \"\") // converter\n\t\t+ (hasEncoder ? \",h=j.converters.html\" : \"\") // html converter\n\t\t+ (isLinkExpr ? \";\\n\" : ',ret=\"\"\\n')\n\t\t+ (tmplOptions.debug ? \"debugger;\" : \"\")\n\t\t+ code\n\t\t+ (isLinkExpr ? \"\\n\" : \";\\nreturn ret;\");\n\n\tif ($viewsSettings._dbgMode) {\n\t\tcode = \"try {\\n\" + code + \"\\n}catch(e){\\nreturn j._err(e, view);\\n}\";\n\t}\n\n\ttry {\n\t\tcode = new Function(\"data,view,j,u\", code);\n\t} catch (e) {\n\t\tsyntaxError(\"Compiled template code:\\n\\n\" + code + '\\n: \"' + e.message + '\"');\n\t}\n\tif (tmpl) {\n\t\ttmpl.fn = code;\n\t\ttmpl.useViews = !!useViews;\n\t}\n\treturn code;\n}\n\n//==========\n// Utilities\n//==========\n\n// Merge objects, in particular contexts which inherit from parent contexts\nfunction extendCtx(context, parentContext) {\n\t// Return copy of parentContext, unless context is defined and is different, in which case return a new merged context\n\t// If neither context nor parentContext are defined, return undefined\n\treturn context && context !== parentContext\n\t\t? (parentContext\n\t\t\t? $extend($extend({}, parentContext), context)\n\t\t\t: context)\n\t\t: parentContext && $extend({}, parentContext);\n}\n\n// Get character entity for HTML and Attribute encoding\nfunction getCharEntity(ch) {\n\treturn charEntities[ch] || (charEntities[ch] = \"&#\" + ch.charCodeAt(0) + \";\");\n}\n\nfunction getTargetProps(source) {\n\t// this pointer is theMap - which has tagCtx.props too\n\t// arguments: tagCtx.args.\n\tvar key, prop,\n\t\tprops = [];\n\n\tif (typeof source === OBJECT) {\n\t\tfor (key in source) {\n\t\t\tprop = source[key];\n\t\t\tif (!prop || !prop.toJSON || prop.toJSON()) {\n\t\t\t\tif (!$isFunction(prop)) {\n\t\t\t\t\tprops.push({ key: key, prop: prop });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn props;\n}\n\nfunction $fnRender(data, context, noIteration) {\n\tvar tmplElem = this.jquery && (this[0] || error('Unknown template: \"' + this.selector + '\"')),\n\t\ttmpl = tmplElem.getAttribute(tmplAttr);\n\n\treturn renderContent.call(tmpl ? $.data(tmplElem)[jsvTmpl] : $templates(tmplElem), data, context, noIteration);\n}\n\n//========================== Register converters ==========================\n\nfunction htmlEncode(text) {\n\t// HTML encode: Replace < > & ' and \" by corresponding entities.\n\treturn text != undefined ? rIsHtml.test(text) && (\"\" + text).replace(rHtmlEncode, getCharEntity) || text : \"\";\n}\n\n//========================== Initialize ==========================\n\nif (!(jsr || $ && $.render)) {\n\t// JsRender not already loaded, or loaded without jQuery, and we are now moving from jsrender namespace to jQuery namepace\n\tfor (jsvStoreName in jsvStores) {\n\t\tregisterStore(jsvStoreName, jsvStores[jsvStoreName]);\n\t}\n\n\t$templates = $views.templates;\n\t$converters = $views.converters;\n\t$helpers = $views.helpers;\n\t$tags = $views.tags;\n\t$sub = $views.sub;\n\t$viewsSettings = $views.settings;\n\n\t$sub._tg.prototype = {\n\t\tbaseApply: baseApply,\n\t\tcvtArgs: convertArgs\n\t};\n\n\ttopView = $sub.topView = new View();\n\n\t//BROWSER-SPECIFIC CODE\n\tif ($) {\n\n\t\t////////////////////////////////////////////////////////////////////////////////////////////////\n\t\t// jQuery (= $) is loaded\n\n\t\t$.fn.render = $fnRender;\n\n\t\tif ($.observable) {\n\t\t\t$extend($sub, $.views.sub); // jquery.observable.js was loaded before jsrender.js\n\t\t\t$views.map = $.views.map;\n\t\t}\n\n\t} else {\n\t\t////////////////////////////////////////////////////////////////////////////////////////////////\n\t\t// jQuery is not loaded.\n\n\t\t$ = {};\n\n\t\tif (setGlobals) {\n\t\t\tglobal.jsrender = $; // We are loading jsrender.js from a script element, not AMD or CommonJS, so set global\n\t\t}\n\n\t\t// Error warning if jsrender.js is used as template engine on Node.js (e.g. Express or Hapi...)\n\t\t// Use jsrender-node.js instead...\n\t\t$.renderFile = $.__express = $.compile = function() { throw \"Node.js: use npm jsrender, or jsrender-node.js\"; };\n\n\t\t//END BROWSER-SPECIFIC CODE\n\t\t$.isFunction = function(ob) {\n\t\t\treturn typeof ob === \"function\";\n\t\t};\n\n\t\t$.isArray = Array.isArray || function(obj) {\n\t\t\treturn ({}.toString).call(obj) === \"[object Array]\";\n\t\t};\n\n\t\t$.toJq = function(jq) {\n\t\t\tif ($ !== jq) {\n\t\t\t\t$extend(jq, this); // map over from jsrender namespace to jQuery namespace\n\t\t\t\t$ = jq;\n\t\t\t\t$.fn.render = $fnRender;\n\t\t\t}\n\t\t};\n\n\t\t$.jsrender = versionNumber;\n\t}\n\n\t$isFunction = $.isFunction;\n\t$isArray = $.isArray;\n\t$.render = $render;\n\t$.views = $views;\n\t$.templates = $templates = $views.templates;\n\n\t$views.compile = function(markup, options) {\n\t\toptions = options || {};\n\t\toptions.markup = markup;\n\t\treturn $templates(options);\n\t};\n\n\t$viewsSettings({\n\t\tdebugMode: dbgMode,\n\t\tdelimiters: $viewsDelimiters,\n\t\tonError: function(e, view, fallback) {\n\t\t\t// Can override using $.views.settings({onError: function(...) {...}});\n\t\t\tif (view) {\n\t\t\t\t// For render errors, e is an exception thrown in compiled template, and view is the current view. For other errors, e is an error string.\n\t\t\t\te = fallback === undefined\n\t\t\t\t\t? \"{Error: \" + (e.message || e) + \"}\"\n\t\t\t\t\t: $isFunction(fallback)\n\t\t\t\t\t\t? fallback(e, view) : fallback;\n\t\t\t}\n\t\t\treturn e == undefined ? \"\" : e;\n\t\t},\n\t\t_dbgMode: false\n\t});\n\n\t//========================== Register tags ==========================\n\n\t$tags({\n\t\t\"if\": {\n\t\t\trender: function(val) {\n\t\t\t\t// This function is called once for {{if}} and once for each {{else}}.\n\t\t\t\t// We will use the tag.rendering object for carrying rendering state across the calls.\n\t\t\t\t// If not done (a previous block has not been rendered), look at expression for this block and render the block if expression is truthy\n\t\t\t\t// Otherwise return \"\"\n\t\t\t\tvar self = this,\n\t\t\t\t\ttagCtx = self.tagCtx,\n\t\t\t\t\tret = (self.rendering.done || !val && (arguments.length || !tagCtx.index))\n\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t: (self.rendering.done = true, self.selected = tagCtx.index,\n\t\t\t\t\t\t\t// Test is satisfied, so render content on current context. We call tagCtx.render() rather than return undefined\n\t\t\t\t\t\t\t// (which would also render the tmpl/content on the current context but would iterate if it is an array)\n\t\t\t\t\t\t\ttagCtx.render(tagCtx.view, true)); // no arg, so renders against parentView.data\n\t\t\t\treturn ret;\n\t\t\t},\n\t\t\tflow: true\n\t\t},\n\t\t\"for\": {\n\t\t\trender: function(val) {\n\t\t\t\t// This function is called once for {{for}} and once for each {{else}}.\n\t\t\t\t// We will use the tag.rendering object for carrying rendering state across the calls.\n\t\t\t\tvar finalElse = !arguments.length,\n\t\t\t\t\tvalue,\n\t\t\t\t\tself = this,\n\t\t\t\t\ttagCtx = self.tagCtx,\n\t\t\t\t\tresult = \"\",\n\t\t\t\t\tdone = 0;\n\n\t\t\t\tif (!self.rendering.done) {\n\t\t\t\t\tvalue = finalElse ? tagCtx.view.data : val; // For the final else, defaults to current data without iteration.\n\t\t\t\t\tif (value !== undefined ) {\n\t\t\t\t\t\tresult += tagCtx.render(value, finalElse); // Iterates except on final else, if data is an array. (Use {{include}} to compose templates without array iteration)\n\t\t\t\t\t\tdone += $isArray(value) ? value.length : 1;\n\t\t\t\t\t}\n\t\t\t\t\tif (self.rendering.done = done) {\n\t\t\t\t\t\tself.selected = tagCtx.index;\n\t\t\t\t\t}\n\t\t\t\t\t// If nothing was rendered we will look at the next {{else}}. Otherwise, we are done.\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t},\n\t\t\tflow: true\n\t\t},\n\t\tprops: {\n\t\t\tbaseTag: \"for\",\n\t\t\tdataMap: dataMap(getTargetProps),\n\t\t\tflow: true\n\t\t},\n\t\tinclude: {\n\t\t\tflow: true\n\t\t},\n\t\t\"*\": {\n\t\t\t// {{* code... }} - Ignored if template.allowCode and $.views.settings.allowCode are false. Otherwise include code in compiled template\n\t\t\trender: retVal,\n\t\t\tflow: true\n\t\t},\n\t\t\":*\": {\n\t\t\t// {{:* returnedExpression }} - Ignored if template.allowCode and $.views.settings.allowCode are false. Otherwise include code in compiled template\n\t\t\trender: retVal,\n\t\t\tflow: true\n\t\t},\n\t\tdbg: $helpers.dbg = $converters.dbg = dbgBreak // Register {{dbg/}}, {{dbg:...}} and ~dbg() to throw and catch, as breakpoints for debugging.\n\t});\n\n\t$converters({\n\t\thtml: htmlEncode,\n\t\tattr: htmlEncode, // Includes > encoding since rConvertMarkers in JsViews does not skip > characters in attribute strings\n\t\turl: function(text) {\n\t\t\t// URL encoding helper.\n\t\t\treturn text != undefined ? encodeURI(\"\" + text) : text === null ? text : \"\"; // null returns null, e.g. to remove attribute. undefined returns \"\"\n\t\t}\n\t});\n\n\t//========================== Define default delimiters ==========================\n\t$viewsDelimiters();\n}\n\nif (jsrToJq) { // Moving from jsrender namespace to jQuery namepace - copy over the stored items (templates, converters, helpers...)\n\tjsr.toJq($);\n}\n\n//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsObservable >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n/* JsObservable:\n * See http://www.jsviews.com/#jsobservable and http://github.com/borismoore/jsviews\n * Copyright 2015, Boris Moore\n * Released under the MIT License.\n */\n\n//========================== Top-level vars ==========================\n\n$views = $.views;\n$sub = $views.sub;\n$isFunction = $.isFunction;\n$isArray = $.isArray;\nif (!$.observe) {\n\n\tvar $eventSpecial = $.event.special,\n\t\tslice = [].slice,\n\t\tsplice = [].splice,\n\t\tconcat = [].concat,\n\t\t$expando = $.expando,\n\t\tPARSEINT = parseInt,\n\t\trNotWhite = /\\S+/g,\n\t\tpropertyChangeStr = $sub.propChng = $sub.propChng || \"propertyChange\",// These two settings can be overridden on settings after loading\n\t\tarrayChangeStr = $sub.arrChng = $sub.arrChng || \"arrayChange\", // jsRender, and prior to loading jquery.observable.js and/or JsViews\n\t\tcbBindingsStore = $sub._cbBnds = $sub._cbBnds || {},\n\t\tobserveStr = propertyChangeStr + \".observe\",\n\t\tobserveObjKey = 1,\n\t\tobserveCbKey = 1,\n\t\tobserveInnerCbKey = 1,\n\t\t$hasData = $.hasData,\n\t\t$data = $.data,\n\t\tremove = {}, // flag for removeProperty\n\n\t//========================== Top-level functions ==========================\n\n\tgetCbKey = function(cb) {\n\t\treturn cb._cId = cb._cId || (\".obs\" + observeCbKey++);\n\t},\n\n\tObjectObservable = function(data) {\n\t\tthis._data = data;\n\t\treturn this;\n\t},\n\n\tArrayObservable = function(data) {\n\t\tthis._data = data;\n\t\treturn this;\n\t},\n\n\twrapArray = function(data) {\n\t\treturn $isArray(data)\n\t\t\t? [data]\n\t\t\t: data;\n\t},\n\n\tresolvePathObjects = function(paths, root) {\n\t\tpaths = $isArray(paths) ? paths : [paths];\n\n\t\tvar i, path,\n\t\t\tobject = root,\n\t\t\tnextObj = object,\n\t\t\tl = paths.length,\n\t\t\tout = [];\n\n\t\tfor (i = 0; i < l; i++) {\n\t\t\tpath = paths[i];\n\t\t\tif ($isFunction(path)) {\n\t\t\t\tout = out.concat(resolvePathObjects(path.call(root, root), root));\n\t\t\t\tcontinue;\n\t\t\t} else if (\"\" + path !== path) {\n\t\t\t\troot = nextObj = path;\n\t\t\t\tif (nextObj !== object) {\n\t\t\t\t\tout.push(object = nextObj);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (nextObj !== object) {\n\t\t\t\tout.push(object = nextObj);\n\t\t\t}\n\t\t\tout.push(path);\n\t\t}\n\t\treturn out;\n\t},\n\n\tremoveCbBindings = function(cbBindings, cbBindingsId) {\n\t\t// If the cbBindings collection is empty we will remove it from the cbBindingsStore\n\t\tfor (var cb in cbBindings) {\n\t\t\treturn;\n\t\t}\n\t\tcbBindingsStore[cbBindingsId] = undefined; // This binding collection is empty, so remove from store\n\t},\n\n\tonObservableChange = function(ev, eventArgs) {\n\t\tfunction isOb(val) {\n\t\t\treturn typeof val === OBJECT && (paths[0] || allowArray && $isArray(val));\n\t\t}\n\n\t\tif (!(ev.data && ev.data.off)) {\n\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\tvar allPath, filter, parentObs,\n\t\t\t\toldValue = eventArgs.oldValue,\n\t\t\t\tvalue = eventArgs.value,\n\t\t\t\tctx = ev.data,\n\t\t\t\tobserveAll = ctx.observeAll,\n\t\t\t\tallowArray = !ctx.cb.noArray,\n\t\t\t\tpaths = ctx.paths;\n\n\t\t\tif (ev.type === arrayChangeStr) {\n\t\t\t\t(ctx.cb.array || ctx.cb).call(ctx, ev, eventArgs); // If there is an arrayHandler expando on the regular handler, use it, otherwise use the regular handler for arrayChange events also - for example: $.observe(array, handler)\n\t\t\t\t// or observeAll() with an array in the graph. Note that on data-link bindings we ensure always to have an array handler - $.noop if none is specified e.g. on the data-linked tag.\n\t\t\t} else if (ctx.prop === eventArgs.path || ctx.prop === \"*\") {\n\t\t\t\tif (observeAll) {\n\t\t\t\t\tallPath = observeAll._path + \".\" + eventArgs.path;\n\t\t\t\t\tfilter = observeAll.filter;\n\t\t\t\t\tparentObs = [ev.target].concat(observeAll.parents());\n\n\t\t\t\t\tif (isOb(oldValue)) {\n\t\t\t\t\t\tobserve_apply(allowArray, observeAll.ns, [oldValue], paths, ctx.cb, true, filter, [parentObs], allPath); // unobserve\n\t\t\t\t\t}\n\t\t\t\t\tif (isOb(value)) {\n\t\t\t\t\t\tobserve_apply(allowArray, observeAll.ns, [value], paths, ctx.cb, undefined, filter, [parentObs], allPath);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isOb(oldValue)) { // oldValue is an object, so unobserve\n\t\t\t\t\t\tobserve_apply(allowArray, [oldValue], paths, ctx.cb, true); // unobserve\n\t\t\t\t\t}\n\t\t\t\t\tif (isOb(value)) { // value is an object, so observe\n\t\t\t\t\t\tobserve_apply(allowArray, [value], paths, ctx.cb);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tctx.cb(ev, eventArgs);\n\t\t\t}\n\t\t}\n\t},\n\n\tobserve_apply = function() {\n\t\t// $.observe(), but allowing you to include arrays within the arguments - which you want flattened.\n\t\tvar args = concat.apply([], arguments); // Flatten the arguments\n\t\treturn $observe.apply(args.shift(), args);\n\t},\n\n\t$observeAll = function(namespace, cb, filter, unobserve) {\n\t\tif (namespace + \"\" !== namespace) {\n\t\t\tfilter = cb;\n\t\t\tcb = namespace;\n\t\t\tnamespace = \"\";\n\t\t}\n\t\tobserveAll(namespace, this._data, cb, filter, [], \"root\", unobserve);\n\t},\n\n\t$unobserveAll = function(namespace, cb, filter) {\n\t\t$observeAll.call(this, namespace, cb, filter, true);\n\t},\n\n\tobserveAll = function(namespace, object, cb, filter, parentObs, allPath, unobserve, objMap) {\n\t\tfunction observeArrayItems(arr, unobs) {\n\t\t\tl = arr.length;\n\t\t\tnewAllPath = allPath + \"[]\";\n\t\t\twhile (l--) {\n\t\t\t\tfilterAndObserveAll(arr, l, unobs, 1);\n\t\t\t}\n\t\t}\n\n\t\tfunction filterAndObserveAll(obj, prop, unobs, nestedArray) {\n\t\t\tvar newObject, newParentObs;\n\t\t\tif (prop !== $expando) {\n\t\t\t\tif (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter)) {\n\t\t\t\t\tnewParentObs = nextParentObs.slice();\n\t\t\t\t\tif (nestedArray && updatedTgt) {\n\t\t\t\t\t\tnewParentObs.unshift(updatedTgt); // For array change events need to add updated array to parentObs\n\t\t\t\t\t}\n\t\t\t\t\tobserveAll(namespace, newObject, cb, filter || (nestedArray ? undefined : 0), newParentObs, newAllPath, unobs, objMap);\n\t\t\t\t\t// If nested array, need to observe the array too - so set filter to undefined\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction wrappedCb(ev, eventArgs) {\n\t\t\t// This object is changing.\n\t\t\tallPath = ev.data.observeAll._path;\n\t\t\tupdatedTgt = ev.target;\n\t\t\tswitch (eventArgs.change) { // observeAll/unobserveAll on added or removed objects\n\t\t\t\tcase \"insert\":\n\t\t\t\t\tobserveArrayItems(eventArgs.items);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"remove\":\n\t\t\t\t\tobserveArrayItems(eventArgs.items, true); // unobserveAll on removed items\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"refresh\":\n\t\t\t\t\tobserveArrayItems(eventArgs.oldItems, true); // unobserveAll on old items\n\t\t\t\t\tobserveArrayItems(ev.target); // observeAll on new items\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"set\":\n\t\t\t\t\tnewAllPath = allPath + \".\" + eventArgs.path;\n\t\t\t\t\tfilterAndObserveAll(eventArgs, \"oldValue\", true);\n\t\t\t\t\tfilterAndObserveAll(eventArgs, \"value\");\n\t\t\t}\n\t\t\tupdatedTgt = undefined;\n\t\t\tcb.apply(this, arguments); // Observe this object (invoke the callback)\n\t\t}\n\n\t\tvar l, isObject, newAllPath, nextParentObs, updatedTgt, obId,\n\t\t\tnotRemoving = !objMap || objMap.un || !unobserve; // true unless it is an observeAll call (not unobserveAll) and we are removing a listener (not adding one)\n\n\t\tif (object && typeof object === OBJECT) {\n\t\t\tnextParentObs = [object].concat(parentObs); // The parentObs chain for the next depth of observeAll\n\t\t\tisObject = $isArray(object) ? \"\" : \"*\";\n\t\t\tif (objMap && notRemoving && $hasData(object) && objMap[obId = $data(object).obId]) {\n\t\t\t\tobjMap[obId]++;\n\t\t\t\treturn; // This object has already being observed/unobserved by this observeAll/unobserveAll call (must be a cyclic object graph) so skip, to avoid\n\t\t\t\t// stack overflow/multiple instances of listener. See https://github.com/BorisMoore/jsviews/pull/305\n\t\t\t\t// NOTE - WE DO NOT support ObserveAll on data with cyclic graphs which include DUPLICATE REFERENCES TO ARRAY PROPERTIES - such as data.children = data.descendants = []\n\t\t\t}\n\t\t\tif (!objMap) {\n\t\t\t\tobjMap = {un: unobserve}; // Map object to register observed objects for this observeAll\n\t\t\t}\n\n\t\t\tif (cb) {\n\t\t\t\t// Observe this object or array - and also listen for changes to object graph, to add or remove observers from the modified object graph\n\t\t\t\tif (isObject || filter !== 0) {\n\t\t\t\t\t// If an object, observe the object. If an array, only add arrayChange binding if has filter or if filter is undefined (!== 0) - which\n\t\t\t\t\t// is the case for top-level calls or for nested array (array item of an array - e.g. member of 2-dimensional array).\n\t\t\t\t\t// For array properties lower in the tree, with no filter, filter is set to 0 in filterAndObserveAll, so no arrayChange binding here,\n\t\t\t\t\t// since they get arrayChange binding added during regular $.observe(array ...) binding.\n\t\t\t\t\twrappedCb._cId = getCbKey(cb); // Identify wrapped callback with unwrapped callback, so unobserveAll will\n\t\t\t\t\t\t\t\t\t\t\t\t\t// remove previous observeAll wrapped callback, if inner callback was the same;\n\t\t\t\t\tif (notRemoving) {\n\t\t\t\t\t\t$observe(namespace, object, isObject, wrappedCb, unobserve, filter, nextParentObs, allPath);\n\t\t\t\t\t\tobId = $data(object).obId;\n\t\t\t\t\t\tobjMap[obId] = (objMap[obId] || 0) + 1; // Register on map of objects observed/unobserved by this observeAll/unobserveAll call\n\t\t\t\t\t\t\t//- or remove from map if we are removing this object from observeAll call. (Avoid dups, for cyclic graphs)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (--objMap[$data(object).obId]) {\n\t\t\t\t\t\t\t// Register on map of objects observed/unobserved by this observeAll/unobserveAll call\n\t\t\t\t\t\t\t//- or remove from map if we are removing this object from observeAll call. (Avoid dups, for cyclic graphs)\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$observe(namespace, object, isObject, wrappedCb, unobserve, filter, nextParentObs, allPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// No callback. Just unobserve if unobserve === true.\n\t\t\t\tif (objMap) {\n\t\t\t\t\tobjMap[$data(object).obId] = 1; // Register on map of objects unobserved by this unobserveAll call. (Avoid dups, for cyclic graphs)\n\t\t\t\t}\n\t\t\t\t$observe(namespace, object, isObject, undefined, unobserve, filter, nextParentObs, allPath);\n\t\t\t}\n\n\t\t\tif (isObject) {\n\t\t\t\t// Continue stepping through object graph, observing object and arrays\n\t\t\t\t// To override filtering, pass in filter function, or replace $.observable._fltr\n\t\t\t\tfor (l in object) {\n\t\t\t\t\tnewAllPath = allPath + \".\" + l;\n\t\t\t\t\tfilterAndObserveAll(object, l, unobserve);\n\t\t\t\t}\n\t\t\t} else { // Observe items in Array\n\t\t\t\tobserveArrayItems(object, unobserve);\n\t\t\t}\n\t\t}\n\t},\n\n\tshallowFilter = function(allPath /*, object, parentObs*/) {\n\t\treturn allPath.indexOf(\".\") < 0 && allPath.indexOf(\"[\") < 0;\n\t},\n\n\t$unobserve = function() {\n\t\t[].push.call(arguments, true); // Add true as additional final argument\n\t\treturn $observe.apply(this, arguments);\n\t};\n\n\t$observe = function() {\n\t\t// $.observe([namespace, ]root, [1 or more objects, path or path Array params...], callback[, contextCallback][, unobserve])\n\n\t\tfunction innerObserve() {\n\n\t\t\tfunction observeOnOff(namespace, pathStr, isArrayBinding, off) {\n\t\t\t\tvar j, evData,\n\t\t\t\t\tobIdExpando = $hasData(object),\n\t\t\t\t\tboundObOrArr = wrapArray(object),\n\t\t\t\t\tprntObs = parentObs,\n\t\t\t\t\tallPth = allPath;\n\n\t\t\t\tnamespace = initialNs ? namespace + \".\" + initialNs : namespace;\n\n\t\t\t\tif (unobserve || off) {\n\t\t\t\t\tif (obIdExpando) {\n\t\t\t\t\t\t$(boundObOrArr).off(namespace, onObservableChange);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (events = obIdExpando && $._data(object)) {\n\t\t\t\t\t\tevents = events && events.events;\n\t\t\t\t\t\tevents = events && events[isArrayBinding ? arrayChangeStr : propertyChangeStr];\n\t\t\t\t\t\tel = events && events.length;\n\n\t\t\t\t\t\twhile (el--) {\n\t\t\t\t\t\t\tif ((data = events[el].data) && data.cb && data.cb._cId === callback._cId && data.ns === initialNs) {\n\t\t\t\t\t\t\t\tif (isArrayBinding) {\n\t\t\t\t\t\t\t\t\t// Duplicate exists, so skip. (This can happen e.g. with {^{for people ~foo=people}})\n\t\t\t\t\t\t\t\t\t// or for cases with cyclic objects - e.g. obj.children = obj.descendants = []\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t} else if (pathStr === \"*\" && data.prop !== pathStr) {\n\t\t\t\t\t\t\t\t\t$(object).off(namespace, onObservableChange);\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\tevData = isArrayBinding ? {}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\tfullPath: path,\n\t\t\t\t\t\t\tpaths: pathStr ? [pathStr] : [],\n\t\t\t\t\t\t\tprop: prop\n\t\t\t\t\t\t};\n\t\t\t\t\tevData.ns = initialNs;\n\t\t\t\t\tevData.cb = callback;\n\n\t\t\t\t\tif (allPath) {\n\t\t\t\t\t\t// This is an observeAll call\n\t\t\t\t\t\tevData.observeAll = {\n\t\t\t\t\t\t\t_path: allPth,\n\t\t\t\t\t\t\tpath: function() { // Step through path and parentObs parent chain, replacing '[]' by '[n]' based on current index of objects in parent arrays.\n\t\t\t\t\t\t\t\tj = prntObs.length;\n\t\t\t\t\t\t\t\treturn allPth.replace(/[[.]/g, function(all) {\n\t\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\t\treturn all === \"[\"\n\t\t\t\t\t\t\t\t\t\t? \"[\" + $.inArray(prntObs[j - 1], prntObs[j])\n\t\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\tparents: function() {\n\t\t\t\t\t\t\t\treturn prntObs; // The chain of parents between the modified object and the root object used in the observeAll() call\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfilter: filter,\n\t\t\t\t\t\t\tns: initialNs\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\t$(boundObOrArr).on(namespace, null, evData, onObservableChange);\n\t\t\t\t\tif (cbBindings) {\n\t\t\t\t\t\t// Add object to cbBindings, and add the counter to the jQuery data on the object\n\t\t\t\t\t\t(cbBindingsStore[callback._cId] = cbBindings) // In some scenarios cbBindings was empty and removed\n\t\t\t\t\t\t\t//from store - so defensively add back to store, to ensure correct disposal e.g. when views are removed\n\t\t\t\t\t\t\t[$data(object).obId || $data(object, \"obId\", observeObjKey++)] = object;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction getInnerCb(exprOb) {\n\t\t\t\t// Returns the innerCb used for updating a computed in a compiled expression (setting the new instance as exprOb.ob, unobserving the previous object,\n\t\t\t\t// and observing the new one), then calling the outerCB - i.e. the handler for the whole compiled expression.\n\t\t\t\t// Initialized exprOb.ob to the current object.\n\t\t\t\t// Uses the contextCb callback to execute the compiled exprOb template in the context of the view/data etc. to get the returned value, typically an object or array.\n\t\t\t\t// If it is an array, registers array binding\n\t\t\t\tvar origRt = root;\n\t\t\t\t// Note: For https://github.com/BorisMoore/jsviews/issues/292ctxCb will need var ctxCb = contextCb || function(exprOb, origRt) {return exprOb._jsv(origRt);};\n\n\t\t\t\texprOb.ob = contextCb(exprOb, origRt); // Initialize object\n\n\t\t\t\treturn exprOb.cb = function(ev, eventArgs) {\n\t\t\t\t\tvar obj = exprOb.ob, // The old object\n\t\t\t\t\t\tsub = exprOb.sb,\n\t\t\t\t\t\tnewObj = contextCb(exprOb, origRt);\n\n\t\t\t\t\tif (newObj !== obj) {\n\t\t\t\t\t\tif (typeof obj === OBJECT) {\n\t\t\t\t\t\t\tbindArray(obj, true);\n\t\t\t\t\t\t\tif (sub || allowArray && $isArray(obj)) {\n\t\t\t\t\t\t\t\tinnerObserve([obj], sub, callback, contextCb, true); // unobserve on the old object\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\texprOb.ob = newObj;\n\t\t\t\t\t\t// Put the updated object instance onto the exprOb in the paths array, so subsequent string paths are relative to this object\n\t\t\t\t\t\tif (typeof newObj === OBJECT) {\n\t\t\t\t\t\t\tbindArray(newObj);\n\t\t\t\t\t\t\tif (sub || allowArray && $isArray(newObj)) {\n\t\t\t\t\t\t\t\t// Register array binding\n\t\t\t\t\t\t\t\tinnerObserve([newObj], sub, callback, contextCb);\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\t// Call the outerCb - to execute the compiled expression that this computed is part of\n\t\t\t\t\tcallback(ev, eventArgs);\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction bindArray(arr, unbind, isArray, relPath) {\n\t\t\t\tif (allowArray) {\n\t\t\t\t\t// This is a call to observe that does not come from observeAndBind (tag binding), so we allow arrayChange binding\n\t\t\t\t\tvar prevObj = object,\n\t\t\t\t\t\tprevAllPath = allPath;\n\n\t\t\t\t\tobject = arr;\n\t\t\t\t\tif (relPath) {\n\t\t\t\t\t\tobject = arr[relPath];\n\t\t\t\t\t\tallPath += \".\" + relPath;\n\t\t\t\t\t}\n\t\t\t\t\tif (filter && object) {\n\t\t\t\t\t\tobject = $observable._fltr(allPath, object, relPath ? [arr].concat(parentObs) : parentObs, filter);\n\t\t\t\t\t}\n\t\t\t\t\tif (object && (isArray || $isArray(object))) {\n\t\t\t\t\t\tobserveOnOff(arrayChangeStr + \".observe\" + (callback ? (cbId = getCbKey(callback)) : \"\"), undefined, true, unbind);\n\t\t\t\t\t}\n\t\t\t\t\tobject = prevObj;\n\t\t\t\t\tallPath = prevAllPath;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar i, p, skip, parts, prop, path, dep, unobserve, callback, cbId, el, data, events, contextCb, items, cbBindings, depth, innerCb, parentObs,\n\t\t\t\tallPath, filter, initNsArr, initNsArrLen,\n\t\t\t\tns = observeStr,\n\t\t\t\tpaths = this != 1 // Using != for IE<10 bug- see https://github.com/BorisMoore/jsviews/issues/237\n\t\t\t\t\t? concat.apply([], arguments) // Flatten the arguments - this is a 'recursive call' with params using the 'wrapped array'\n\t\t\t\t\t\t\t\t\t\t\t\t\t// style - such as innerObserve([object], path.path, [origRoot], path.prm, innerCb, ...);\n\t\t\t\t\t: slice.call(arguments), // Don't flatten - this is the first 'top-level call, to innerObserve.apply(1, paths)\n\t\t\t\tlastArg = paths.pop() || false,\n\t\t\t\troot = paths.shift(),\n\t\t\t\tobject = root,\n\t\t\t\tl = paths.length;\n\n\t\t\tif (lastArg + \"\" === lastArg) { // If last arg is a string then this observe call is part of an observeAll call,\n\t\t\t\tallPath = lastArg; // and the last three args are the parentObs array, the filter, and the allPath string.\n\t\t\t\tparentObs = paths.pop();\n\t\t\t\tfilter = paths.pop();\n\t\t\t\tlastArg = !!paths.pop(); // unobserve\n\t\t\t\tl -= 3;\n\t\t\t}\n\t\t\tif (lastArg === !!lastArg) {\n\t\t\t\tunobserve = lastArg;\n\t\t\t\tlastArg = paths[l-1];\n\t\t\t\tlastArg = l && lastArg + \"\" !== lastArg ? (l--, paths.pop()) : undefined;\n\t\t\t}\n\t\t\tcallback = lastArg;\n\t\t\tif (l && $isFunction(paths[l - 1])) {\n\t\t\t\tcontextCb = callback;\n\t\t\t\tcallback = paths.pop();\n\t\t\t\tl--;\n\t\t\t}\n\n\t\t\t// Use a unique namespace (e.g. obs7) associated with each observe() callback to allow unobserve to remove handlers\n\t\t\tns += unobserve\n\t\t\t\t? (callback ? callback._cId + (callback._inId || \"\"): \"\")\n\t\t\t\t: (cbId = getCbKey(callback)) + (callback._inId || \"\");\n\t\t\tif (!unobserve) {\n\t\t\t\tcbBindings = cbBindingsStore[cbId] = cbBindingsStore[cbId] || {};\n\t\t\t}\n\n\t\t\tinitNsArr = initialNs && initialNs.match(rNotWhite) || [\"\"];\n\t\t\tinitNsArrLen = initNsArr.length;\n\n\t\t\twhile (initNsArrLen--) {\n\t\t\t\tinitialNs = initNsArr[initNsArrLen];\n\n\t\t\t\tif ($isArray(root)) {\n\t\t\t\t\tbindArray(root, unobserve, true);\n\t\t\t\t} else {\n\t\t\t\t\t// remove onObservableChange handlers that wrap that callback\n\t\t\t\t\tif (unobserve && l === 0 && root) {\n\t\t\t\t\t\tobserveOnOff(ns, \"\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdepth = 0;\n\t\t\t\tfor (i = 0; i < l; i++) {\n\t\t\t\t\tpath = paths[i];\n\t\t\t\t\tif (path === \"\" || path === undefined) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tobject = root;\n\t\t\t\t\tif (\"\" + path === path) {\n\t\t\t\t\t\t// Consider support for computed paths: https://github.com/BorisMoore/jsviews/issues/292\n\t\t\t\t\t\t//if (/[\\(\\[\\+]/.test(path)) {\n\t\t\t\t\t\t//\tvar b={links:{}}, t = $sub.tmplFn(\"{:\"+path+\"}\", b, true), items = t.paths[0];\n\t\t\t\t\t\t//\tl += items.length - 1;\n\t\t\t\t\t\t//\tsplice.apply(paths, [i--, 1].concat(items));\n\t\t\t\t\t\t//\tcontinue;\n\t\t\t\t\t\t//}\n\t\t\t\t\t\tparts = path.split(\"^\");\n\t\t\t\t\t\tif (parts[1]) {\n\t\t\t\t\t\t\t// We bind the leaf, plus additional nodes based on depth.\n\t\t\t\t\t\t\t// \"a.b.c^d.e\" is depth 2, so listens to changes of e, plus changes of d and of c\n\t\t\t\t\t\t\tdepth = parts[0].split(\".\").length;\n\t\t\t\t\t\t\tpath = parts.join(\".\");\n\t\t\t\t\t\t\tdepth = path.split(\".\").length - depth;\n\t\t\t\t\t\t\t// if more than one ^ in the path, the first one determines depth\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (contextCb && (items = contextCb(path, root))) {\n\t\t\t\t\t\t\t// If contextCb returns an array of objects and paths, we will insert them\n\t\t\t\t\t\t\t// into the sequence, replacing the current item (path)\n\t\t\t\t\t\t\tl += items.length - 1;\n\t\t\t\t\t\t\tsplice.apply(paths, [i--, 1].concat(items));\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparts = path.split(\".\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!$isFunction(path)) {\n\t\t\t\t\t\t\tif (path && path._jsv) {\n\t\t\t\t\t\t\t\t// This is a compiled function for binding to an object returned by a helper/data function.\n\t\t\t\t\t\t\t\t// Set current object on exprOb.ob, and get innerCb for updating the object\n\t\t\t\t\t\t\t\tinnerCb = unobserve ? path.cb : getInnerCb(path);\n\t\t\t\t\t\t\t\tinnerCb.noArray = !allowArray;\n\t\t\t\t\t\t\t\tinnerCb._cId = callback._cId;\n\t\t\t\t\t\t\t\t// Set the same cbBindingsStore key as for callback, so when callback is disposed, disposal of innerCb happens too.\n\t\t\t\t\t\t\t\tinnerCb._inId = innerCb._inId || \".obIn\" + observeInnerCbKey++;\n\t\t\t\t\t\t\t\tif (path.bnd || path.prm && path.prm.length || !path.sb) {\n\t\t\t\t\t\t\t\t\t// If the exprOb is bound e.g. foo()^sub.path, or has parameters e.g. foo(bar) or is a leaf object (so no sub path) e.g. foo()\n\t\t\t\t\t\t\t\t\t// then observe changes on the object, or its parameters and sub-path\n\t\t\t\t\t\t\t\t\tinnerObserve([object], path.path, [origRoot], path.prm, innerCb, contextCb, unobserve);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (path.sb) { // subPath\n\t\t\t\t\t\t\t\t\tinnerObserve([path.ob], path.sb, callback, contextCb, unobserve);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpath = origRoot;\n\t\t\t\t\t\t\t\tobject = undefined;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tobject = path; // For top-level calls, objects in the paths array become the origRoot for subsequent paths.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparts = [root = path];\n\t\t\t\t\t}\n\t\t\t\t\twhile (object && (prop = parts.shift()) !== undefined) {\n\t\t\t\t\t\tif (typeof object === OBJECT) {\n\t\t\t\t\t\t\tif (\"\" + prop === prop) {\n\t\t\t\t\t\t\t\tif (prop === \"\") {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ((parts.length < depth + 1) && !object.nodeType) {\n\t\t\t\t\t\t\t\t\t// Add observer for each token in path starting at depth, and on to the leaf\n\t\t\t\t\t\t\t\t\tif (!unobserve && (events = $hasData(object) && $._data(object))) {\n\t\t\t\t\t\t\t\t\t\tevents = events.events;\n\t\t\t\t\t\t\t\t\t\tevents = events && events[propertyChangeStr];\n\t\t\t\t\t\t\t\t\t\tel = events && events.length;\n\t\t\t\t\t\t\t\t\t\tskip = 0;\n\t\t\t\t\t\t\t\t\t\twhile (el--) { // Skip duplicates\n\t\t\t\t\t\t\t\t\t\t\tdata = events[el].data;\n\t\t\t\t\t\t\t\t\t\t\tif (data && data.cb === callback && data.ns === initialNs) {\n\t\t\t\t\t\t\t\t\t\t\t\tif (data.prop === prop || data.prop === \"*\") {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (p = parts.join(\".\")) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata.paths.push(p); // We will skip this binding, but if it is not a leaf binding,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// need to keep bindings for rest of path, ready for if the object gets swapped.\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tskip++;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (skip) {\n\t\t\t\t\t\t\t\t\t\t\t// Duplicate binding(s) found, so move on\n\t\t\t\t\t\t\t\t\t\t\tobject = object[prop];\n\t\t\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (prop === \"*\") {\n\t\t\t\t\t\t\t\t\t\tif (!unobserve && events && events.length) {\n\t\t\t\t\t\t\t\t\t\t\t// Remove existing bindings, since they will be duplicates with \"*\"\n\t\t\t\t\t\t\t\t\t\t\tobserveOnOff(ns, \"\", false, true);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tobserveOnOff(ns, \"\"); // observe the object for any property change\n\t\t\t\t\t\t\t\t\t\tfor (p in object) {\n\t\t\t\t\t\t\t\t\t\t\t// observing \"*\": So (in addition to listening to prop change, above) listen to arraychange on props of type array\n\t\t\t\t\t\t\t\t\t\t\tif (p !== $expando) {\n\t\t\t\t\t\t\t\t\t\t\t\tbindArray(object, unobserve, undefined, p);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t} else if (prop) {\n\t\t\t\t\t\t\t\t\t\tobserveOnOff(ns + \".\" + prop, parts.join(\"^\")); // By using \"^\" rather than \".\" we ensure that deep binding will be used on newly inserted object graphs\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 (allPath) {\n\t\t\t\t\t\t\t\t\tallPath += \".\" + prop;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tprop = object[prop];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ($isFunction(prop)) {\n\t\t\t\t\t\t\t\tif (dep = prop.depends) {\n\t\t\t\t\t\t\t\t\t// This is a computed observable. We will observe any declared dependencies\n\t\t\t\t\t\t\t\t\tinnerObserve([object], resolvePathObjects(dep, object), callback, contextCb, unobserve);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tobject = prop;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbindArray(object, unobserve);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (cbId) {\n\t\t\t\tremoveCbBindings(cbBindings, cbId);\n\t\t\t}\n\n\t\t\t// Return the cbBindings to the top-level caller, along with the cbId\n\t\t\treturn { cbId: cbId, bnd: cbBindings };\n\t\t}\n\n\t\tvar initialNs,\n\t\t\tallowArray = this != false, // If this === false, this is a call from observeAndBind - doing binding of datalink expressions. We don't bind\n\t\t\t// arrayChange events in this scenario. Instead, {^{for}} and similar do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink.\n\t\t\t// Note deliberately using this != false, rather than this !== false because of IE<10 bug- see https://github.com/BorisMoore/jsviews/issues/237\n\t\t\tpaths = slice.call(arguments),\n\t\t\torigRoot = paths[0];\n\n\t\tif (origRoot + \"\" === origRoot && allowArray) {\n\t\t\tinitialNs = origRoot; // The first arg is a namespace, since it is a string, and this call is not from observeAndBind\n\t\t\tpaths.shift();\n\t\t\torigRoot = paths[0];\n\t\t}\n\n\t\treturn innerObserve.apply(1, paths);\n\t};\n\n\t$observable = function(data) {\n\t\treturn $isArray(data)\n\t\t\t? new ArrayObservable(data)\n\t\t\t: new ObjectObservable(data);\n\t};\n\n\t//========================== Initialize ==========================\n\n\t$sub.getDeps = function() {\n\t\tvar args = arguments;\n\t\treturn function() {\n\t\t\tvar arg, dep,\n\t\t\t\tdeps = [],\n\t\t\t\tl = args.length;\n\t\t\twhile (l--) {\n\t\t\t\targ = args[l--];\n\t\t\t\tdep = args[l];\n\t\t\t\tif (dep) {\n\t\t\t\t\tdeps = deps.concat($isFunction(dep) ? dep(arg, arg) : dep);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn deps;\n\t\t};\n\t};\n\n\t$.observable = $observable;\n\t$observable._fltr = function(allPath, object, parentObs, filter) {\n\t\tif (filter && $isFunction(filter)\n\t\t\t? filter(allPath, object, parentObs)\n\t\t\t: true // TODO Consider supporting filter being a string or strings to do RegEx filtering based on key and/or allPath\n\t\t) {\n\t\t\tobject = $isFunction(object)\n\t\t\t\t? object.set && object.call(parentObs[0]) // It is a getter/setter\n\t\t\t\t: object;\n\t\t\treturn typeof object === OBJECT && object;\n\t\t}\n\t};\n\n\t$observable.Object = ObjectObservable;\n\t$observable.Array = ArrayObservable;\n\t$.observe = $observable.observe = $observe;\n\t$.unobserve = $observable.unobserve = $unobserve;\n\t$observable._apply = observe_apply;\n\n\tObjectObservable.prototype = {\n\t\t_data: null,\n\n\t\tobserveAll: $observeAll,\n\t\tunobserveAll: $unobserveAll,\n\n\t\tdata: function() {\n\t\t\treturn this._data;\n\t\t},\n\n\t\tsetProperty: function(path, value, nonStrict) {\n\t\t\tvar key, pair, parts,\n\t\t\t\tself = this,\n\t\t\t\tobject = self._data;\n\n\t\t\tpath = path || \"\";\n\t\t\tif (object) {\n\t\t\t\tif ($isArray(path)) {\n\t\t\t\t\t// This is the array format generated by serializeArray. However, this has the problem that it coerces types to string,\n\t\t\t\t\t// and does not provide simple support of convertTo and convertFrom functions.\n\t\t\t\t\tkey = path.length;\n\t\t\t\t\twhile (key--) {\n\t\t\t\t\t\tpair = path[key];\n\t\t\t\t\t\tself.setProperty(pair.name, pair.value, nonStrict === undefined || nonStrict); //If nonStrict not specified, default to true;\n\t\t\t\t\t}\n\t\t\t\t} else if (\"\" + path !== path) {\n\t\t\t\t\t// Object representation where property name is path and property value is value.\n\t\t\t\t\tfor (key in path) {\n\t\t\t\t\t\tself.setProperty(key, path[key], nonStrict);\n\t\t\t\t\t}\n\t\t\t\t} else if (path !== $expando) {\n\t\t\t\t\t// Simple single property case.\n\t\t\t\t\tparts = path.split(\".\");\n\t\t\t\t\twhile (object && parts.length > 1) {\n\t\t\t\t\t\tobject = object[parts.shift()];\n\t\t\t\t\t}\n\t\t\t\t\tif (object) {\n\t\t\t\t\t\tself._setProperty(object, parts[0], value, nonStrict);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn self;\n\t\t},\n\n\t\tremoveProperty: function(path) {\n\t\t\tthis.setProperty(path, remove);\n\t\t\treturn this;\n\t\t},\n\n\t\t_setProperty: function(leaf, path, value, nonStrict) {\n\t\t\tvar setter, getter, removeProp,\n\t\t\t\tproperty = path ? leaf[path] : leaf;\n\n\t\t\tif ($isFunction(property)) {\n\t\t\t\tif (property.set) {\n\t\t\t\t\t// Case of property setter/getter - with convention that property is getter and property.set is setter\n\t\t\t\t\tgetter = property;\n\t\t\t\t\tsetter = property.set === true ? property : property.set;\n\t\t\t\t\tproperty = property.call(leaf); // get - only treated as getter if also a setter. Otherwise it is simply a property of type function. See unit tests 'Can observe properties of type function'.\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (property !== value || nonStrict && property != value) { // Optional non-strict equality, since serializeArray, and form-based editors can map numbers to strings, etc.\n\t\t\t\t// Date objects don't support != comparison. Treat as special case.\n\t\t\t\tif (!(property instanceof Date) || property > value || property < value) {\n\t\t\t\t\tif (setter) {\n\t\t\t\t\t\tsetter.call(leaf, value);\t//set\n\t\t\t\t\t\tvalue = getter.call(leaf);\t//get updated value\n\t\t\t\t\t} else if (removeProp = value === remove) {\n\t\t\t\t\t\tdelete leaf[path];\n\t\t\t\t\t\tvalue = undefined;\n\t\t\t\t\t} else if (path) {\n\t\t\t\t\t\tleaf[path] = value;\n\t\t\t\t\t}\n\t\t\t\t\tthis._trigger(leaf, {change: \"set\", path: path, value: value, oldValue: property, remove: removeProp});\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t_trigger: function(target, eventArgs) {\n\t\t\t$(target).triggerHandler(propertyChangeStr, eventArgs);\n\t\t}\n\t};\n\n\tArrayObservable.prototype = {\n\t\t_data: null,\n\n\t\tobserveAll: $observeAll,\n\t\tunobserveAll: $unobserveAll,\n\n\t\tdata: function() {\n\t\t\treturn this._data;\n\t\t},\n\n\t\tinsert: function(index, data) {\n\t\t\tvar _data = this._data;\n\t\t\tif (arguments.length === 1) {\n\t\t\t\tdata = index;\n\t\t\t\tindex = _data.length;\n\t\t\t}\n\t\t\tindex = PARSEINT(index);\n\t\t\tif (index > -1 && index <= _data.length) {\n\t\t\t\tdata = $isArray(data) ? data : [data];\n\t\t\t\t// data can be a single item (including a null/undefined value) or an array of items.\n\t\t\t\t// Note the provided items are inserted without being cloned, as direct references to the provided objects\n\n\t\t\t\tif (data.length) {\n\t\t\t\t\tthis._insert(index, data);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t},\n\n\t\t_insert: function(index, data) {\n\t\t\tvar _data = this._data,\n\t\t\t\toldLength = _data.length;\n\t\t\tsplice.apply(_data, [index, 0].concat(data));\n\t\t\tthis._trigger({change: \"insert\", index: index, items: data}, oldLength);\n\t\t},\n\n\t\tremove: function(index, numToRemove) {\n\t\t\tvar items,\n\t\t\t\t_data = this._data;\n\n\t\t\tif (index === undefined) {\n\t\t\t\tindex = _data.length - 1;\n\t\t\t}\n\n\t\t\tindex = PARSEINT(index);\n\t\t\tnumToRemove = numToRemove ? PARSEINT(numToRemove) : numToRemove === 0 ? 0 : 1; // if null or undefined: remove 1\n\t\t\tif (numToRemove > -1 && index > -1) {\n\t\t\t\titems = _data.slice(index, index + numToRemove);\n\t\t\t\tnumToRemove = items.length;\n\t\t\t\tif (numToRemove) {\n\t\t\t\t\tthis._remove(index, numToRemove, items);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t},\n\n\t\t_remove: function(index, numToRemove, items) {\n\t\t\tvar _data = this._data,\n\t\t\t\toldLength = _data.length;\n\n\t\t\t_data.splice(index, numToRemove);\n\t\t\tthis._trigger({change: \"remove\", index: index, items: items}, oldLength);\n\t\t},\n\n\t\tmove: function(oldIndex, newIndex, numToMove) {\n\t\t\tnumToMove = numToMove ? PARSEINT(numToMove) : numToMove === 0 ? 0 : 1; // if null or undefined: move 1\n\t\t\toldIndex = PARSEINT(oldIndex);\n\t\t\tnewIndex = PARSEINT(newIndex);\n\n\t\t\tif (numToMove > 0 && oldIndex > -1 && newIndex > -1 && oldIndex !== newIndex) {\n\t\t\t\tvar items = this._data.slice(oldIndex, oldIndex + numToMove);\n\t\t\t\tnumToMove = items.length;\n\t\t\t\tif (numToMove) {\n\t\t\t\t\tthis._move(oldIndex, newIndex, numToMove, items);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t},\n\n\t\t_move: function(oldIndex, newIndex, numToMove, items) {\n\t\t\tvar _data = this._data,\n\t\t\t\toldLength = _data.length;\n\t\t\t_data.splice(oldIndex, numToMove);\n\t\t\tsplice.apply(_data, [newIndex, 0].concat(items));\n\t\t\tthis._trigger({change: \"move\", oldIndex: oldIndex, index: newIndex, items: items}, oldLength);\n\t\t},\n\n\t\trefresh: function(newItems) {\n\t\t\tvar oldItems = this._data.slice();\n\t\t\tthis._refresh(oldItems, newItems);\n\t\t\treturn this;\n\t\t},\n\n\t\t_refresh: function(oldItems, newItems) {\n\t\t\tvar _data = this._data,\n\t\t\t\toldLength = _data.length;\n\n\t\t\tsplice.apply(_data, [0, _data.length].concat(newItems));\n\t\t\tthis._trigger({change: \"refresh\", oldItems: oldItems}, oldLength);\n\t\t},\n\n\t\t_trigger: function(eventArgs, oldLength) {\n\t\t\tvar _data = this._data,\n\t\t\t\tlength = _data.length,\n\t\t\t\t$_data = $([_data]);\n\n\t\t\tif (length !== oldLength) {\n\t\t\t\t$_data.triggerHandler(propertyChangeStr, {change: \"set\", path: \"length\", value: length, oldValue: oldLength});\n\t\t\t}\n\t\t\t$_data.triggerHandler(arrayChangeStr, eventArgs);\n\t\t}\n\t};\n\n\t$eventSpecial[propertyChangeStr] = $eventSpecial[arrayChangeStr] = {\n\t\t// Register a jQuery special 'remove' event, to access the data associated with handlers being removed by jQuery.off().\n\t\t// We get data.cb._cId from the event handleObj and get the corresponding cbBindings hash from the cbBindingsStore,\n\t\t// then remove this object from that bindings hash - if the object does not have any other handlers associated with the same callback.\n\t\tremove: function (handleObj) {\n\t\t\tvar cbBindings, found, events, l, data,\n\t\t\t\tevData = handleObj.data;\n\t\t\tif ((evData) && (evData.off = true, evData = evData.cb)) { //Set off = true as marker for disposed event\n\t\t\t\t// Get the cb._cId from handleObj.data.cb._cId\n\t\t\t\tif (cbBindings = cbBindingsStore[evData._cId]) {\n\t\t\t\t\t// There were bindings for this callback. If this was the last one, we'll remove it.\n\t\t\t\t\tevents = $._data(this).events[handleObj.type];\n\t\t\t\t\tl = events.length;\n\t\t\t\t\twhile (l-- && !found) {\n\t\t\t\t\t\tfound = (data = events[l].data) && data.cb && data.cb._cId === evData._cId;\n\t\t\t\t\t\t// Found another one with same callback (though may be a different innerCallback)\n\t\t\t\t\t}\n\t\t\t\t\tif (!found) {\n\t\t\t\t\t\t// This was the last handler for this callback and object, so remove the binding entry\n\t\t\t\t\t\tdelete cbBindings[$data(this).obId];\n\t\t\t\t\t\tremoveCbBindings(cbBindings, evData._cId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\t$views.map = function(mapDef) {\n\t\tfunction Map(source, options, target, unbound) {\n\t\t\tvar changing,\n\t\t\t\tmap = this;\n\t\t\tif (this.src) {\n\t\t\t\tthis.unmap(); // We are re-mapping a new source\n\t\t\t}\n\t\t\tif (typeof source === OBJECT) {\n\t\t\t\tmap.src = source;\n\t\t\t\tmap.tgt = target || map.tgt || [];\n\t\t\t\tmap.options = options || map.options;\n\t\t\t\tmap.update();\n\t\t\t\tif (!unbound) {\n\t\t\t\t\tif (mapDef.obsSrc) {\n\t\t\t\t\t\t$observable(map.src).observeAll(map.obs = function(ev, eventArgs) {\n\t\t\t\t\t\t\tif (!changing) {\n\t\t\t\t\t\t\t\tchanging = true;\n\t\t\t\t\t\t\t\tmapDef.obsSrc(map, ev, eventArgs);\n\t\t\t\t\t\t\t\tchanging = undefined;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, map.srcFlt);\n\t\t\t\t\t}\n\t\t\t\t\tif (mapDef.obsTgt ) {\n\t\t\t\t\t\t$observable(map.tgt).observeAll(map.obt = function(ev, eventArgs) {\n\t\t\t\t\t\tif (!changing) {\n\t\t\t\t\t\t\tchanging = true;\n\t\t\t\t\t\t\tmapDef.obsTgt(map, ev, eventArgs);\n\t\t\t\t\t\t\tchanging = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t}, map.tgtFlt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ($isFunction(mapDef)) {\n\t\t\t// Simple map declared as function\n\t\t\tmapDef = {\n\t\t\t\tgetTgt: mapDef\n\t\t\t};\n\t\t}\n\n\t\tif (mapDef.baseMap) {\n\t\t\tmapDef = $.extend({}, mapDef.baseMap, mapDef);\n\t\t}\n\n\t\tmapDef.map = function(source, options, target, unbound) {\n\t\t\treturn new Map(source, options, target, unbound);\n\t\t};\n\n\t\t(Map.prototype = {\n\t\t\tsrcFlt: mapDef.srcFlt || shallowFilter, // default to shallowFilter\n\t\t\ttgtFlt: mapDef.tgtFlt || shallowFilter,\n\t\t\tupdate: function(options) {\n\t\t\t\tvar map = this;\n\t\t\t\t$observable(map.tgt).refresh(mapDef.getTgt(map.src, map.options = options || map.options));\n\t\t\t},\n\t\t\tunmap: function() {\n\t\t\t\tvar map = this;\n\t\t\t\tif (map.src) {\n\t\t\t\t\tif (map.obs) {\n\t\t\t\t\t\t$observable(map.src).unobserveAll(map.obs, map.srcFlt);\n\t\t\t\t\t}\n\t\t\t\t\tif (map.obt) {\n\t\t\t\t\t\t$observable(map.tgt).unobserveAll(map.obt, map.tgtFlt);\n\t\t\t\t\t}\n\t\t\t\t\tmap.src = undefined;\n\t\t\t\t}\n\t\t\t},\n\t\t\tmap: Map,\n\t\t\t_def: mapDef\n\t\t}).constructor = Map;\n\n\t\treturn mapDef;\n\t};\n}\n\n\n//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsViews >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n/* JsViews:\n * Interactive data-driven views using templates and data-linking.\n * See http://www.jsviews.com/#jsviews and http://github.com/BorisMoore/jsviews\n * Copyright 2015, Boris Moore\n * Released under the MIT License.\n */\n\n//========================== Top-level vars ==========================\n\n$viewsSettings = $views.settings;\n$converters = $views.converters;\n$tags = $views.tags;\nrFirstElem = /<(?!script)(\\w+)(?:[^>]*(on\\w+)\\s*=)?[^>]*>/;\n\nif ($.link) { return $; } // JsViews is already loaded\n\nvar activeBody, rTagDatalink, $view, $viewsLinkAttr, linkMethods, linkViewsSel, wrapMap, viewStore, noDomLevel0,\n\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\tNONE = \"none\",\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\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\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\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\trOpenTagMarkers = /(#)()(\\d+)(\\^)/g,\n\trMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g,\n\tgetComputedStyle = global.getComputedStyle;\n\n$observable = $.observable;\n\nif (!$observable) {\n\t// JsObservable is not loaded.\n\tthrow requiresStr + \"JsObservable\"; // jquery.observable.js must be loaded before JsViews\n}\n\n$observe = $observable.observe;\n\n//========================== Top-level functions ==========================\n\n//===============\n// Event handlers\n//===============\n\nfunction elemChangeHandler(ev, params, sourceValue) {\n\tvar setter, cancel, fromAttr, linkCtx, cvtBack, cnvtName, target, $source, view, binding, oldLinkCtx, onBeforeChange, onAfterChange, tag, to, eventArgs, exprOb,\n\t\tsource = ev.target,\n\t\tbindings = source._jsvBnd,\n\t\tsplitBindings = /&(\\d+)\\+?/g;\n\n\t// _jsvBnd is a string with the syntax: \"&bindingId1&bindingId2\"\n\tif (bindings) {\n\t\twhile (binding = splitBindings.exec(bindings)) {\n\t\t\tif (binding = bindingStore[binding[1]]) {\n\t\t\t\tif (to = binding.to) {\n\t\t\t\t\t// The binding has a 'to' field, which is of the form [[targetObject, toPath], cvtBack]\n\t\t\t\t\tlinkCtx = binding.linkCtx;\n\t\t\t\t\tview = linkCtx.view;\n\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t$source = $(source);\n\t\t\t\t\tonBeforeChange = view.hlp(onBeforeChangeStr); // TODO Can we optimize this and other instances of same?\n\t\t\t\t\tonAfterChange = view.hlp(onAfterChangeStr); // TODO Can we optimize this and other instances of same\n\t\t\t\t\tfromAttr = defaultAttr(source);\n\t\t\t\t\tsetter = fnSetters[fromAttr];\n\t\t\t\t\tif (sourceValue === undefined) {\n\t\t\t\t\t\tsourceValue = $isFunction(fromAttr)\n\t\t\t\t\t\t\t? fromAttr(source)\n\t\t\t\t\t\t\t: setter\n\t\t\t\t\t\t\t\t? $source[setter]()\n\t\t\t\t\t\t\t\t: $source.attr(fromAttr);\n\t\t\t\t\t}\n\t\t\t\t\tcnvtName = to[1];\n\t\t\t\t\tto = to[0]; // [object, path]\n\t\t\t\t\tto = to + \"\" === to ? [linkCtx.data, to] : to;\n\t\t\t\t\tif (cnvtName) {\n\t\t\t\t\t\tif ($isFunction(cnvtName)) {\n\t\t\t\t\t\t\tcvtBack = cnvtName;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcvtBack = view.getRsc(\"converters\", cnvtName);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (cvtBack) {\n\t\t\t\t\t\tsourceValue = cvtBack.call(tag, sourceValue);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set linkCtx on view, dynamically, just during this handler call\n\t\t\t\t\toldLinkCtx = view.linkCtx;\n\t\t\t\t\tview.linkCtx = linkCtx;\n\t\t\t\t\teventArgs = {\n\t\t\t\t\t\tchange: \"change\",\n\t\t\t\t\t\toldValue: linkCtx._val,\n\t\t\t\t\t\tvalue: sourceValue\n\t\t\t\t\t};\n\t\t\t\t\tif ((!onBeforeChange || !(cancel = onBeforeChange.call(linkCtx, ev, eventArgs) === false)) &&\n\t\t\t\t\t\t\t(!tag || !tag.onBeforeChange || !(cancel = tag.onBeforeChange(ev, eventArgs) === false)) &&\n\t\t\t\t\t\t\tsourceValue !== undefined) {\n\t\t\t\t\t\ttarget = to[0]; // [object, path]\n\t\t\t\t\t\tif (sourceValue !== undefined && target) {\n\t\t\t\t\t\t\tif (target._jsv) {\n\t\t\t\t\t\t\t\texprOb = target;\n\t\t\t\t\t\t\t\ttarget = linkCtx.data;\n\t\t\t\t\t\t\t\twhile (exprOb && exprOb.sb) {\n\t\t\t\t\t\t\t\t\ttarget = linkCtx._ctxCb(exprOb, target);\n\t\t\t\t\t\t\t\t\texprOb = exprOb.sb;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (tag) {\n\t\t\t\t\t\t\t\ttag._.chging = true; // marker to prevent tag change event triggering its own refresh\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$observable(target).setProperty(to[2] || to[1], sourceValue);\n\t\t\t\t\t\t\tif (onAfterChange) {\n\t\t\t\t\t\t\t\tonAfterChange.call(linkCtx, ev, eventArgs);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (tag) {\n\t\t\t\t\t\t\t\tif (tag.onAfterChange) {\n\t\t\t\t\t\t\t\t\ttag.onAfterChange(ev, eventArgs);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttag._.chging = undefined; // clear the marker\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlinkCtx._val = sourceValue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tview.linkCtx = oldLinkCtx;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction propertyChangeHandler(ev, eventArgs, linkFn) {\n\tvar attr, sourceValue, noUpdate, forceUpdate, hasError, onError,\n\t\tlinkCtx = this,\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.linkCtx,\n\t\tonEvent = view.hlp(onBeforeChangeStr);\n\n\t// Set linkCtx on view, dynamically, just during this handler call\n\tview.linkCtx = linkCtx;\n\n\tif (parentElem && (!onEvent || !(eventArgs && onEvent.call(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\tif (eventArgs) {\n\t\t\tlinkCtx.eventArgs = eventArgs;\n\t\t}\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 get 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);\n\t\t\t\t} catch (e) {\n\t\t\t\t\thasError = linkFn._er;\n\t\t\t\t\tonError = error(e,view,(new Function(\"data,view\", \"return \" + hasError + \";\"))(source, view));\n\t\t\t\t\tsourceValue = [{props: {}, args: [onError]}];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsourceValue = linkFn(source, view, $views);\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\n\t\t\tattr = getTargetVal(sourceValue, linkCtx, tag = linkCtx.tag,\n\t\t\t\t\tlinkCtx.attr || defaultAttr(target, true, cvt !== undefined)\n\t\t\t\t);\n\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\t\t\t\tnoUpdate = !forceUpdate && eventArgs && tag.onUpdate && tag.onUpdate(ev, eventArgs, sourceValue) === false;\n\n\t\t\t\tmergeCtxs(tag, sourceValue, forceUpdate);\n\n\t\t\t\tif (noUpdate || attr === NONE) {\n\t\t\t\t\t// onUpdate returned false, or attr === \"none\", or this is an update coming from the tag's own change event\n\t\t\t\t\t// - so don't refresh the tag: we just use the new tagCtxs merged from the sourceValue,\n\t\t\t\t\t// (which may optionally have been modifed in onUpdate()...) and then bind, and we are done\n\t\t\t\t\tif (attr === HTML && tag.onBeforeLink) {\n\t\t\t\t\t\ttag.onBeforeLink();\n\t\t\t\t\t}\n\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\tobserveAndBind(linkCtx, source, target);\n\t\t\t\t\tview.linkCtx = oldLinkCtx;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (tag._.chging) {\n\t\t\t\t\treturn;\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? $views._cnvt(tag.cvt, view, sourceValue[0])\n\t\t\t\t\t: $views._tag(tag, view, view.tmpl, sourceValue, true, onError);\n\t\t\t} else if (linkFn._tag) {\n\t\t\t\t// For {{: ...}} without a convert or convertBack, we already have the sourceValue, and we are done\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? $views._cnvt(cvt, view, sourceValue[0] || sourceValue) // convertVal\n\t\t\t\t\t: $views._tag(linkFn._tag, view, view.tmpl, sourceValue, true, onError); // renderTag\n\n\t\t\t\ttag = 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\n\t\t\tif (updateContent(sourceValue, linkCtx, attr, tag)\n\t\t\t\t\t&& eventArgs\n\t\t\t\t\t&& (onEvent = view.hlp(onAfterChangeStr))) {\n\t\t\t\tonEvent.call(linkCtx, ev, eventArgs);\n\t\t\t}\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, eventArgs);\n\t\t\t}\n\t\t}\n\n\t\tobserveAndBind(linkCtx, source, target);\n\n\t\t// Remove dynamically added linkCtx from view\n\t\tview.linkCtx = oldLinkCtx;\n\t}\n}\n\nfunction getTargetVal(sourceValue, linkCtx, tag, attr) {\n\tvar currentValue, setter, css, $target,\n\t\ttarget = tag && tag.parentElem || linkCtx.elem;\n\n\tif (sourceValue !== undefined) {\n\t\t$target = $(target);\n\t\tattr = tag && tag.attr || attr;\n\t\tif ($isFunction(sourceValue)) {\n\t\t\terror(linkCtx.expr + \": missing parens\");\n\t\t}\n\n\t\tif (css = /^css-/.test(attr) && attr.slice(4)) {\n\t\t\tcurrentValue = $.style(target, css);\n\t\t\tif (+sourceValue === sourceValue) {\n\t\t\t\t// Optimization for perf on integer values - e.g. css-width{:width+'px'}\n\t\t\t\tcurrentValue = parseInt(currentValue);\n\t\t\t}\n\t\t} else if (attr !== \"link\") { // attr === \"link\" is for tag controls which do data binding but have no rendered output or target\n\t\t\tif (attr === \"value\") {\n\t\t\t\tif (target.type === CHECKBOX) {\n\t\t\t\t\tcurrentValue = $target.prop(attr = CHECKED);\n\t\t\t\t}\n\t\t\t} else if (attr === RADIO) {\n\t\t\t\tif (target.value === (\"\" + sourceValue)) {\n\t\t\t\t\tcurrentValue = $target.prop(CHECKED);\n\t\t\t\t} else {\n\t\t\t\t\treturn attr;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentValue === undefined) {\n\t\t\t\tsetter = fnSetters[attr];\n\t\t\t\tcurrentValue = setter ? $target[setter]() : $target.attr(attr);\n\t\t\t}\n\t\t}\n\t\tlinkCtx._val = currentValue;\n\t}\n\treturn attr;\n}\n\nfunction setDefer(elem, value) {\n\telem._df = value; // Use both an expando and an attribute to track defered 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 propertyChangeHandler(), returns a promise (and supports async)\n\t// When called (in propertyChangeHandler) for target HTML returns true\n\t// When called (in propertyChangeHandler) for other targets returns boolean for \"changed\"\n\tvar setter, prevNode, nextNode, promise, nodesToRemove, useProp, tokens, id, openIndex, closeIndex, testElem, nodeName, cStyle,\n\t\trenders = sourceValue !== undefined && !linkCtx._noUpd, // 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\t$target = $(target),\n\t\tview = linkCtx.view,\n\t\ttargetVal = linkCtx._val,\n\t\toldLinkCtx = view.linkCtx,\n\t\t// If not a tag and not targeting HTML, we can use the ._val obtained from getTargetVal()\n\t\t// and only update when the new value (sourceValue) has changed from the previous one\n\t\tchange = tag || attr === HTML;\n\n\tif (tag) {\n\t\t// Initialize the tag with element references\n\t\ttag.parentElem = tag.parentElem || (linkCtx.expr || tag._elCnt) ? target : target.parentNode;\n\t\tprevNode = tag._prv;\n\t\tnextNode = tag._nxt;\n\t}\n\tif (!renders) {\n\t\tif (attr === HTML && tag && tag.onBeforeLink) {\n\t\t\ttag.onBeforeLink();\n\t\t}\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}\n\t\tif (attr === CHECKED) {\n\t\t\tuseProp = true;\n\t\t\tsourceValue = sourceValue && sourceValue !== \"false\";\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\n\t\t\tif (target.value === (\"\" + sourceValue)) {\n\t\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\tsourceValue = useProp = true;\n\t\t\t\tattr = CHECKED;\n\t\t\t} else {\n\t\t\t\t// Otherwise, go straight to observeAndBind, without updating.\n\t\t\t\t// (The browser will remove the 'checked' attribute, when another radio button in the group is checked).\n\t\t\t\tobserveAndBind(linkCtx, source, target);\n\t\t\t\treturn;\n\t\t\t}\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}\n\n\t\tif (setter = fnSetters[attr]) {\n\t\t\tif (attr === HTML) {\n\t\t\t\t// Set linkCtx on view, dynamically, just during this handler call\n\t\t\t\tview.linkCtx = linkCtx;\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) {\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 if (tokens = target._df) { // This occurs when there is no nextNode, and so the target._df may include tokens referencing\n\t\t\t\t\t\t\t// view and tag bindings contained within the open and close tokens of the updated tag control. They need to be processed (disposed)\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\topenIndex += id.length;\n\t\t\t\t\t\t\t\tif (closeIndex > openIndex) {\n\t\t\t\t\t\t\t\t\tsetDefer(target, tokens.slice(0, openIndex) + tokens.slice(closeIndex));\n\t\t\t\t\t\t\t\t\tdisposeTokens(tokens.slice(openIndex, closeIndex));\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\tif (tag && tag.onBeforeLink) {\n\t\t\t\t\t\ttag.onBeforeLink();\n\t\t\t\t\t}\n\t\t\t\t\t// Insert and link new content\n\t\t\t\t\tpromise = view.link(view.data, target, prevNode, nextNode, sourceValue, tag && {tag: tag._tgId, lazyLink: tag.tagCtx.props.lazyLink});\n\t\t\t\t} else {\n\t\t\t\t\t// data-linked value targeting innerHTML: data-link=\"html{:expr}\"\n\t\t\t\t\tif (renders) {\n\t\t\t\t\t\t$target.empty();\n\t\t\t\t\t}\n\t\t\t\t\tif (tag && tag.onBeforeLink) {\n\t\t\t\t\t\ttag.onBeforeLink();\n\t\t\t\t\t}\n\t\t\t\t\tif (renders) {\n\t\t\t\t\t\tpromise = 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\t// Remove dynamically added linkCtx and ctx from view\n\t\t\t\tview.linkCtx = oldLinkCtx;\n\t\t\t} else if (change = change || targetVal !== sourceValue) {\n\t\t\t\tif (attr === \"text\" && target.children && !target.children[0]) {\n\t\t\t\t\t// This code is faster then $target.text()\n\t\t\t\t\tif (target.textContent !== undefined) {\n\t\t\t\t\t\ttarget.textContent = sourceValue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.innerText = sourceValue === null ? \"\" : sourceValue;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$target[setter](sourceValue);\n\t\t\t\t}\n// Removing this for now, to avoid side-effects when you programmatically set the value, and want the focus to stay on the text box\n//\t\t\t\t\t\t\tif (target.nodeName.toLowerCase() === \"input\") {\n//\t\t\t\t\t\t\t\t$target.blur(); // Issue with IE. This ensures HTML rendering is updated.\n//\t\t\t\t\t\t\t}\n\t\t\t\t\t\t// Data link the new contents of the target node\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\tlinkCtx._val = sourceValue;\n\t}\n\treturn promise || change;\n}\n\nfunction arrayChangeHandler(ev, eventArgs) {\n\tvar self = this,\n\t\tonBeforeChange = self.hlp(onBeforeChangeStr),\n\t\tonAfterChange = self.hlp(onAfterChangeStr);\n\tif (!onBeforeChange || onBeforeChange.call(this, 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\n\t\t\tswitch (action) {\n\t\t\t\tcase \"insert\":\n\t\t\t\t\tself.addViews(index, items);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"remove\":\n\t\t\t\t\tself.removeViews(index, items.length);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"move\":\n\t\t\t\t\tself.refresh(); // Could optimize this\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"refresh\":\n\t\t\t\t\tself.refresh();\n\t\t\t\t\tbreak;\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(this, 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$viewsSettings.merge[nodeName] // get attr 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\tview.link(data, parentNode, prevNode, linkToNode, html, prevView);\n//}, 0);\n}\n\n//=====================\n// addBindingMarkers\n//=====================\n\nfunction addBindingMarkers(value, view, tmplBindingKey) {\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, tag, end;\n\tif (tmplBindingKey) {\n\t\t// This is a binding marker for a data-linked tag {^{...}}\n\t\tend = \"^`\";\n\t\ttag = view._.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) { //TODO? linkFnArgs) {;\n\tvar binding, l, linkedElem, exprFnDeps, exprOb,\n\t\ttag = linkCtx.tag,\n\t\tcvtBk = linkCtx.convertBack,\n\t\tdepends = [],\n\t\tbindId = linkCtx._bndId || \"\" + bindingKey++,\n\t\thandler = linkCtx._hdl;\n\n\tlinkCtx._bndId = undefined;\n\n\tif (tag) {\n\t\t// Use the 'depends' paths set on linkCtx.tag - which may have been set on declaration\n\t\t// or in events: init, render, onBeforeLink, onAfterLink etc.\n\t\tdepends = tag.depends || depends;\n\t\tdepends = $isFunction(depends) ? tag.depends(tag) : depends;\n\t\tlinkedElem = tag.linkedElem;\n\t}\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\t\tif (linkCtx._depends) {\n\t\t\t// Unobserve previous binding\n\t\t\t$observable._apply(false, [source], linkCtx._depends, handler, true);\n\t\t}\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\t\tl = exprFnDeps.length;\n\t\twhile (l--) {\n\t\t\texprOb = exprFnDeps[l];\n\t\t\tif (exprOb._jsv) {\n\t\t\t\t// This path is an 'exprOb', corresponding to a computed, 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\n\t\tbinding = $observable._apply(\n\t\t\tfalse,\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\tbinding.elem = target; // The target of all the individual bindings\n\t\tbinding.linkCtx = linkCtx;\n\t\tbinding._tgId = bindId;\n\n\t\t// Add to the _jsvBnd on the target the view id and binding id - for unbinding when the target element is removed\n\t\ttarget._jsvBnd = target._jsvBnd || \"\";\n\t\ttarget._jsvBnd += \"&\" + bindId;\n\t\tlinkCtx._depends = depends;\n\t\t// Store the binding key on the view, for disposal when the view is removed\n\t\tlinkCtx.view._.bnds[bindId] = bindId;\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 (linkedElem) {\n\t\t\tbinding.to = [[], cvtBk];\n\t\t}\n\t\tif (linkedElem || cvtBk !== undefined) {\n\t\t\tbindTo(binding, tag && tag.convertBack || cvtBk);\n\t\t}\n\t\tif (tag) {\n\t\t\tif (tag.onAfterBind) {\n\t\t\t\ttag.onAfterBind(binding);\n\t\t\t}\n\t\t\tif (!tag.flow && !tag._.inline) {\n\t\t\t\ttarget.setAttribute(jsvAttrStr, (target.getAttribute(jsvAttrStr)||\"\") + \"#\" + bindId + \"^/\" + bindId + \"^\");\n\t\t\t\ttag._tgId = \"\" + bindId;\n\t\t\t}\n\t\t}\n\t}\n\tif (linkedElem && linkedElem[0]) {\n\t\tif (tag._.radio) {\n\t\t\tlinkedElem = linkedElem.children(\"input[type=radio]\");\n\t\t}\n\n\t\tl = linkedElem.length;\n\t\twhile (l--) {\n\t\t\tlinkedElem[l]._jsvBnd = linkedElem[l]._jsvBnd || (target._jsvBnd + \"+\");\n\t\t\t// Add a \"+\" for cloned binding - so removing elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\tlinkedElem[l]._jsvLkEl = tag;\n\t\t}\n\t}\n}\n\n//-------\n// $.link\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(tmplOrLinkTag, to, from, context, noIteration, parentView, prevNode, nextNode) {\n\t// When linking from a template, prevNode and nextNode parameters are ignored\n\n\t// Consider supporting this: $.link(true, data) - (top-level activation) target defaults to body.\n\t// But with templates, defaulting to body makes less sense, so not support for now...\n\t\t//if (to + \"\" !== to) {\n\t\t// nextNode = prevNode;\n\t\t// prevNode = parentView;\n\t\t// parentView = context;\n\t\t// context = from;\n\t\t// from = to;\n\t\t// to = \"body\";\n\t\t//}\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}\n\tif (tmplOrLinkTag && 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\t$(activeBody)\n\t\t\t\t.on(elementChangeStr, elemChangeHandler)\n\t\t\t\t.on('blur', '[contenteditable]', elemChangeHandler);\n\t\t}\n\n\t\tvar i, k, html, vwInfos, view, placeholderParent, targetEl, refresh, topLevelCall,\n\t\t\tonRender = addBindingMarkers,\n\t\t\treplaceMode = context && context.target === \"replace\",\n\t\t\tl = to.length;\n\n\t\twhile (l--) {\n\t\t\ttargetEl = to[l];\n\n\t\t\tparentView = parentView || $view(targetEl);\n\n\t\t\tif (topLevelCall = parentView === topView) {\n\t\t\t\ttopView.data = (topView.ctx = context || {}).root = from;\n\t\t\t}\n\t\t\tif (\"\" + tmplOrLinkTag === tmplOrLinkTag) {\n\t\t\t\t// tmplOrLinkTag is a string: treat as data-link expression.\n\t\t\t\taddDataBinding(tmplOrLinkTag, targetEl, parentView, undefined, true, from, context);\n\t\t\t} else {\n\t\t\t\tif (tmplOrLinkTag.markup !== undefined) {\n\t\t\t\t\t// This is a call to template.link()\n\t\t\t\t\tif (parentView.link === false) {\n\t\t\t\t\t\tcontext = context || {};\n\t\t\t\t\t\tcontext.link = onRender = false; // If link=false, don't allow nested context to switch on linking\n\t\t\t\t\t}\n\t\t\t\t\t// Set link=false, explicitly, to disable linking within a template nested within a linked template\n\t\t\t\t\tif (replaceMode) {\n\t\t\t\t\t\tplaceholderParent = targetEl.parentNode;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml = tmplOrLinkTag.render(from, context, noIteration, parentView, undefined, onRender);\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 (tmplOrLinkTag === true && parentView === topView) {\n\t\t\t\t\t// $.link(true, selector, data, ctx) - where selector points to elem in top-level content\n\t\t\t\t\trefresh = {lnk: 1};\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\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\tparentView.link(from, targetEl, prevNode, nextNode, html, refresh, context);\n//}, 0);\n\t\t\t}\n\t\t\tif (topLevelCall) {\n\t\t\t\ttopView.data = topView.ctx = undefined;\n\t\t\t}\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 || \"\";\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\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) {\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// TODO add validation to track whether we are in attribute context (not yet hit preceding ending with a >) or element content of current 'parentTag'\n\t\t\t// and accordingly disallow inserting script markers in attribute context. Similar for elCnt too, so no \"<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 https://github.com/BorisMoore/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 https://github.com/BorisMoore/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 (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.previousSibling;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastChild;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild,\n\t\t\t\t\t\t// since we have removed white space within elCnt. Hence support IE < 9\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlinkCtx = view.linkCtx;\n\t\t\t\t\t\tif (onAftCr = view.ctx && view.ctx.onAfterCreate || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(linkCtx, 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\tparentTag = tag = bindingStore[vwInfo.id].linkCtx.tag;\n\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t}\n\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\ttags.push(tag);\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 defered 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\tif (lazyLink) {\n\t\t\t\tlazyLink.resolve();\n\t\t\t}\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\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\tif (tag.onBeforeLink) {\n\t\t\t\t\t\t\ttag.onBeforeLink();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// We data-link depth-last (\"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\t\t\t\t\t\taddDataBinding(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) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation\n\t\t\t\t\t\t\t// Add data binding\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(elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n\t\tif (lazyLink) {\n\t\t\tlazyLink.resolve();\n\t\t}\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, lazyLink, 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\tonAfterCreate = self.hlp(onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tlazyLink = refresh.lazyLink && $.Deferred();\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$viewsSettings.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 (noDomLevel0 && firstTag && firstTag[2]) {\n\t\t\terror(\"Unsupported: \" + firstTag[2]); // For security reasons, don't allow insertion of elements with onFoo attributes.\n\t\t}\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\n\tif (lazyLink) {\n\t\tsetTimeout(dataLink, 0);\n\t} else {\n\t\tdataLink();\n\t}\n\n\treturn lazyLink && lazyLink.promise();\n}\n\nfunction addDataBinding(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, params, trimLen, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse,\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 parameters 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\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\tbindDataLinkTarget(linkCtx, linkCtx.fn);\n\t} else if (linkMarkup && node) {\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\n\t\t// Compiled linkFn expressions could be stored in the tmpl.links array of the template\n\t\t// TODO - consider also caching globally so that if {{:foo}} or data-link=\"foo\" occurs in different places,\n\t\t// the compiled template for this is cached and only compiled once...\n\t\t//links = currentView.links || currentView.tmpl.links;\n\n\t\ttmpl = currentView.tmpl;\n\n//\t\t\tif (!(linkTags = links[linkMarkup])) {\n\t\t// This is the first time this view template has been linked, so we compile the data-link expressions, and store them on the template.\n\n\t\tlinkMarkup = normalizeLinkTag(linkMarkup, defaultAttr(node));\n\t\trTagDatalink.lastIndex = 0;\n\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}\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 linkExpression is an {else...} add to tagExpr\n\t\t\t\ttagExpr += \"}{\" + 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 += \"}{{/\" + tokens[4] + \"}\";\n\t\t\t}\n\t\t\tparams = tokens[10];\n\t\t\tconvertBack = undefined;\n\n\t\t\tlinkCtx = {\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\tisLk: isLink, // top-level linking?\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\tif (tokens[6]) {\n\t\t\t\t// TODO include this in the original rTagDatalink regex\n\t\t\t\t// Only for {:} link\"\n\n\t\t\t\tif (!attr && (convertBack = /:([\\w$]*)$/.exec(params))) {\n\t\t\t\t\t// two-way binding\n\t\t\t\t\tconvertBack = convertBack[1];\n\t\t\t\t\tif (convertBack !== undefined) {\n\t\t\t\t\t\t// There is a convertBack function\n\t\t\t\t\t\ttrimLen = - convertBack.length - 1;\n\t\t\t\t\t\ttagExpr = tagExpr.slice(0, trimLen - 1) + delimCloseChar0; // Remove the convertBack string from expression.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (convertBack === null) {\n\t\t\t\t\tconvertBack = undefined;\n\t\t\t\t}\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\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 = tmpl.links[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\ttmpl.links[tagExpr] = linkFn = $sub.tmplFn(tagExpr, tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tif (!attr && convertBack !== undefined) {\n\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\tlinkCtx.convertBack = convertBack;\n\t\t\t}\n\t\t\tbindDataLinkTarget(linkCtx, linkFn);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, linkFn) {\n\t// Add data link bindings for a link expression in data-link attribute markup\n\tfunction handler(ev, eventArgs) {\n\t\tpropertyChangeHandler.call(linkCtx, ev, eventArgs, linkFn);\n\t\t// If the link expression uses a custom tag, the propertyChangeHandler call will call renderTag, which will set tagCtx on linkCtx\n\t}\n\thandler.noArray = true;\n\tif (linkCtx.isLk) {\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. Treat the new view as child of topView.\n\t\tlinkCtx.view = new $sub.View(linkCtx.ctx, \"link\", topView, linkCtx.data, topView.tmpl, undefined, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = getContextCb(linkCtx.view); // _ctxCb is for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\thandler(true);\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup).replace(rEscapeQuotes, \"\\\\$&\");\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\nlinkMethods = {\n\tcontents: function(deep, select) {\n\t\t// For a view or a tag, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is getContents(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\tfiltered = select ? nodes.filter(select) : nodes;\n\t\t\tnodes = deep && select ? filtered.add(nodes.find(select)) : filtered;\n\t\t}\n\t\treturn nodes;\n\t},\n\n\tnodes: function(withMarkers, prevNode, nextNode) {\n\t\t// For a view or a tag, 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,\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tprevNode = prevNode || self._prv;\n\t\tnextNode = nextNode || self._nxt;\n\n\t\tnode = prevIsFirstNode\n\t\t\t? (prevNode === self._nxt\n\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t: prevNode)\n\t\t\t: (self._.inline === false\n\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\tnodes.push(node);\n\t\t\t}\n\t\t\tnode = node.nextSibling;\n\t\t}\n\t\treturn nodes;\n\t},\n\n\tchildTags: function(deep, tagName) {\n\t\t// For a view or a tag, 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,\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.view.tagCtx\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tview.link(\n\t\t\tundefined,\n\t\t\tself.parentElem,\n\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\tself._nxt,\n\t\t\tundefined,\n\t\t\t{get:{\n\t\t\t\ttags: tags,\n\t\t\t\tdeep: deep,\n\t\t\t\tname: tagName,\n\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t}}\n\t\t);\n\t\treturn tags;\n\t},\n\n\trefresh: function(sourceValue) {\n\t\tvar promise, attr,\n\t\t\ttag = this,\n\t\t\tlinkCtx = tag.linkCtx,\n\t\t\tview = tag.tagCtx.view;\n\n\t\tif (tag.disposed) { error(\"Removed tag\"); }\n\t\tif (sourceValue === undefined) {\n\t\t\tsourceValue = $views._tag(tag, view, view.tmpl, mergeCtxs(tag), true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\t\t}\n\t\tif (sourceValue + \"\" === sourceValue) {\n\t\t\t// If no rendered content, sourceValue will not be a string (can be 0 or undefined)\n\t\t\tattr = tag._.inline ? HTML : (linkCtx.attr || defaultAttr(tag.parentElem, true));\n\t\t\tpromise = updateContent(sourceValue, linkCtx, attr, tag);\n\t\t}\n\n\t\tcallAfterLink(tag);\n\t\treturn promise || tag;\n\t},\n\n\tupdate: function(value) {\n\t\tvar linkedElem = this.linkedElem;\n\t\tif (linkedElem) {\n\t\t\telemChangeHandler({\n\t\t\t\ttarget: linkedElem[0]\n\t\t\t}, undefined, value);\n\t\t}\n\t}\n};\n\nfunction callAfterLink(tag, eventArgs) {\n\tvar $linkedElem, linkedElem, radioButtons, val, l, linkedTag, oldTrig, newTrig,\n\t\ttagCtx = tag.tagCtx,\n\t\tview = tagCtx.view,\n\t\tprops = tagCtx.props,\n\t\tlinkCtx = tag.linkCtx = tag.linkCtx || {\n\t\t\ttag: tag,\n\t\t\tdata: view.data,\n\t\t\tview: view,\n\t\t\tctx: view.ctx\n\t\t};\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, eventArgs);\n\t}\n\ttag._.unlinked = undefined;\n\t$linkedElem = tag.targetTag ? tag.targetTag.linkedElem : tag.linkedElem;\n\tif (!tag.noVal && (linkedElem = $linkedElem && $linkedElem[0])) {\n\t\tif (radioButtons = tag._.radio) {\n\t\t\t$linkedElem = $linkedElem.children(\"input[type=radio]\");\n\t\t}\n\t\tif (radioButtons || !tag._.chging) {\n\t\t\tval = tag.cvtArgs()[0];\n\n\t\t\tif (radioButtons || linkedElem !== linkCtx.elem) {\n\t\t\t\tl = $linkedElem.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tlinkedElem = $linkedElem[l];\n\t\t\t\t\tlinkedTag = linkedElem._jsvLkEl;\n\t\t\t\t\tif (tag._.inline && (!linkedTag || linkedTag !== tag && linkedTag.targetTag !== tag)) {\n\t\t\t\t\t\t// For data-linked tags, identify the linkedElem with the tag, for \"to\" binding\n\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\tlinkedElem._jsvLkEl = tag;\n\t\t\t\t\t\tbindTo(bindingStore[tag._tgId], tag.convertBack);\n\t\t\t\t\t\tlinkedElem._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\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}\n\t\t\t\t\tif (radioButtons) {\n\t\t\t\t\t\t// For radio button, set to if val === value. For others set val() to val, below\n\t\t\t\t\t\tlinkedElem[CHECKED] = val === linkedElem.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlinkCtx._val = val;\n\t\t\t}\n\t\t\tif (val !== undefined) {\n\t\t\t\tif (!radioButtons && linkedElem.value !== undefined) {\n\t\t\t\t\tif (linkedElem.type === CHECKBOX) {\n\t\t\t\t\t\tlinkedElem[CHECKED] = val && val !== \"false\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$linkedElem.val(val);\n\t\t\t\t\t}\n\t\t\t\t} else if (linkedElem.contentEditable === TRUE) {\n\t\t\t\t\tlinkedElem.innerHTML = val;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (tag.setSize) {\n\t\t\tif (props.height) {\n\t\t\t\t$linkedElem.height(props.height);\n\t\t\t}\n\t\t\tif (props.width) {\n\t\t\t\t$linkedElem.width(props.width);\n\t\t\t}\n\t\t}\n\t\tif (props[\"class\"]) {\n\t\t\t$linkedElem.addClass(props[\"class\"]);\n\t\t}\n\t\tif (props.id) {\n\t\t\t$linkedElem[0].id = props.id;\n\t\t}\n\t\tif (props.name) {\n\t\t\t$linkedElem.attr(\"name\", props.name);\n\t\t}\n\t}\n\tif (linkedElem = linkedElem || tag.tagName === \":\" && linkCtx.elem) {\n\t\toldTrig = linkedElem._jsvTr;\n\t\tnewTrig = props.trigger;\n\t\tif (oldTrig !== newTrig) {\n\t\t\tlinkedElem._jsvTr = newTrig;\n\t\t\t$linkedElem = $linkedElem || $(linkedElem);\n\t\t\tbindElChange($linkedElem, oldTrig, \"off\");\n\t\t\tbindElChange($linkedElem, newTrig, \"on\");\n\t\t}\n\t}\n}\n\nfunction asyncElemChangeHandler(ev) {\n\tsetTimeout(function() {\n\t\telemChangeHandler(ev);\n\t}, 0);\n}\n\nfunction bindElChange($elem, trig, onoff) {\n\tif (trig) {\n\t\t$elem[onoff](trig === true ? \"keydown\" : trig, trig === true ? asyncElemChangeHandler : elemChangeHandler);\n\t}\n}\n\nfunction bindTo(binding, 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 path on the provided object.\n\t// So for a computed path with an object call: a.b.getObject().d.e, then we set to[0] to be [exprOb, \"d.e\"], and we bind to the path on the returned object, exprOb.ob, as target\n\t// Otherwise our target is the first path, paths[0], which we will convert with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar bindto, pathIndex, path, lastPath, bindtoOb,\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\tpaths = linkCtx.fn.paths;\n\tif (binding && paths) {\n\t\tpaths = (bindto = paths._jsvto) || paths[0];\n\t\tpathIndex = paths && paths.length;\n\t\tif (pathIndex && (!linkCtx.tag || linkCtx.tag.tagCtx.args.length)) {\n\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\tif (lastPath._jsv) {\n\t\t\t\tbindtoOb = lastPath;\n\t\t\t\twhile (lastPath.sb && lastPath.sb._jsv) {\n\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t}\n\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t}\n\t\t\tbinding.to = path\n\t\t\t\t? [ // \"...someexpr().lastpath...\" - so need to get the bindtoOb 'exprOb' object for this view-binding\n\t\t\t\t\t[\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\tlastPath\n\t\t\t\t\t],\n\t\t\t\t\tcvtBk\n\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\tlinkCtx._ctxCb(path = lastPath.split(\"^\").join(\".\")) || [source, path],\n\t\t\t\t\tcvtBk\n\t\t\t\t];\n\t\t} else {\n\t\t\tbinding.to = [[], cvtBk];\n\t\t}\n\t}\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tnewCtxs = newCtxs || tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $views);\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} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$observable(tagCtx.props).setProperty(newTagCtx.props);\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}\n\t}\n\t$sub._ths(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 || \"\"));\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, linkedElem, trigger,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\tif (elem === linkedElemTag.linkedElem[0]) {\n\t\t\telem._jsvLkEl = undefined;\n\t\t\tlinkedElemTag.linkedElem = undefined;\n\t\t}\n\t} else if (binding) {\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\tobject = binding.bnd[objId];\n\t\t\tobsId = binding.cbId;\n\t\t\tif ($.isArray(object)) {\n\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} else {\n\t\t\t\t$(object).off(propertyChangeStr + obsId);\n\t\t\t}\n\t\t\tdelete binding.bnd[objId];\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\tif (map = tagCtxs[l].map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$linkedElem = tag.linkedElem;\n\t\t\t\tlinkedElem = $linkedElem && $linkedElem[0] || linkCtx.elem;\n\n\t\t\t\tif (trigger = linkedElem && linkedElem._jsvTr) {\n\t\t\t\t\tbindElChange($linkedElem || $(linkedElem), trigger, \"off\");\n\t\t\t\t\tlinkedElem._jsvTr = undefined;\n\t\t\t\t}\n\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\t\t\tdelete linkCtx.view._.bnds[bindId];\n\t\t}\n\t\t$sub._cbBnds[binding.cbId] = undefined;\n\t}\n}\n\nfunction $unlink(tmplOrLinkTag, to) {\n\tif (tmplOrLinkTag === undefined) {\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, elemChangeHandler)\n\t\t\t\t.off('blur', '[contenteditable]', elemChangeHandler);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttmplOrLinkTag = true;\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t} else if (to && tmplOrLinkTag === true) {\n\t\tto = to.jquery ? to : $(to); // to is a jquery object or an element or selector\n\t\tto.each(function() {\n\t\t\tvar innerView;\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\tclean([this]);\n\t\t});\n\t}\n\treturn to; // Allow chaining, to attach event handlers, etc.\n\n//} else if (to) {\n//\tto = to.jquery ? to : $(to); // to is a jquery object or an element or selector\n//\tif (tmplOrLinkTag === true) {\n//\t\t// Call to $(el).unlink(true) - unlink content of element, but don't remove bindings on element itself\n//\t\tto.each(function() {\n//\t\t\tvar innerView;\n////TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n//// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\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\tclean([this]);\n//\t\t});\n//\t} else if (tmplOrLinkTag === undefined) {\n//\t\t// Call to $(el).unlink() // Not currently supported\n//\t\tclean(to);\n////TODO provide this unlink API\n//\t} else if (\"\" + tmplOrLinkTag === tmplOrLinkTag) {\n//\t\t// Call to $(el).unlink(tmplOrLinkTag ...)\n//\t\t$.each(to, function() {\n//\t\t\t//...\n//\t\t});\n//\t}\n//TODO - unlink the content and the arrayChange, but not any other bindings on the element (if container rather than \"replace\")\n}\n\nfunction tmplUnlink(to, from) {\n\treturn $unlink(this, to, from);\n}\n\n//========\n// Helpers\n//========\n\nfunction getContextCb(view) {\n\t// TODO Consider exposing or allowing override, as public API\n\treturn function(path, object) {\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,\n\t\t\titems = [object];\n\t\tif (view && path) {\n\t\t\tif (path._jsv) {\n\t\t\t\treturn path._jsv.call(view.tmpl, object, view, $views);\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).split(\".\");\n\t\t\t\t\t\ttag = tag.tag;\n\t\t\t\t\t}\n\t\t\t\t\tif (tokens) {\n\t\t\t\t\t\treturn tag ? [tag, tokens.join(\".\"), object] : [];\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 (object = view.hlp(path.shift())) {\n\t\t\t\t\tif (path.length) {\n\t\t\t\t\t\titems.unshift(path.join(\".\"));\n\t\t\t\t\t}\n\t\t\t\t\titems.unshift(object);\n\t\t\t\t}\n\t\t\t\treturn object ? 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, \"\"), object];\n\t\t\t}\n\t\t}\n\t};\n}\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\n$sub.onStore.template = function(name, item) {\n\titem.link = tmplLink;\n\titem.unlink = tmplUnlink;\n\tif (name) {\n\t\t$.link[name] = function() {\n\t\t\treturn tmplLink.apply(item, arguments);\n\t\t};\n\t\t$.unlink[name] = function() {\n\t\t\treturn tmplUnlink.apply(item, arguments);\n\t\t};\n\t}\n};\n\n$extend($extend($sub._tg.prototype, linkMethods), { // Add linkMethods to tagDef prototype\n\tdomChange: function() { // domChange notification support\n\t\tvar elem = this.parentElem,\n\t\t\thasListener = $.hasData(elem) && $._data(elem).events,\n\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t}\n\t}\n});\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Initialize default delimiters\n($viewsSettings.delimiters = function() {\n\tvar delimChars = oldJsvDelimiters.apply(0, arguments);\n\tdelimOpenChar0 = delimChars[0];\n\tdelimOpenChar1 = delimChars[1];\n\tdelimCloseChar0 = delimChars[2];\n\tdelimCloseChar1 = delimChars[3];\n\tlinkChar = delimChars[4];\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"\\\\\" + delimCloseChar0 + \")\", \"g\");\n\n\t// Default rTag: attr bind tagExpr tag converter colon html comment code params\n\t// (?:^|\\s*)([\\w-]*)(\\^)?({(?:(?:(\\w+(?=[\\/\\s}]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^}]|}(?!}))*?))})\n\treturn this;\n})(); // jshint ignore:line\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\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]\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag;\n\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t// A \"#m\" token\n\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t} else if (vwInfo.close) {\n\t\t\t\t\t// A \"/m\" token\n\t\t\t\t\tviewOrTag._nxt = nextNode;\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) {\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) {\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\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//====================================\n// Add linked view methods to view prototype\n//====================================\n\n$extend(\n\t$extend($sub.View.prototype, linkMethods), {\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\taddViews: function(index, dataItems, tmpl) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tself = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = self.views;\n\n\t\t\tif (!self._.useKey && itemsCount && (tmpl = self.tmpl)) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\t// Use passed-in template if provided, since self added view may use a different template than the original one used to render the array.\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif (viewsCount === self.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t\t&& renderAndLink(self, index, tmpl, views, dataItems, self.ctx) !== false) {\n\t\t\t\t\tfor (i = index + itemsCount; i < viewsCount; i++) {\n\t\t\t\t\t\t$observable(views[i]).setProperty(\"index\", i);\n\t\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\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn self;\n\t\t},\n\n\t\tremoveViews: function(index, itemsCount, keepNodes) {\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) {\n\t\t\t\t\t\ttry {\n\t\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\t\tnextNode.parentNode.removeChild(nextNode);\n\t\t\t\t\t\t} catch (e) {}\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, view, viewsCount,\n\t\t\t\tself = this,\n\t\t\t\tisArray = !self._.useKey,\n\t\t\t\tviews = self.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\tself.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (view in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(view);\n\t\t\t\t\t}\n\t\t\t\t\tself.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&& viewsCount - itemsCount === self.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 (viewsCount = views.length) {\n\t\t\t\t\t\t// Fixup index on following view items...\n\t\t\t\t\t\twhile (index < viewsCount) {\n\t\t\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index++);\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\treturn this;\n\t\t},\n\n\t\trefresh: function(context) {\n\t\t\tvar self = this,\n\t\t\t\tparent = self.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(self, self.index, self.tmpl, parent.views, self.data, context, true);\n\t\t\t\tsetArrayChangeLink(self);\n\t\t\t}\n\t\t\treturn self;\n\t\t},\n\n\t\tlink: viewLink\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._val || \"\",\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(\"on\", {\n\tattr: NONE,\n\tinit: function(tagCtx) {\n\t\tvar tag = this,\n\t\t\tprops = tagCtx.props,\n\t\t\tcontent = tagCtx.content,\n\t\t\telemType = props.elem;\n\n\t\tif (tag._.inline) {\n\t\t\ttag.attr = HTML;\n\t\t\telemType = (elemType || \"span\") + \">\";\n\t\t\ttag.template = \"<\" + elemType + (props.label || content.markup || tagCtx.params.args[0]) + \"</\" + elemType;\n\t\t}\n\t},\n\trender: function() {\n\t\tvar tagCtx = this.tagCtx;\n\t\treturn tagCtx.render(tagCtx.view, true); // no arg, so renders against parentView.data\n\t},\n\tonAfterLink: function(tagCtx, linkCtx) {\n\t\tvar handler, params,\n\t\t\ttag = this,\n\t\t\ti = 0,\n\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\tl = args.length,\n\t\t\tprops = tagCtx.props,\n\t\t\tdata = props.data,\n\t\t\tview = tagCtx.view,\n\t\t\tcontextOb = props.context; // Context ('this' pointer) for attached handler\n\n\t\ttag.activeElem = tag.activeElem || $(tag._.inline ? (tag._elCnt && error('Use data-link=\"{on...}\"'), tag.nodes()[0]) : linkCtx.elem);\n\n\t\twhile (i<l && !(params = $isFunction(handler = args[i++]))) {} // Handler is first arg of type function\n\n\t\tif (params) { // There is a handler\n\t\t\tparams = args.slice(i); // Subsequent args are params\n\t\t\targs = args.slice(0, i - 1); // Preceding args (if any) are events and selector\n\n\t\t\tif (!contextOb) {\n\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// to return that context object, and run compiled function against data\n\t\t\t\tcontextOb = /^(.*)[\\.^][\\w$]+$/.exec(tagCtx.params.args.slice(-params.length - 1)[0]);\n\t\t\t\tcontextOb = contextOb && $sub.tmplFn(\"{:\" + contextOb[1] + \"}\", view.tmpl, true)(linkCtx.data, view);\n\t\t\t}\n\n\t\t\tif (tag._evs) {\n\t\t\t\ttag.onDispose();\n\t\t\t}\n\n\t\t\ttag.activeElem.on(\n\t\t\t\ttag._evs = args[0] || \"click\", // events defaults to \"click\"\n\t\t\t\ttag._sel = args[1],\n\t\t\t\tdata == undefined ? null : data,\n\t\t\t\ttag._hlr = function(ev) {\n\t\t\t\t\treturn handler.apply(contextOb || linkCtx.data, [].concat(\n\t\t\t\t\t\tparams, // e.g. par1, par2\n\t\t\t\t\t\tev,\n\t\t\t\t\t\t{change: ev.type, view: view, linkCtx: linkCtx},\n\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));\n\t\t\t\t\t// for {on 'click' handler par1 par2} use handler(par1, par2, ev, domchangeEventArgs)\n\t\t\t\t\t// for {on 'jsv-domchange' handler par1 par2} use hanlder(par1, par2, ev, domchangeEventArgs, tagCtx, linkCtx, observableEventArgs)\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t},\n\tonUpdate: function() {\n\t\treturn false;\n\t},\n\tonDispose: function() {\n\t\tthis.activeElem.off(this._evs, this._sel, this._hlr);\n\t},\n\tflow: true\n});\n\n$extend($tags[\"for\"], {\n\t//onUpdate: function(ev, eventArgs, tagCtxs) {\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] !== tagCtxs[tci].args[0]) {\n\t\t//\t\treturn true;\n\t\t//\t}\n\t\t//}\n\t\t//return false;\n\t//},\n\tonArrayChange: function(ev, eventArgs, tagCtx, linkCtx) {\n\t\tvar arrayView,\n\t\t\ttarget = ev.target,\n\t\t\ttargetLength = target.length,\n\t\t\ttag = this,\n\t\t\tchange = eventArgs.change;\n\t\tif (tag._.noVws // Child views not supported because target is not html - e.g. data-link=\"title{for ...}\"\n\t\t\t|| tag.tagCtxs[1] && ( // There is an {{else}}\n\t\t\t\tchange === \"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|| change === \"remove\" && !targetLength // removing , and new length 0, so going from n to 0\n\t\t\t\t|| change === \"refresh\" && !eventArgs.oldItems.length !== !targetLength // refreshing, and length is going from 0 to n or from n to 0\n\t\t\t)) {\n\t\t\ttag.refresh();\n\t\t} else {\n\t\t\tfor (arrayView in tag._.arrVws) {\n\t\t\t\tarrayView = tag._.arrVws[arrayView];\n\t\t\t\tif (arrayView.data === target) {\n\t\t\t\t\tarrayView._.onArrayChange.apply(arrayView, arguments);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttag.domChange(tagCtx, linkCtx, eventArgs);\n\t\tev.done = true;\n\t},\n\tonAfterLink: function(tagCtx, linkCtx) {\n\t\tvar i, arrHandler, arrBinding, data,\n\t\t\ttag = this,\n\t\t\tarrayBindings = 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 = 0; 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\n\t\t\tif ((arrBinding = arrayBindings[i]) && data !== arrBinding[0]) { // Is there previous array data on this tagCtx, different from new data\n\t\t\t\t$observe(arrBinding[0], arrBinding[1], 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$observe(data, arrHandler = function(ev, eventArgs) {\n\t\t\t\t\tvar tagCt = tagCtx;\n\t\t\t\t\ttag.onArrayChange(ev, eventArgs, tagCt, linkCtx);\n\t\t\t\t});\n\t\t\t\tarrayBindings[i] = [data, arrHandler]; // Store array data and arrayChangeHandler on tag._ars[i]\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 (arrBinding = arrayBindings[i]) {\n\t\t\t\t$observe(arrBinding[0], arrBinding[1], true); //unobserve previous binding\n\t\t\t\tdelete arrayBindings[i];\n\t\t\t}\n\t\t}\n\t\ttag._ars = arrayBindings;\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][0], tag._ars[l][1], true); //unobserve\n\t\t}\n\t}\n});\n\n$extend($tags[\"for\"], linkMethods);\n$extend($tags[\"if\"], linkMethods);\n$extend($tags.include, linkMethods);\n\n$extend($tags[\"if\"], {\n\tonUpdate: function(ev, eventArgs, tagCtxs) {\n\t\tvar tci, prevArg, different;\n\t\tfor (tci = 0; (prevArg = this.tagCtxs[tci]) && prevArg.args.length; tci++) {\n\t\t\tprevArg = prevArg.args[0];\n\t\t\tdifferent = !prevArg !== !tagCtxs[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 no converter, and newArg and prevArg are both truthy, return false to cancel update. (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, eventArgs) {\n\t\tif (eventArgs) {\n\t\t\tthis.domChange(tagCtx, linkCtx, eventArgs);\n\t\t}\n\t}\n});\n\nfunction observeProps(map, ev, eventArgs) {\n\tif (eventArgs.change === \"set\") {\n\t\tvar target = map.tgt,\n\t\t\tl = target.length;\n\t\twhile (l--) {\n\t\t\tif (target[l].key === eventArgs.path) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\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 item,\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).setProperty(eventArgs.oldValue, null);\n\t\t\tdelete source[eventArgs.oldValue];\n\t\t\t$observable(source).setProperty(eventArgs.value, ev.target.prop);\n\t\t}\n\t} else if (change === \"remove\") {\n\t\titem = eventArgs.items[0];\n\t\t$observable(source).removeProperty(item.key);\n\t\tdelete source[item.key];\n\t} else if (change === \"insert\") {\n\t\titem = eventArgs.items[0];\n\t\tif (item.key) {\n\t\t\t$observable(source).setProperty(item.key, item.prop);\n\t\t}\n\t}\n}\n\nfunction shallowArrayFilter(allPath /*, object, parentObs*/) { // Filter used by {{props}} for the mappedProps target array\n\treturn allPath.indexOf(\".\") < 0;\n}\n\n$tags(\"props\", {\n\tbaseTag: \"for\",\n\tdataMap: $views.map({\n\t\tgetTgt: $tags.props.dataMap.getTgt,\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: $views.view = $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 = \"\" + node === node\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) {\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: $views.link = $link,\n\tunlink: $views.unlink = $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$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(expr) {\n\t\treturn $unlink(expr, 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 = 1; // 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 = 0;\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.settings\n//=========================\n\n$viewsSettings({\n\twrapMap: wrapMap = {\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\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\tlinkAttr: $viewsLinkAttr = \"data-link\",\n\tmerge: {\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\tjsrDbgMode: $viewsSettings.debugMode, // debugMode for JsRender\n\tdebugMode: function(debugMode) { // debugMode for JsViews\n\t\t$viewsSettings._dbgMode = debugMode !== false;\n\t\tif ($viewsSettings._dbgMode) {\n\t\t\tglobal._jsv = { // In debug mode 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} else {\n\t\t\tglobal._jsv = undefined;\n\t\t}\n\t},\n\tjsv: function() {\n\t\t$viewsSettings.debugMode($viewsSettings._dbgMode);\n\t\t$viewsLinkAttr = $viewsSettings.linkAttr;\n\t\terror = $views._err;\n\t\tlinkViewsSel = bindElsSel + \",[\" + $viewsLinkAttr + \"]\";\n\t\tnoDomLevel0 = $viewsSettings.noDomLevel0;\n\t\twrapMap.optgroup = wrapMap.option;\n\t\twrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n\t\twrapMap.th = wrapMap.td;\n\t}\n});\n\nreturn $;\n}));\n"],"sourceRoot":"/source/"}