From 83c9dd35765a97afa45ba1d9372a50e6205d3313 Mon Sep 17 00:00:00 2001 From: BorisMoore Date: Sun, 28 Apr 2019 11:26:51 -0700 Subject: [PATCH] v1.0.3 release Feature improvements: Parens are now supported within $.observe() paths - e.g. "person.address().street()" - https://www.jsviews.com/#jsvmodel@chain - https://www.jsviews.com/#jsvviewmodelsapi@ismanagersample - https://www.jsviews.com/#computed@observe-computed - https://www.jsviews.com/#computed@depend-computed Improved features for managing how tags respond to onArrayChange events - https://www.jsviews.com/#tagoptions@onarraychange New support for referencing the parent object in hierarchical View Model scenarios (parentRef): - https://www.jsviews.com/#jsrmodel@parentref - https://www.jsviews.com/#viewmodelsapi@accessparent - https://www.jsviews.com/#jsvviewmodelsapi@ismanagersample New support for asynchronous or batched observable change events (asyncObserve): - https://www.jsviews.com/#delay New features available for scenarios using sorting and filtering (mapProps and mapDepends): - https://www.jsviews.com/#tagoptions@mapprops Bug fixes: - https://github.com/BorisMoore/jsviews/issues/415 (Markup within element tag - incorrect whitespace) - https://github.com/BorisMoore/jsviews/issues/417 (Side-effect when calling Tag.updateValue during setProperty call) - https://github.com/BorisMoore/jsviews/issues/419 (Regression: checkbox widget not working since v1.0.0) - https://github.com/BorisMoore/jsviews/issues/420 (Template tag responses to array changes) - Several other minor bug fixes Additional and improved documentation topics and samples... Updated tree view samples: - https://www.jsviews.com/#samples/tag-controls/tree Updated Typescript definitions (soon to be deployed DefinitelyTyped): - https://www.jsviews.com/#typescript Many additional unit tests... --- MIT-LICENSE.txt | 2 +- jquery.observable.js | 169 +- jquery.observable.min.js | 4 +- jquery.observable.min.js.map | 2 +- jquery.views.js | 85 +- jquery.views.min.js | 6 +- jquery.views.min.js.map | 2 +- jsrender.js | 137 +- jsrender.min.js | 4 +- jsrender.min.js.map | 2 +- jsviews.js | 383 +- jsviews.min.js | 8 +- jsviews.min.js.map | 2 +- package.json | 4 +- test/browserify/bundles/1-bundle.js | 139 +- test/browserify/bundles/10-errors-bundle.js | 393 +- test/browserify/bundles/11-errors-bundle.js | 607 +- test/browserify/bundles/12-nested-bundle.js | 139 +- test/browserify/bundles/2-bundle.js | 139 +- test/browserify/bundles/3-bundle.js | 139 +- test/browserify/bundles/4-bundle.js | 171 +- test/browserify/bundles/5-bundle.js | 171 +- test/browserify/bundles/6-bundle.js | 393 +- test/browserify/bundles/7-bundle.js | 393 +- test/browserify/bundles/8-bundle.js | 385 +- test/browserify/bundles/8B-bundle.js | 522 +- test/browserify/bundles/9-bundle.js | 385 +- test/unit-tests/tests-jsobservable-withIE.js | 5077 ++++ test/unit-tests/tests-jsobservable.js | 205 +- .../tests-jsrender-no-jquery-withIE.js | 2466 ++ test/unit-tests/tests-jsrender-no-jquery.js | 25 +- .../tests-jsrender-with-jquery-withIE.js | 456 + test/unit-tests/tests-jsrender-with-jquery.js | 28 +- test/unit-tests/tests-jsviews-withIE.js | 23395 ++++++++++++++++ test/unit-tests/tests-jsviews.js | 884 +- 35 files changed, 35271 insertions(+), 2051 deletions(-) create mode 100644 test/unit-tests/tests-jsobservable-withIE.js create mode 100644 test/unit-tests/tests-jsrender-no-jquery-withIE.js create mode 100644 test/unit-tests/tests-jsrender-with-jquery-withIE.js create mode 100644 test/unit-tests/tests-jsviews-withIE.js diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt index 69146b9..b088413 100644 --- a/MIT-LICENSE.txt +++ b/MIT-LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2015 Boris Moore https://github.com/BorisMoore/jsviews +Copyright (c) 2019 Boris Moore https://github.com/BorisMoore/jsviews Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/jquery.observable.js b/jquery.observable.js index f33e4e9..fff1020 100644 --- a/jquery.observable.js +++ b/jquery.observable.js @@ -1,4 +1,4 @@ -/*! JsObservable v1.0.2: http://jsviews.com/#jsobservable */ +/*! JsObservable v1.0.3: http://jsviews.com/#jsobservable */ /* * Subcomponent of JsViews * Data change events for data-linking @@ -44,7 +44,7 @@ if (!$ || !$.fn) { throw "JsObservable requires jQuery"; // We require jQuery } -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", _ocp = "_ocp", // Observable contextual parameter $observe, $observable, @@ -101,6 +101,7 @@ if (!$.observe) { observeInnerCbKey = 1, $data = $.data, remove = {}, // flag for removeProperty + asyncBatch = [], //========================== Top-level functions ========================== @@ -247,13 +248,12 @@ if (!$.observe) { function filterAndObserveAll(obj, prop, unobs, nestedArray) { var newObject, newParentObs; - if (prop !== $expando && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { + if ((+prop === prop || prop !== $expando) && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { newParentObs = nextParentObs.slice(); if (nestedArray && updatedTgt && newParentObs[0] !== updatedTgt) { newParentObs.unshift(updatedTgt); // For array change events when observing an array which is not the root, need to add updated array to parentObs } observeAll(namespace, newObject, cb, filter || (nestedArray ? undefined : 0), newParentObs, newAllPath, unobs, objMap); - // If nested array, need to observe the array too - so set filter to undefined } } @@ -345,6 +345,19 @@ if (!$.observe) { $unobserve = function() { [].push.call(arguments, true); // Add true as additional final argument return $observe.apply(undefined, arguments); + }, + + batchTrigger = function(async) { + var event, + batch = this.slice(); + this.length = 0; + this._go = 0; + while (event = batch.shift()) { + if (!event.skip) { + event[0]._trigger(event[1], event[2], true); + } + } + this.paths = {}; }; $observe = function() { @@ -367,7 +380,7 @@ if (!$.observe) { } function observeOnOff(cb, object, fullPath, namespace, pathStr, isArrayBinding, off) { - var j, evData, + var j, evData, dataOb, boundObOrArr = wrapArray(object), prntObs = parentObs, allPth = allPath; @@ -422,10 +435,9 @@ if (!$.observe) { }; } $(boundObOrArr).on(namespace, null, evData, onDataChange); - if (cbBindings) { // Add object to cbBindings - cbBindings[$data(object).obId || $data(object, "obId", observeObjKey++)] = object; + cbBindings[(dataOb = $data(object)).obId || (dataOb.obId = observeObjKey++)] = object; } } } @@ -433,7 +445,7 @@ if (!$.observe) { function bindArray(cb, arr, unbind, isArray, relPath) { if (allowArray) { // allowArray is 1 if this is a call to observe that does not come from observeAndBind (tag binding), or is from a 'depends' path, - // so we allow arrayChange binding. Otherwise allowArray is zero. + // or for a tag with tag.onArrayChange = true - so we allow arrayChange binding. Otherwise allowArray is zero. var object, prevAllPath = allPath; @@ -510,7 +522,7 @@ if (!$.observe) { // remove previous observeAll wrapped callback, if inner callback was the same; } - var arrIndex, skip, dep, obArr, prt, + var arrIndex, skip, dep, obArr, prt, fnProp, isGet, obj = object; if (object && object._cxp) { return observeObjectPaths(object[0], [object[1]], callback, contextCb); @@ -521,6 +533,10 @@ if (!$.observe) { if (prop === "") { continue; } + if (prop.slice(-2) === "()") { + prop = prop.slice(0, -2); + isGet = true; + } if ((prts.length < depth + 1) && !obj.nodeType) { // Add observer for each token in path starting at depth, and on to the leaf if (!unobserve && (events = $._data(obj).events)) { @@ -533,6 +549,7 @@ if (!$.observe) { && data.ns === initialNs && data.cb._cId === callback._cId && data.cb._inId === callback._inId + && !data._arOk === !allowArray && (data.prop === prop || data.prop === "*" || data.prop === "**")) { if (prt = prts.join(".")) { data.paths.push(prt); // We will skip this binding, but if it is not a leaf binding, @@ -596,7 +613,8 @@ if (!$.observe) { } } if ($isFunction(prop)) { - if (dep = prop.depends) { + fnProp = prop; + if (dep = fnProp.depends) { // This is a computed observable. We will observe any declared dependencies. if (obj._vw && obj._ocp) { // Observable contextual parameter, so context was ocp object. Now move context to view.data for dependencies @@ -609,7 +627,17 @@ if (!$.observe) { } observeObjects(concat.apply([], [[obj], dependsPaths(dep, obj, callback)])); } - break; + + if (isGet) { + if (!prts[0]) { + bindArray(callback, fnProp.call(obj), unobserve); + break; + } + prop = fnProp.call(obj); + if (!prop) { + break; + } + } } obj = prop; } @@ -721,6 +749,8 @@ if (!$.observe) { } } +//END OF FUNCTIONS + var ns = observeStr, paths = this != 1 // Using != for IE<10 bug- see jsviews/issues/237 ? concat.apply([], arguments) // Flatten the arguments - this is a 'recursive call' with params using the 'wrapped array' @@ -729,7 +759,6 @@ if (!$.observe) { lastArg = paths.pop() || false, m = paths.length; -//END OF FUNCTIONS if (lastArg + "" === lastArg) { // If last arg is a string then this observe call is part of an observeAll call, allPath = lastArg; // and the last three args are the parentObs array, the filter, and the allPath string. parentObs = paths.pop(); @@ -792,9 +821,10 @@ if (!$.observe) { } var initialNs, - allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind - doing binding of datalink expressions. We don't bind - // arrayChange events in this scenario. Instead, {^{for}} and similar do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. - // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug- see jsviews/issues/237 + allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind (doing binding of datalink expressions), + // and tag.onArrayChange is not set to true. We don't bind arrayChange events in this scenario. Instead, {^{for}} and similar + // do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. + // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug - see jsviews/issues/237 paths = slice.call(arguments), pth = paths[0]; @@ -805,14 +835,42 @@ if (!$.observe) { return innerObserve.apply(1, paths); }; - $observable = function(ns, data) { - if (arguments.length === 1) { + asyncBatch.wait = function() { + var batch = this; + batch._go = 1; + setTimeout(function() { + batch.trigger(true); + batch._go = 0; + batch.paths = {}; + }); + }; + + $observable = function(ns, data, delay) { + if (ns + "" !== ns) { + delay = data; data = ns; ns = ""; } - return $isArray(data) + delay = delay === undefined ? $subSettingsAdvanced.asyncObserve : delay; + var observable = $isArray(data) ? new ArrayObservable(ns, data) : new ObjectObservable(ns, data); + if (delay) { + if (delay === true) { + observable.async = true; + delay = asyncBatch; + } + if (!delay.trigger) { + if ($isArray(delay)) { + delay.trigger = batchTrigger; + delay.paths = {}; + } else { + delay = undefined; + } + } + observable._batch = delay; + } + return observable; }; //========================== Initialize ========================== @@ -848,10 +906,11 @@ if (!$.observe) { setProperty: function(path, value, nonStrict) { path = path || ""; - var key, pair, parts, + var key, pair, parts, tempBatch, multi = path + "" !== path, // Hash of paths self = this, - object = self._data; + object = self._data, + batch = self._batch; if (object) { if (multi) { @@ -865,10 +924,18 @@ if (!$.observe) { self.setProperty(pair.name, pair.value, nonStrict === undefined || nonStrict); //If nonStrict not specified, default to true; } } else { - // Object representation where property name is path and property value is value. - for (key in path) { + if (!batch) { + self._batch = tempBatch = []; + tempBatch.trigger = batchTrigger; + tempBatch.paths = {}; + } + for (key in path) { // Object representation where property name is path and property value is value. self.setProperty(key, path[key], nonStrict); } + if (tempBatch) { + self._batch.trigger(); + self._batch = undefined; + } } } else if (path !== $expando) { // Simple single property case. @@ -931,8 +998,24 @@ if (!$.observe) { } }, - _trigger: function(target, eventArgs) { - $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + _trigger: function(target, eventArgs, force) { + var key, batch, previous, + self = this; + if ($.hasData(target)) { + if (!force && (batch = self._batch)) { + if (self.async && !batch._go) { + batch.wait(); + } + batch.push([self, target, eventArgs]); + key = $data(target).obId + eventArgs.path; + if (previous = batch.paths[key]) { + batch[previous-1].skip = 1; + } + batch.paths[key] = batch.length; + } else { + $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } + } } }; @@ -1082,17 +1165,28 @@ if (!$.observe) { return self; }, - _trigger: function(eventArgs, oldLength) { - var self = this, - _data = self._data, - length = _data.length, - $_data = $([_data]); - if (self._srt) { - eventArgs.refresh = true; // We are sorting during refresh - } else if (length !== oldLength) { // We have finished sort operations during refresh - $_data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + _trigger: function(eventArgs, oldLength, force) { + var length, _data, batch, + self = this; + if ($.hasData(_data = self._data)) { + if (!force && (batch = self._batch)) { + eventArgs._dly = true; // Delayed event (async or batch change) + batch.push([self, eventArgs, oldLength]); + if (self.async && !batch._go) { + batch.wait(); + } + } else { + length = _data.length; + _data = $([_data]); + + if (self._srt) { + eventArgs.refresh = true; // We are sorting during refresh + } else if (length !== oldLength) { // We have finished sort operations during refresh + _data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + } + _data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } } - $_data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only } }; @@ -1243,8 +1337,9 @@ if (!$.observe) { }; $sub.advSet = function() { // refresh advanced settings + $subSettingsAdvanced = $subSettings.advanced; $sub._gccb = this._gccb; // getContextCallback method - global._jsv = $subSettings.advanced._jsv + global._jsv = $subSettingsAdvanced._jsv ? { // create global _jsv, for accessing views, etc cbBindings: cbBindingsStore } @@ -1253,6 +1348,10 @@ if (!$.observe) { $sub._dp = dependsPaths; $sub._gck = getCbKey; $sub._obs = $observe; + $subSettingsAdvanced = $subSettings.advanced = $subSettingsAdvanced || { + useViews: false, + _jsv: false // For global access to JsViews store + }; } return $; diff --git a/jquery.observable.min.js b/jquery.observable.min.js index 303c14d..f465d03 100644 --- a/jquery.observable.min.js +++ b/jquery.observable.min.js @@ -1,3 +1,3 @@ -/*! JsObservable v1.0.2: http://jsviews.com/#jsobservable */ -!function(t,e){var n=e.jQuery;"object"==typeof exports?module.exports=n?t(e,n):function(n){return t(e,n)}:"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):t(e,!1)}(function(t,e){"use strict";var n=e===!1;if(e=e||t.jQuery,!e||!e.fn)throw"JsObservable requires jQuery";var r,i,o="v1.0.2",s=e.views=e.views||n&&t.jsrender&&jsrender.views||{jsviews:o,sub:{settings:{}},settings:{advanced:function(t){return f=c.advanced=c.advanced||{_jsv:!0},t?("_jsv"in t&&(f._jsv=t._jsv),a.advSet(),s.settings):f}}},a=s.sub,c=a.settings,f=c.advanced,l=e.isFunction,p=e.expando,u=e.isArray,d="object";if(s.jsviews!==o)throw"JsObservable requires JsRender "+o;if(!e.observe){var v=e.event.special,h=[].slice,_=[].splice,g=[].concat,b=parseInt,m=/\S+/g,y=/^[^.[]*$/,I=a.propChng=a.propChng||"propertyChange",w=a.arrChng=a.arrChng||"arrayChange",j={},x=I+".observe",A=1,C=1,k=1,F=e.data,P={},S=function(t){return t?t._cId=t._cId||".obs"+C++:""},T=function(t,e){return this._data=e,this._ns=t,this},O=function(t,e){return this._data=e,this._ns=t,this},V=function(t){return u(t)?[t]:t},q=function(t,e,n){t=t?u(t)?t:[t]:[];var r,i,o,s,a=o=e,c=t&&t.length,f=[];for(r=0;r1;)c=c[o.shift()];c&&a._setProperty(c,o[0],e,n)}return a},removeProperty:function(t){return this.setProperty(t,P),this},_setProperty:function(t,e,n,r){var i,o,s,a,c,f=e?t[e]:t;l(f)&&f.set&&(c=t._vw||t,o=f,i=o.set===!0?o:o.set,f=o.call(c)),(f!==n||r&&f!=n)&&(!(f instanceof Date&&n instanceof Date)||f>n||f-1&&(e=u(e)?e:[e],e.length&&this._insert(t,e)),this},_insert:function(t,e){var n=this._data,r=n.length;t>r&&(t=r),_.apply(n,[t,0].concat(e)),this._trigger({change:"insert",index:t,items:e},r)},remove:function(t,e){var n,r=this._data;return void 0===t&&(t=r.length-1),t=b(t),e=e?b(e):0===e?0:1,e>0&&t>-1&&(n=r.slice(t,t+e),(e=n.length)&&this._remove(t,e,n)),this},_remove:function(t,e,n){var r=this._data,i=r.length;r.splice(t,e),this._trigger({change:"remove",index:t,items:n},i)},move:function(t,e,n){return n=n?b(n):0===n?0:1,t=b(t),e=b(e),n>0&&t>-1&&e>-1&&t!==e&&this._move(t,e,n),this},_move:function(t,e,n){var r,i=this._data,o=i.length,s=t+n-o;s>0&&(n-=s),n&&(r=i.splice(t,n),e>i.length&&(e=i.length),_.apply(i,[e,0].concat(r)),e!==t&&this._trigger({change:"move",oldIndex:t,index:e,items:r},o))},refresh:function(t){function e(){i&&(a.insert(r-i,c),u+=i,n+=i,i=0,c=[])}var n,r,i,o,s,a=this,c=[],f=a._data,l=f.slice(),p=f.length,u=p,d=t.length;for(a._srt=!0,r=i=0;rr&&a.remove(r,u-r),a._srt=void 0,(p||d)&&a._trigger({change:"refresh",oldItems:l},p),a},_trigger:function(t,n){var r=this,i=r._data,o=i.length,s=e([i]);r._srt?t.refresh=!0:o!==n&&s.triggerHandler(I,{change:"set",path:"length",value:o,oldValue:n}),s.triggerHandler(w+(r._ns?"."+/^\S+/.exec(r._ns)[0]:""),t)}},v[I]=v[w]={remove:function(t){var n,r,i,o,s,a=t.data;if(a&&(a.off=!0,a=a.cb)&&(n=j[a._cId])){for(i=e._data(this).events[t.type],o=i.length;o--&&!r;)r=(s=i[o].data)&&s.cb&&s.cb._cId===a._cId;r||(delete n[F(this).obId],D(n,a._cId))}}},s.map=function(t){function n(e,n,r,o){var s,a,c=this;c.src&&c.unmap(),n&&(n.map=c),(typeof e===d||l(e))&&(c.src=e,o?c.tgt=t.getTgt(e,n):(r&&(c.tgt=r.tgt||u(r)&&r),c.tgt=c.tgt||[],c.options=n||c.options,(a=c.update())?c=a:(t.obsSrc&&i(c.src).observeAll(c.obs=function(e,n){s||n.refresh||(s=!0,t.obsSrc(c,e,n),s=void 0)},c.srcFlt),t.obsTgt&&i(c.tgt).observeAll(c.obt=function(e,n){s||c.tgt._updt||(s=!0,t.obsTgt(c,e,n),s=void 0)},c.tgtFlt))))}return l(t)&&(t={getTgt:t}),t.baseMap&&(t=e.extend({},t.baseMap,t)),t.map=function(t,e,r,i){return new n(t,e,r,i)},(n.prototype={srcFlt:t.srcFlt||N,tgtFlt:t.tgtFlt||N,update:function(e){var n,r,o=this,s=o.tgt;if(!s._updt&&(s._updt=!0,n=o.options&&o.options.map,i(s).refresh(t.getTgt(o.src,o.options=e||o.options)),s._updt=!1,r=o.options&&o.options.map,r&&n!==r))return r},observe:function(t,n){var r=this,o=r.options;r.obmp&&R(r.obmp),r.obmp=function(){var t=n.fn(n.data,n.view,a)[o.index];e.extend(o.props,t.props),o.args=t.args,r.update()},i._apply(1,n.data,q(t,n.tag,r.obmp),r.obmp,n._ctxCb)},unmap:function(){var t=this;t.src&&t.obs&&i(t.src).unobserveAll(t.obs,t.srcFlt),t.tgt&&t.obt&&i(t.tgt).unobserveAll(t.obt,t.tgtFlt),t.obmp&&R(t.obmp),t.src=void 0},map:n,_def:t}).constructor=n,t},a.advSet=function(){a._gccb=this._gccb,t._jsv=c.advanced._jsv?{cbBindings:j}:void 0},a._dp=q,a._gck=S,a._obs=r}return e},window); +/*! JsObservable v1.0.3: http://jsviews.com/#jsobservable */ +!function(t,e){var n=e.jQuery;"object"==typeof exports?module.exports=n?t(e,n):function(n){return t(e,n)}:"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(e,n)}):t(e,!1)}(function(t,e){"use strict";var n=e===!1;if(e=e||t.jQuery,!e||!e.fn)throw"JsObservable requires jQuery";var r,i,o="v1.0.3",s=e.views=e.views||n&&t.jsrender&&jsrender.views||{jsviews:o,sub:{settings:{}},settings:{advanced:function(t){return f=c.advanced=c.advanced||{_jsv:!0},t?("_jsv"in t&&(f._jsv=t._jsv),a.advSet(),s.settings):f}}},a=s.sub,c=a.settings,f=c.advanced,l=e.isFunction,p=e.expando,u=e.isArray,h="object";if(s.jsviews!==o)throw"JsObservable requires JsRender "+o;if(!e.observe){var d=e.event.special,v=[].slice,_=[].splice,g=[].concat,b=parseInt,m=/\S+/g,y=/^[^.[]*$/,I=a.propChng=a.propChng||"propertyChange",w=a.arrChng=a.arrChng||"arrayChange",j={},x=I+".observe",A=1,k=1,C=1,F=e.data,P={},O=[],S=function(t){return t?t._cId=t._cId||".obs"+k++:""},T=function(t,e){return this._data=e,this._ns=t,this},V=function(t,e){return this._data=e,this._ns=t,this},D=function(t){return u(t)?[t]:t},q=function(t,e,n){t=t?u(t)?t:[t]:[];var r,i,o,s,a=o=e,c=t&&t.length,f=[];for(r=0;r1;)f=f[o.shift()];f&&c._setProperty(f,o[0],e,n)}return c},removeProperty:function(t){return this.setProperty(t,P),this},_setProperty:function(t,e,n,r){var i,o,s,a,c,f=e?t[e]:t;l(f)&&f.set&&(c=t._vw||t,o=f,i=o.set===!0?o:o.set,f=o.call(c)),(f!==n||r&&f!=n)&&(!(f instanceof Date&&n instanceof Date)||f>n||f-1&&(e=u(e)?e:[e],e.length&&this._insert(t,e)),this},_insert:function(t,e){var n=this._data,r=n.length;t>r&&(t=r),_.apply(n,[t,0].concat(e)),this._trigger({change:"insert",index:t,items:e},r)},remove:function(t,e){var n,r=this._data;return void 0===t&&(t=r.length-1),t=b(t),e=e?b(e):0===e?0:1,e>0&&t>-1&&(n=r.slice(t,t+e),(e=n.length)&&this._remove(t,e,n)),this},_remove:function(t,e,n){var r=this._data,i=r.length;r.splice(t,e),this._trigger({change:"remove",index:t,items:n},i)},move:function(t,e,n){return n=n?b(n):0===n?0:1,t=b(t),e=b(e),n>0&&t>-1&&e>-1&&t!==e&&this._move(t,e,n),this},_move:function(t,e,n){var r,i=this._data,o=i.length,s=t+n-o;s>0&&(n-=s),n&&(r=i.splice(t,n),e>i.length&&(e=i.length),_.apply(i,[e,0].concat(r)),e!==t&&this._trigger({change:"move",oldIndex:t,index:e,items:r},o))},refresh:function(t){function e(){i&&(a.insert(r-i,c),u+=i,n+=i,i=0,c=[])}var n,r,i,o,s,a=this,c=[],f=a._data,l=f.slice(),p=f.length,u=p,h=t.length;for(a._srt=!0,r=i=0;rr&&a.remove(r,u-r),a._srt=void 0,(p||h)&&a._trigger({change:"refresh",oldItems:l},p),a},_trigger:function(t,n,r){var i,o,s,a=this;e.hasData(o=a._data)&&(!r&&(s=a._batch)?(t._dly=!0,s.push([a,t,n]),a.async&&!s._go&&s.wait()):(i=o.length,o=e([o]),a._srt?t.refresh=!0:i!==n&&o.triggerHandler(I,{change:"set",path:"length",value:i,oldValue:n}),o.triggerHandler(w+(a._ns?"."+/^\S+/.exec(a._ns)[0]:""),t)))}},d[I]=d[w]={remove:function(t){var n,r,i,o,s,a=t.data;if(a&&(a.off=!0,a=a.cb)&&(n=j[a._cId])){for(i=e._data(this).events[t.type],o=i.length;o--&&!r;)r=(s=i[o].data)&&s.cb&&s.cb._cId===a._cId;r||(delete n[F(this).obId],H(n,a._cId))}}},s.map=function(t){function n(e,n,r,o){var s,a,c=this;c.src&&c.unmap(),n&&(n.map=c),(typeof e===h||l(e))&&(c.src=e,o?c.tgt=t.getTgt(e,n):(r&&(c.tgt=r.tgt||u(r)&&r),c.tgt=c.tgt||[],c.options=n||c.options,(a=c.update())?c=a:(t.obsSrc&&i(c.src).observeAll(c.obs=function(e,n){s||n.refresh||(s=!0,t.obsSrc(c,e,n),s=void 0)},c.srcFlt),t.obsTgt&&i(c.tgt).observeAll(c.obt=function(e,n){s||c.tgt._updt||(s=!0,t.obsTgt(c,e,n),s=void 0)},c.tgtFlt))))}return l(t)&&(t={getTgt:t}),t.baseMap&&(t=e.extend({},t.baseMap,t)),t.map=function(t,e,r,i){return new n(t,e,r,i)},(n.prototype={srcFlt:t.srcFlt||R,tgtFlt:t.tgtFlt||R,update:function(e){var n,r,o=this,s=o.tgt;if(!s._updt&&(s._updt=!0,n=o.options&&o.options.map,i(s).refresh(t.getTgt(o.src,o.options=e||o.options)),s._updt=!1,r=o.options&&o.options.map,r&&n!==r))return r},observe:function(t,n){var r=this,o=r.options;r.obmp&&$(r.obmp),r.obmp=function(){var t=n.fn(n.data,n.view,a)[o.index];e.extend(o.props,t.props),o.args=t.args,r.update()},i._apply(1,n.data,q(t,n.tag,r.obmp),r.obmp,n._ctxCb)},unmap:function(){var t=this;t.src&&t.obs&&i(t.src).unobserveAll(t.obs,t.srcFlt),t.tgt&&t.obt&&i(t.tgt).unobserveAll(t.obt,t.tgtFlt),t.obmp&&$(t.obmp),t.src=void 0},map:n,_def:t}).constructor=n,t},a.advSet=function(){f=c.advanced,a._gccb=this._gccb,t._jsv=f._jsv?{cbBindings:j}:void 0},a._dp=q,a._gck=S,a._obs=r,f=c.advanced=f||{useViews:!1,_jsv:!1}}return e},window); //# sourceMappingURL=jquery.observable.min.js.map diff --git a/jquery.observable.min.js.map b/jquery.observable.min.js.map index c6f9269..4a32d61 100644 --- a/jquery.observable.min.js.map +++ b/jquery.observable.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["jquery.observable.js"],"names":["factory","global","$","jQuery","exports","module","define","amd","setGlobals","fn","$observe","$observable","versionNumber","$views","views","jsrender","jsviews","sub","settings","advanced","value","$subSettingsAdvanced","$subSettings","_jsv","$sub","advSet","$isFunction","isFunction","$expando","expando","$isArray","isArray","OBJECT","observe","$eventSpecial","event","special","slice","splice","concat","PARSEINT","parseInt","rNotWhite","rShallowPath","propertyChangeStr","propChng","arrayChangeStr","arrChng","cbBindingsStore","observeStr","observeObjKey","observeCbKey","observeInnerCbKey","$data","data","remove","getCbKey","cb","_cId","ObjectObservable","ns","this","_data","_ns","ArrayObservable","wrapArray","dependsPaths","paths","root","callback","i","path","object","rt","nextObj","l","length","out","tagName","linkCtx","call","push","undefined","unshift","_ar","removeCbBindings","cbBindings","cbBindingsId","onDataChange","ev","eventArgs","isOb","val","noArray","off","allPath","filter","parentObs","oldValue","ctx","observeAll","_arOk","type","array","prop","_path","target","parents","observe_apply","args","apply","arguments","shift","$observeAll","unobserve","$unobserveAll","namespace","objMap","observeArrayItems","arr","unobs","newAllPath","filterAndObserveAll","obj","nestedArray","newObject","newParentObs","_fltr","nextParentObs","updatedTgt","wrappedCb","change","items","_wrp","isObject","obId","notRemoving","un","hasData","shallowFilter","test","$unobserve","innerObserve","unobserveBinding","binding","bindArray","observeOnOff","fullPath","pathStr","isArrayBinding","j","evData","boundObOrArr","prntObs","allPth","initialNs","events","el","allowArray","replace","all","inArray","on","unbind","relPath","prevAllPath","observeObjects","observeObjectPaths","pths","contextCb","getInnerCb","exprOb","ob","sb","newObj","observePath","prts","obArrAddRemove","arrIndex","skip","dep","obArr","prt","_cxp","depth","nodeType","_inId","join","observable","depends","_vw","_ocp","_tgId","tagCtx","view","_is","_gccb","contentView","parts","split","pth","_cpfn","innerCb","bnd","prm","p","cbId","inId","initNsArr","initNsArrLen","lastArg","pop","m","match","s","set","Object","Array","_apply","prototype","unobserveAll","setProperty","nonStrict","key","pair","multi","self","name","_setProperty","removeProperty","leaf","setter","getter","removeProp","property","Date","ctxPrm","_key","_trigger","triggerHandler","exec","insert","index","_insert","oldLength","numToRemove","_remove","move","oldIndex","newIndex","numToMove","_move","excess","refresh","newItems","insertAdded","k","addedItems","dataLength","newItem","num","oldItems","newLength","_srt","$_data","handleObj","found","map","mapDef","Map","source","options","oldMapOrTarget","unbound","changing","updatedMap","src","unmap","tgt","getTgt","update","obsSrc","obs","srcFlt","obsTgt","obt","_updt","tgtFlt","baseMap","extend","oldMap","newMap","deps","obmp","newTagCtx","props","tag","_ctxCb","_def","constructor","_dp","_gck","_obs","window"],"mappings":";CAWC,SAASA,EAASC,GAElB,GAAIC,GAAID,EAAOE,MAEQ,iBAAZC,SACVC,OAAOD,QAAUF,EACdF,EAAQC,EAAQC,GAChB,SAASA,GACV,MAAOF,GAAQC,EAAQC,IAEG,kBAAXI,SAAyBA,OAAOC,IACjDD,QAAQ,UAAW,SAASJ,GAC3B,MAAOF,GAAQC,EAAQC,KAGxBF,EAAQC,GAAQ,IAKlB,SAASA,EAAQC,GACjB,YAKA,IAAIM,GAAaN,KAAM,CAIvB,IAFAA,EAAIA,GAAKD,EAAOE,QAEXD,IAAMA,EAAEO,GAEZ,KAAM,8BAGP,IAECC,GAAUC,EAFPC,EAAgB,SAInBC,EAASX,EAAEY,MACVZ,EAAEY,OACFN,GAAcP,EAAOc,UAAYA,SAASD,QAEzCE,QAASJ,EACTK,KAECC,aAEDA,UACCC,SAAU,SAASC,GAElB,MADAC,GAAuBC,EAAaH,SAAWG,EAAaH,WAAaI,MAAM,GACxEH,GAEL,QAAUA,KAAUC,EAAqBE,KAAOH,EAAMG,MACtDC,EAAKC,SACLZ,EAAOK,UAENG,KAIPG,EAAOX,EAAOI,IACdK,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AClBlR,EAAYgQ,EAAIW,KAAK1D,aAAa+C,EAAIkB,IAAKlB,EAAIoB,QAE5CpB,EAAI0B,MACPxJ,EAAW8H,EAAI0B,MAEhB1B,EAAIS,IAAMlM,QAEXyL,IAAKE,EACL6B,KAAM9B,IACJ+B,YAAc9B,EAEVD,GAGRpP,EAAKC,OAAS,WACbD,EAAK4K,MAAQvI,KAAKuI,MAClBnM,EAAOsB,KAAOD,EAAaH,SAASI,MAEjC+D,WAAYtC,GAEZkC,QAEJ1D,EAAKoR,IAAM1O,EACX1C,EAAKqR,KAAOrP,EACZhC,EAAKsR,KAAOpS,EAGb,MAAOR,IACJ6S","file":"jquery.observable.min.js","sourcesContent":["/*! JsObservable v1.0.2: http://jsviews.com/#jsobservable */\n/*\n * Subcomponent of JsViews\n * Data change events for data-linking\n *\n * Copyright 2019, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take jQuery passed as parameter: require(\"jsobservable\")(jQuery)\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine([\"jquery\"], function($) {\n\t\t\treturn factory(global, $); // Require jQuery\n\t\t});\n\t} else { // Browser using plain ',We='',We='',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousSibling;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastChild;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild,\n\t\t\t\t\t\t// since we have removed white space within elCnt. Hence support IE < 9\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\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\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = tmpl.links[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\ttmpl.links[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup\n\tfunction handler(ev, eventArgs) {\n\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t}\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\tif (linkCtx.elem.nodeName === \"SELECT\" && linkCtxType === \"link\" && !linkCtx.attr) {\n\t\tvar $elem = $(linkCtx.elem);\n\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\tvar source = linkCtx.fn(view.data, view, $sub);\n\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t}\n\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\tval = props[l];\n\t\t\t\ttag.setValue(val, l, m);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"), source)) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$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._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\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\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete binding.s[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments),\n\t\t// Now set also delimOpenChar0 etc. in context of jquery.views.js...\n\t\tdelimChars = $subSettings.delimiters;\n\n\tdelimOpenChar0 = delimChars[0].charAt(0);\n\tdelimOpenChar1 = delimChars[0].charAt(1);\n\tdelimCloseChar0 = delimChars[1].charAt(0);\n\tdelimCloseChar1 = delimChars[1].charAt(1);\n\tlinkChar = delimChars[2];\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tvalues[index||0] = val;\n\tif (async) {\n\t\tsetTimeout(function() {\n\t\t\tupdateValues(values, tagElse, bindId, ev);\n\t\t});\n\t} else {\n\t\tupdateValues(values, tagElse, bindId, ev);\n\t}\n\treturn self;\n}\n\nfunction setValues() {\n// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = arguments.length;\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\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\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, linkedCtxPrmKey, indexTo, linkedElems,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse],\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse);\n\n\t\t\t\tif (newVal !== undefined) { // Call tag method tag.setValue(), if implemented\n\t\t\t\t\tval = newVal;\n\t\t\t\t}\n\t\t\t\tif (val !== undefined && (theTag.convert || theTag._.toIndex[indexFrom] === undefined)\n\t\t\t\t\t\t&& (linkedCtxParam = theTag.linkedCtxParam)\n\t\t\t\t\t\t&& linkedCtxParam[indexFrom]\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\t\t&& (linkedCtxPrmKey = linkedCtxParam[indexFrom])\n\t\t\t\t\t) {\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxPrmKey, val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else if ($isArray(val)) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl.value = val; // Don't use jQuery since it replaces array by mapped clone\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\treturn updateValues(arguments, undefined, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) {\n\t\t\t\t\tif (!view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, isMove) {\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, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar prv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\tbindingStore[id].linkCtx.tag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\n\treturn $;\n}, window));\n"]} \ No newline at end of file +{"version":3,"sources":["jquery.views.js"],"names":["factory","global","$","jQuery","exports","module","define","amd","jsr","jso","updateValues","sourceValues","tagElse","async","bindId","ev","linkCtx","cvtBack","cnvtName","target","view","binding","sourceValue","origVals","sourceElem","sourceEl","tos","to","tcpTag","exprOb","contextCb","l","m","tag","_tgId","bindTo","defineBindToDataTargets","bindingStore","elem","_cxp","path","_ocp","ind","_","chg","convertBack","$isFunction","getRsc","nodeName","multiple","_jsvSel","apply","undefined","$isArray","length","data","_vw","onBeforeUpdateVal","change","index","value","toIndex","updateValue","setValue","_jsvInd","_jsvLkEl","fromIndex","_jsvElse","_cpfn","_ctxCb","_cpCtx","sb","$observable","setProperty","onElemChange","val","source","fromAttr","defaultAttr","setter","fnSetters","_jsvTr","delegateTarget","activeBody","type","attr","_jsvChg","rSplitBindings","lastIndex","exec","_jsvBnd","onDataLinkedTagChange","eventArgs","noUpdate","forceUpdate","hasError","onError","bindEarly","tagCtx","this","linkFn","fn","cvt","convert","parentElem","parentNode","oldLinkCtx","_lc","onEvent","changeHandler","onBeforeChangeStr","call","prop","_toLk","_er","$sub","e","onRenderError","Function","props","args","_dfAt","VALUE","CHECKBOX","CHECKED","onUpdate","mergeCtxs","HTML","NONE","callAfterLink","observeAndBind","onAfterChangeStr","dataMap","map","isRenderCall","bnd","onUnbind","ctx","linkedElems","linkedElem","mainElem","displayElem","tagCtxs","tagName","_cnvt","_tag","tmpl","TRUE","addLinkMethods","inline","_lr","template","updateContent","_noUpd","ths","setDefer","_df","deferAttr","prevNode","nextNode","late","nodesToRemove","useProp","tokens","id","openIndex","closeIndex","testElem","cStyle","jsvSel","renders","targetParent","$target","targetVal","_val","unlinked","expr","_elCnt","_prv","_nxt","test","currentStyle","getComputedStyle","display","_jsvd","displayStyles","document","createElement","body","appendChild","removeChild","style","slice","RADIO","nodes","transferViewTokens","getAttribute","jsvAttrStr","indexOf","disposeTokens","setAttribute","previousSibling","lastChild","remove","link","empty","children","TEXTCONTENT","selected","$inArray","lateLink","arrayChangeHandler","self","onBeforeChange","onAfterChange","action","items","srt","refresh","addViews","_dly","removeViews","moveViews","oldIndex","fixIndex","setArrayChangeLink","handler","arrayBinding","bound","useKey","bndArr","off","arrayChangeStr","arrVws","arguments","on","linkGetVal","toLowerCase","$subSettingsAdvanced","_fe","contentEditable","from","renderAndLink","views","context","html","linkToNode","prevView","elCnt","error","bnds","removeViewBinding","nextSibling","render","addBindingMarkers","end","bindingKey","viewStore","k","exprFnDeps","propDeps","depends","tagDepends","allowArray","cvtBk","_hdl","_dp","concat","_depends","deps","bdId","_apply","boundProps","paths","skp","onArrayChange","$extend","_bndId","bindLinkedElChange","flow","lnkCtx","pop","tmplLink","noIteration","parentView","$link","tmplOrLinkExpr","jquery","useInput","elementChangeStr","i","vwInfos","placeholderParent","targetEl","topLevelCall","onRender","replaceMode","$view","topView","root","addDataBinding","markup","scp","cleanData","lnk","viewInfos","rOpenViewMarkers","parent","key","viewLink","outerData","validateOnly","convertMarkers","all","preceding","selfClose","closeTag","spaceBefore","boundId","spaceAfter","tag1","tag2","closeTag2","spaceAfterClose","selfClose2","endOpenTag","errorMsg","bndId","endOfElCnt","inTag","isVoid","parentTag","tagStack","shift","validate","voidElems","join","syntaxError","prevElCnt","elContent","defer","ids","openScript","closeScript","deferStack","charAt","unshift","badParent","processViewInfos","deferPath","deferChar","bindChar","onAftCr","deep","addedBindEls","_tkns","len","vwInfo","ch","j","open","push","removeSubStr","onAfterCreateStr","onAfterCreate","bindEls","getViewInfos","level","named","_is","tagDepth","tags","dataLink","wrap","selector","linkViewsSel","get","elems","qsa","querySelectorAll","innerHTML","prevNodes","found","markerNodeInfo","contains","isLink","rViewMarkers","skip","processInfos","$viewsLinkAttr","rOpenTagMarkers","unmarkPrevOrNextNode","prevIds","linkInfo","token","nextView","node","depth","fragment","copiedNode","firstTag","wrapper","div","htmlTag","thisId","name","noValidate","markPrevOrNextNode","namespaceURI","rFirstElem","replace","rConvertMarkers","safeFragment","wrapMap","createDocumentFragment","firstChild","insertBefore","linkMarkup","currentView","boundTagId","tagExpr","rTagIndex","hasElse","linkExpressions","bindDataLinkTarget","normalizeLinkTag","rTagDatalink","delimCloseChar1","delimOpenChar0","delimOpenChar1","delimCloseChar0","links","tmplFn","rEscapeQuotes","linkCtxType","View","extendCtx","_gccb","$elem","str","substr","SCRIPT","nodeType","isVal","rBinding","getInfos","close","elPath","infos","rMarkerTokens","removeAttribute","marker","twoway","trim","copyFromTagCtxToTag","linkedElements","$linkCtxElem","linkCtxElem","linkedEl","linkedTag","tagCtxElse","oldVal","indexTo","mapDeps","tagCtxslength","linkedElement","mainElement","displayElement","filter","Array","contents","eq","onBind","mapProps","mapDepends","observe","setSize","height","width","className","_jsvCl","hasClass","removeClass","addClass","onAfterLink","cvtArgs","lt","asyncOnElemChange","which","setTimeout","bindTriggerEvent","trig","onoff","isIE","$linkedElem","newTrig","oldTrig","trigger","$subSettings","pathIndex","lastPath","bindtoOb","obsCtxPrm","linkedCtxParam","targetPaths","bindTos","targetPathsElses","_jsvto","resolveDataTargetPath","targetPath","topCp","split","newCtxs","newTagCtx","_thp","clean","bindings","elemArray","linkedElemTag","objId","object","obsId","allLinkedElems","cbId","propertyChangeStr","unmap","onDispose","s","$unlink","each","innerView","getElementsByTagName","inputAttrib","ctxPrm","$views","helpers","viewOrTagChar","viewOrTag","viewId","precedingLength","emptyView","vwItem","rOpenMarkers","values","setValues","tagOrView","bindFrom","theTag","theView","select","filtered","add","find","withMarkers","contentView","prevIsFirstNode","lastSibling","childTags","_gm","constructor","prototype","indexFrom","linkedCtxPrmKey","newVal","base","bindToLength","extra","domChange","hasListener","_data","events","domChangeNotification","triggerHandler","dataItems","delayed","viewsCount","itemsCount","keepNodes","removeView","viewToRemove","current","childView","isArray","splice","parts","itemView","RegExp","setPrv","prv","rTagMarkers","selfNxt","backwards","firstChange","lastChange","movedNodes","viewsToMove","appendTo","afterParts","endChange","startView","endView","afterView","startParts","endParts","observeProps","options","updatePropsArr","propsArr","sort","start","step","reverse","update","tgt","insert","observeMappedProps","src","removeProperty","oldValue","shallowArrayFilter","rShallowArrayPath","setGlobals","jsrender","versionNumber","requiresStr","sub","_jq","$observe","jsviews","linkChar","$viewsSettings","settings","extend","isFunction","$converters","expando","converters","$tags","advanced","propChng","arrChng","syntaxErr","_err","oldAdvSet","window","navigator","userAgent","textContent","bindElsSel","input","text","valueBinding","isCleanCall","oldCleanData","oldJsvDelimiters","delimiters","querySelector","ol","ul","table","tbody","thead","tfoot","tr","colgroup","dl","optgroup","svg","svg_ns","br","img","hr","area","col","meta","command","embed","keygen","param","track","wbr","rViewPath","inArray","observable","onStore","item","parentTmpl","ret","delimChars","rTag","addSetting","merge","regularExpression","currentValue","toggle","init","content","_hi","rTmpl","params","activeElem","contextOb","_sel","_evs","_hlr","contentCtx","dataBoundOnly","radiogroup","Math","random","domChngCntnr","useDisable","disabled","forOrIfTagCtx","parentTags","checked","propParams","sortDataMap","getTgt","obsSrc","obsTgt","arrayView","targetLength","rendering","noVws","done","setDataMap","arrayBindings","_ars","tagCt","paged","sorted","newTagCtxs","prevArg","different","tci","baseTag","tgtFlt","inner","getInnerView","nd","isVl","unlink","oldFn","result","0","_glt","regEx","linkCtxs","helper","last","nextPath","addedTagCpDep","_cp","paramVal","paramExpr","tagCtxPrm","linked","_ucp","_ceo","cloneExprObjects","obs","ob","clones","prm","advSet","_jsv","linkAttr","_wm","option","caption","th","td","useViews","legend","support","htmlSerialize","textarea"],"mappings":";CAeC,SAASA,EAASC,GAElB,GAAIC,GAAID,EAAOE,MAEQ,iBAAZC,SACVC,OAAOD,QAAUF,EACdF,EAAQC,EAAQC,GAChB,SAASA,GACV,MAAOF,GAAQC,EAAQC,IAEG,kBAAXI,SAAyBA,OAAOC,IACjDD,QAAQ,SAAU,aAAc,uBAAwB,SAASJ,EAAGM,EAAKC,GACxE,MAAOT,GAAQC,EAAQC,EAAGM,EAAKC,KAGhCT,EAAQC,GAAQ,IAKlB,SAASA,EAAQC,EAAGM,EAAKC,GACzB,YAgIA,SAASC,GAAaC,EAAcC,EAASC,EAAOC,EAAQC,GAI3D,GAAIC,GAASC,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KAAO,EAAG,SAAU,WAE5DzhB,KACC0Z,OACCxZ,KAAMmS,EAAazf,GAAI+F,IAExB+oB,SAAU9H,GACVtG,OAAQsG,GACRe,UACC/nB,GAAI,YAKCzB,GACLkoB","file":"jquery.views.min.js","sourcesContent":["/*! jquery.views.js v1.0.3: http://jsviews.com/ */\n/*\n * Interactive data-driven views using JsRender templates.\n * Subcomponent of JsViews\n * Requires jQuery and jsrender.js (Best-of-breed templating in browser or on Node.js)\n * See JsRender at http://jsviews.com/#download and http://github.com/BorisMoore/jsrender\n * Also requires jquery.observable.js\n * See JsObservable at http://jsviews.com/#download and http://github.com/BorisMoore/jsviews\n *\n * Copyright 2019, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take jQuery passed as parameter (with JsRender and JsObservable): require(\"jquery.views\")(jQuery)\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine([\"jquery\", \"./jsrender\", \"./jquery.observable\"], function($, jsr, jso) {\n\t\t\treturn factory(global, $, jsr, jso);\n\t\t}); // Require jQuery, JsRender, JsObservable\n\t} else { // Browser using plain ',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousSibling;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastChild;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild,\n\t\t\t\t\t\t// since we have removed white space within elCnt. Hence support IE < 9\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\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\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = tmpl.links[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\ttmpl.links[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup\n\tfunction handler(ev, eventArgs) {\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t\tif (!eventArgs || !eventArgs.refresh) {\n\t\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t}\n\t}\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\tif (linkCtx.elem.nodeName === \"SELECT\" && linkCtxType === \"link\" && !linkCtx.attr) {\n\t\tvar $elem = $(linkCtx.elem);\n\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\tvar source = linkCtx.fn(view.data, view, $sub);\n\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t}\n\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\tval = props[l];\n\t\t\t\ttag.setValue(val, l, m);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"), source)) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$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._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\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\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete binding.s[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments),\n\t\t// Now set also delimOpenChar0 etc. in context of jquery.views.js...\n\t\tdelimChars = $subSettings.delimiters;\n\n\tdelimOpenChar0 = delimChars[0].charAt(0);\n\tdelimOpenChar1 = delimChars[0].charAt(1);\n\tdelimCloseChar0 = delimChars[1].charAt(0);\n\tdelimCloseChar1 = delimChars[1].charAt(1);\n\tlinkChar = delimChars[2];\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tif (arguments.length < 4) {\n\t\tif (+index !== index) {\n\t\t\tasync = index;\n\t\t\ttagElse = index = 0;\n\t\t} else if (+tagElse !== tagElse) {\n\t\t\tasync = tagElse;\n\t\t\ttagElse = 0;\n\t\t}\n\t}\n\tvalues[index||0] = val;\n\tupdateValues(values, tagElse, async, bindId, ev);\n\treturn self;\n}\n\nfunction setValues() {\n// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = arguments.length;\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\tselect = deep ? select || \"*\" : select;\n\t\t\tfiltered = select ? nodes.filter(select) : nodes;\n\t\t\tnodes = deep ? filtered.add(nodes.find(select)) : filtered;\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, linkedCtxPrmKey, indexTo, linkedElems,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse],\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse);\n\n\t\t\t\tif (newVal !== undefined) { // Call tag method tag.setValue(), if implemented\n\t\t\t\t\tval = newVal;\n\t\t\t\t}\n\t\t\t\tif (val !== undefined && (theTag.convert || theTag._.toIndex[indexFrom] === undefined)\n\t\t\t\t\t\t&& (linkedCtxParam = theTag.linkedCtxParam)\n\t\t\t\t\t\t&& linkedCtxParam[indexFrom]\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\t\t&& (linkedCtxPrmKey = linkedCtxParam[indexFrom])\n\t\t\t\t\t) {\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxPrmKey, val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else if ($isArray(val)) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl.value = val; // Don't use jQuery since it replaces array by mapped clone\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\tvar tagElse, async,\n\t\t\t\ttag = this,\n\t\t\t\tbindToLength = tag.bindTo ? tag.bindTo.length : 1,\n\t\t\t\textra = arguments.length - bindToLength;\n\n\t\t\tif (extra) {\n\t\t\t\ttagElse = arguments[bindToLength];\n\t\t\t\tif (extra > 1) {\n\t\t\t\t\tasync = extra > 1 ? arguments[bindToLength + 1] : undefined;\n\t\t\t\t} else if (+tagElse !== tagElse) {\n\t\t\t\t\tasync = tagElse;\n\t\t\t\t\ttagElse = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn updateValues(arguments, tagElse, async, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems, delayed) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false\n\t\t\t\t\t&& !view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, delayed) {\n\t\t\t// view.removeViews() removes all the child views\n\t\t\t// view.removeViews(index) removes the child view with specified index or key\n\t\t\t// view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index\n\t\t\tfunction removeView(index) {\n\t\t\t\tvar id, bindId, parentElem, prevNode, nextNode, nodesToRemove,\n\t\t\t\t\tviewToRemove = views[index];\n\n\t\t\t\tif (viewToRemove && viewToRemove.link) {\n\t\t\t\t\tid = viewToRemove._.id;\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tnodesToRemove = viewToRemove.nodes();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove child views, without removing nodes\n\t\t\t\t\tviewToRemove.removeViews(undefined, undefined, true);\n\n\t\t\t\t\tviewToRemove.type = undefined; // Set type to undefined: used as a flag that this view is being removed\n\t\t\t\t\tprevNode = viewToRemove._prv;\n\t\t\t\t\tnextNode = viewToRemove._nxt;\n\t\t\t\t\tparentElem = viewToRemove.parentElem;\n\t\t\t\t\t// If prevNode and nextNode are the same, the view is empty\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tif (viewToRemove._elCnt) {\n\t\t\t\t\t\t\t// if keepNodes is false (and transferring of tokens has not already been done at a higher level)\n\t\t\t\t\t\t\t// then transfer tokens from prevNode which is being removed, to nextNode.\n\t\t\t\t\t\t\ttransferViewTokens(prevNode, nextNode, parentElem, id, \"_\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(nodesToRemove).remove();\n\t\t\t\t\t}\n\t\t\t\t\tif (!viewToRemove._elCnt) {\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, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar prv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\tbindingStore[id].linkCtx.tag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\n\treturn $;\n}, window));\n"]} \ No newline at end of file diff --git a/jsrender.js b/jsrender.js index 4adcf0f..cfa117e 100644 --- a/jsrender.js +++ b/jsrender.js @@ -1,4 +1,4 @@ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -44,7 +44,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -539,6 +539,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -987,6 +988,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -1214,18 +1218,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -2794,20 +2833,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -2847,6 +2873,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { diff --git a/jsrender.min.js b/jsrender.min.js index 5e664db..0bad3b3 100644 --- a/jsrender.min.js +++ b/jsrender.min.js @@ -1,4 +1,4 @@ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ -!function(e,t){var n=t.jQuery;"object"==typeof exports?module.exports=n?e(t,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return e(t,n)}:"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t,!1)}(function(e,t){"use strict";function n(e,t){return function(){var n,r=this,i=r.base;return r.base=e,n=t.apply(r,arguments),r.base=i,n}}function r(e,t){return ae(t)&&(t=n(e?e._d?e:n(s,e):s,t),t._d=(e&&e._d||0)+1),t}function i(e,t){var n,i=t.props;for(n in i)!Me.test(n)||e[n]&&e[n].fix||(e[n]="convert"!==n?r(e.constructor.prototype[n],i[n]):i[n])}function o(e){return e}function s(){return""}function a(e){try{throw console.log("JsRender dbg breakpoint: "+e),"dbg breakpoint"}catch(t){}return this.base?this.baseApply(arguments):e}function d(e){this.name=(t.link?"JsViews":"JsRender")+" Error",this.message=e||this.name}function l(e,t){if(e){for(var n in t)e[n]=t[n];return e}}function p(e,t,n){return e?de(e)?p.apply(oe,e):(we=n?n[0]:we,/^(\W|_){5}$/.test(e+t+we)||S("Invalid delimiters"),he=e[0],_e=e[1],be=t[0],xe=t[1],ge.delimiters=[he+_e,be+xe,we],e="\\"+he+"(\\"+we+")?\\"+_e,t="\\"+be+"\\"+xe,re="(?:(\\w+(?=[\\/\\s\\"+be+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+be+"]|\\"+be+"(?!\\"+xe+"))*?)",fe.rTag="(?:"+re+")",re=new RegExp("(?:"+e+re+"(\\/)?|\\"+he+"(\\"+we+")?\\"+_e+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+t,"g"),fe.rTmpl=new RegExp("^\\s|\\s$|<.*>|([^\\\\]|^)[{}]|"+e+".*"+t),me):ge.delimiters}function u(e,t){t||e===!0||(t=e,e=void 0);var n,r,i,o,s=this,a="root"===t;if(e){if(o=t&&s.type===t&&s,!o)if(n=s.views,s._.useKey){for(r in n)if(o=t?n[r].get(e,t):n[r])break}else for(r=0,i=n.length;!o&&r1,v=f.ctx;if(n){if(f._||(p=f.index,f=f.tag),u=f,v&&v.hasOwnProperty(n)||(v=ue).hasOwnProperty(n)){if(a=v[n],"tag"===n||"tagCtx"===n||"root"===n||"parentTags"===n||f._.it===n)return a}else v=void 0;if((!ke&&f.tagCtx||f.linked)&&(a&&a._cxp||(f=f.tagCtx||ae(a)?f:(f=f.scope||f,!f.isTop&&f.ctx.tag||f),void 0!==a&&f.tagCtx&&(f=f.tagCtx.view.scope),v=f._ocps,a=v&&v.hasOwnProperty(n)&&v[n]||a,a&&a._cxp||!i&&!g||((v||(f._ocps=f._ocps||{}))[n]=a=[{_ocp:a,_vw:u,_key:n}],a._cxp={path:Te,ind:0,updateValue:function(e,n){return t.observable(a[0]).setProperty(Te,e),this}})),d=a&&a._cxp)){if(arguments.length>2)return s=a[1]?fe._ceo(a[1].deps):[Te],s.unshift(a[0]),s._cxp=d,s;if(p=d.tagElse,c=a[1]?d.tag&&d.tag.cvtArgs?d.tag.cvtArgs(p,1)[d.ind]:a[1](a[0].data,a[0],fe):a[0]._ocp,g)return a&&c!==r&&fe._ucp(n,r,f,d),f;a=c}return a&&ae(a)&&(o=function(){return a.apply(this&&this!==e?this:u,arguments)},l(o,a)),o||a}}function m(e){return e&&(e.fn?e:this.getRsc("templates",e)||le(e))}function h(e,t,n,r){var o,s,a,d,p,u="number"==typeof n&&t.tmpl.bnds[n-1];if(void 0===r&&u&&u._lr&&(r=""),void 0!==r?n=r={props:{},args:[r]}:u&&(n=u(t.data,t,fe)),u=u._bd&&u,e||u){if(s=t._lc,o=s&&s.tag,n.view=t,!o){if(o=l(new fe._tg,{_:{bnd:u,unlinked:!0,lt:n.lt},inline:!s,tagName:":",convert:e,flow:!0,tagCtx:n,tagCtxs:[n],_is:"tag"}),d=n.args.length,d>1)for(p=o.bindTo=[];d--;)p.unshift(d);s&&(s.tag=o,o.linkCtx=s),n.ctx=Q(n.ctx,(s?s.view:t).ctx),i(o,n)}o._er=r&&a,o.ctx=n.ctx||o.ctx||{},n.ctx=void 0,a=o.cvtArgs()[0],o._er=r&&a}else a=n.args[0];return a=u&&t._.onRender?t._.onRender(a,t,o):a,void 0!=a?a:""}function _(e,t){var n,r,i,o,s,a,d,l=this;if(l.tagName){if(a=l,l=(a.tagCtxs||[l])[e||0],!l)return}else a=l.tag;if(s=a.bindFrom,o=l.args,(d=a.convert)&&""+d===d&&(d="true"===d?void 0:l.view.getRsc("converters",d)||S("Unknown converter: '"+d+"'")),d&&!t&&(o=o.slice()),s){for(i=[],n=s.length;n--;)r=s[n],i.unshift(b(l,r));t&&(o=i)}if(d){if(d=d.apply(a,i||o),void 0===d)return o;if(s=s||[0],n=s.length,de(d)&&d.length===n||(d=[d],s=[0],n=1),t)o=d;else for(;n--;)r=s[n],+r===r&&(o[r]=d[n])}return o}function b(e,t){return e=e[+t===t?"args":"props"],e&&e[t]}function x(e){return this.cvtArgs(e,1)}function w(e,t){var n,r,i=this;if(""+t===t){for(;void 0===n&&i;)r=i.tmpl&&i.tmpl[e],n=r&&r[t],i=i.parent;return n||oe[e][t]}}function y(e,t,n,r,o,s){function a(e){var t=d[e];if(void 0!==t)for(t=de(t)?t:[t],m=t.length;m--;)J=t[m],isNaN(parseInt(J))||(t[m]=parseInt(J));return t||[0]}t=t||ie;var d,l,p,u,c,f,g,m,h,w,y,k,C,T,j,A,N,P,R,F,V,$,M,I,D,J,U,q,K,L,B=0,H="",W=t._lc||!1,Z=t.ctx,z=n||t.tmpl,G="number"==typeof r&&t.tmpl.bnds[r-1];for("tag"===e._is?(d=e,e=d.tagName,r=d.tagCtxs,p=d.template):(l=t.getRsc("tags",e)||S("Unknown tag: {{"+e+"}} "),p=l.template),void 0===s&&G&&(G._lr=l.lateRender&&G._lr!==!1||G._lr)&&(s=""),void 0!==s?(H+=s,r=s=[{props:{},args:[],params:{props:{}}}]):G&&(r=G(t.data,t,fe)),g=r.length;B0&&(s=n)){if(!s)if(/^\.\/[^\\:*?"<>]*$/.test(n))(a=le[e=e||n])?n=a:s=document.getElementById(n);else if(t.fn&&!fe.rTmpl.test(n))try{s=t(n,document)[0]}catch(d){}s&&("SCRIPT"!==s.tagName&&S(n+": Use script block, not "+s.tagName),i?n=s.innerHTML:(o=s.getAttribute(Be),o&&(o!==Qe?(n=le[o],delete le[o]):t.fn&&(n=t.data(s)[Qe])),o&&n||(e=e||(t.fn?Qe:n),n=A(e,s.innerHTML,r,i)),n.tmplName=e=e||o,e!==Qe&&(le[e]=n),s.setAttribute(Be,e),t.fn&&t.data(s,Qe,n))),s=void 0}else n.fn||(n=void 0);return n}var s,a,d=n=n||"";if(fe._html=pe.html,0===i&&(i=void 0,d=o(d)),i=i||(n.markup?n.bnds?l({},n):n:{}),i.tmplName=i.tmplName||e||"unnamed",r&&(i._parentTmpl=r),!d&&n.markup&&(d=o(n.markup))&&d.fn&&(d=d.markup),void 0!==d)return d.render||n.render?d.tmpls&&(a=d):(n=F(d,i),J(d.replace(Ne,"\\$&"),n)),a||(a=l(function(){return a.render.apply(a,arguments)},n),C(a)),a}function N(e,t){return ae(e)?e.call(t):e}function P(e){for(var t=[],n=0,r=e.length;nO-(U||0))){if(U=I.slice(U,O+i.length),q!==!0)if(K=s||f[m-1].bd,L=K[K.length-1],L&&L.prm){for(;L.sb&&L.sb.prm;)L=L.sb;B=L.sb={path:L.sb,bnd:L.bnd}}else K.push(B={path:K.pop()});$=_e+":"+U+" onerror=''"+be,q=v[$],q||(v[$]=!0,v[$]=q=J($,n,!0)),q!==!0&&B&&(B._cpfn=q,B.prm=c.bd,B.bnd=B.bnd||B.path&&B.path.indexOf("^")>=0)}return l?(l=!R,l?i:P+'"'):d?(d=!F,d?i:P+'"'):(b?(_[m]=O++,c=f[++m]={bd:[]},b):"")+(E?m?"":(g=I.slice(g,O),(o?(o=a=s=!1,"\b"):"\b,")+g+(g=O+i.length,u&&t.push(c.bd=[]),"\b")):C?(m&&D(e),u&&t.pop(),o="_"+w,a=x,g=O+i.length,u&&(u=c.bd=t[o]=[],u.skp=!x),w+":"):w?w.split("^").join(".").replace(fe.rPath,S)+(A?(c=f[++m]={bd:[]},h[m]=Q,A):y):y?y:V?(V=h[m]||V,h[m]=!1,c=f[--m],V+(A?(c=f[++m],h[m]=Q,A):"")):N?(h[m]||D(e),","):p?"":(l=R,d=F,'"'))}D(e)}var o,s,a,d,l,p,u=t&&t[0],c={bd:u},f={0:c},g=0,v=(n?n.links:u&&(u.links=u.links||{}))||ie.tmpl.links,m=0,h={},_={};return"@"===e[0]&&(e=e.replace(De,".")),p=(e+(n?" ":"")).replace(fe.rPrm,i),!m&&p||D(e)}function B(e,t,n){var r,i,o,s,a,d,l,p,u,c,f,g,v,m,h,_,b,x,w,y,k,C,T,j,A,N,P,R,V,$,M,E,O,I=0,S=ve.useViews||t.useViews||t.tags||t.templates||t.helpers||t.converters,J="",q={},L=e.length;for(""+t===t?(x=n?'data-link="'+t.replace(je," ").slice(1,-1)+'"':t,t=0):(x=t.tmplName||"unnamed",t.allowCode&&(q.allowCode=!0),t.debug&&(q.debug=!0),f=t.bnds,b=t.tmpls),r=0;r":s+o):(k&&(w=F(C,q),w.tmplName=x+"/"+o,w.useViews=w.useViews||S,B(k,w),S=w.useViews,b.push(w)),A||(y=o,S=S||o&&(!ce[o]||!ce[o].flow),j=J,J=""),T=e[r+1],T=T&&"else"===T[0]),V=R?";\ntry{\nret+=":"\n+",m="",h="",N&&(g||$||s&&s!==Ke||M)){if(P=new Function("data,view,j,u","// "+x+" "+ ++I+" "+o+E+"{"+a+"};"+O),P._er=R,P._tag=o,P._bd=!!g,P._lr=M,n)return P;U(P,g),_='c("'+s+'",view,',c=!0,m=_+I+",",h=")"}if(J+=N?(n?(R?"try{\n":"")+"return ":V)+(c?(c=void 0,S=u=!0,_+(P?(f[I-1]=P,I):"{"+a+"}")+")"):">"===o?(l=!0,"h("+v[0]+")"):(p=!0,"((v="+v[0]+")!=null?v:"+(n?"null)":'"")'))):(d=!0,"\n{view:view,content:false,tmpl:"+(k?b.length:"false")+","+a+"},"),y&&!T){if(J="["+J.slice(0,-1)+"]",_='t("'+y+'",view,this,',n||g){if(J=new Function("data,view,j,u"," // "+x+" "+I+" "+y+E+J+O),J._er=R,J._tag=y,g&&U(f[I-1]=J,g),J._lr=M,n)return J;m=_+I+",undefined,",h=")"}J=j+V+_+(g&&I||J)+")",g=0,y=0}R&&!T&&(S=!0,J+=";\n}catch(e){ret"+(n?"urn ":"+=")+m+"j._err(e,view,"+R+")"+h+";}"+(n?"":"ret=ret"))}J="// "+x+(q.debug?"\ndebugger;":"")+"\nvar v"+(d?",t=j._tag":"")+(u?",c=j._cnvt":"")+(l?",h=j._html":"")+(n?(i[8]?", ob":"")+";\n":',ret=""')+J+(n?"\n":";\nreturn ret;");try{J=new Function("data,view,j,u",J)}catch(Q){D("Compiled template code:\n\n"+J+'\n: "'+(Q.message||Q)+'"')}return t&&(t.fn=J,t.useViews=!!S),J}function Q(e,t){return e&&e!==t?t?l(l({},t),e):e:t&&l({},t)}function H(e,n){var r,i,o=n.map,s=o&&o.propsArr;if(!s){if(s=[],typeof e===Le||ae(e))for(r in e)i=e[r],r===se||!e.hasOwnProperty(r)||n.props.noFunctions&&t.isFunction(i)||s.push({key:r,prop:i});o&&(o.propsArr=o.options&&s)}return W(s,n)}function W(e,n){var r,i,o,s=n.tag,a=n.props,d=n.params.props,l=a.filter,p=a.sort,u=p===!0,c=parseInt(a.step),f=a.reverse?-1:1;if(!de(e))return e;if(u||p&&""+p===p?(r=e.map(function(e,t){return e=u?e:g(e,p),{i:t,v:""+e===e?e.toLowerCase():e}}),r.sort(function(e,t){return e.v>t.v?f:e.ve.length?e.length:+o,e=e.slice(i,o)),c>1){for(i=0,o=e.length,r=[];i\s]/,Ve=/[\x00`><"'&=]/g,$e=/[\x00`><\"'&=]/,Me=/^on[A-Z]|^convert(Back)?$/,Ee=/^\#\d+_`[\s\S]*\/\d+_`$/,Oe=Ve,Ie=/[&<>]/g,Se=/&(amp|gt|lt);/g,De=/\[['"]?|['"]?\]/g,Je=0,Ue={"&":"&","<":"<",">":">","\0":"�","'":"'",'"':""","`":"`","=":"="},qe={amp:"&",gt:">",lt:"<"},Ke="html",Le="object",Be="data-jsv-tmpl",Qe="jsvTmpl",He="For #index in nested block use #getIndex().",We={},Ze=e.jsrender,ze=Ze&&t&&!t.render,Ge={template:{compile:A},tag:{compile:T},viewModel:{compile:R},helper:{},converter:{}};if(oe={jsviews:Ce,sub:{rPath:/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,rPrm:/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(~?[\w$.^]+)?\s*((\+\+|--)|\+|-|~(?![\w$])|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?(@)?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,View:k,Err:d,tmplFn:J,parse:L,extend:l,extendCtx:Q,syntaxErr:D,onStore:{template:function(e,t){null===t?delete We[e]:e&&(We[e]=t)}},addSetting:$,settings:{allowCode:!1},advSet:s,_thp:i,_gm:r,_tg:function(){},_cnvt:h,_tag:y,_er:S,_err:I,_cp:o,_sq:function(e){return"constructor"===e&&D(""),e}},settings:{delimiters:p,advanced:function(e){return e?(l(ve,e),fe.advSet(),me):ve}},map:M},(d.prototype=new Error).constructor=d,c.depends=function(){return[this.get("item"),"index"]},f.depends="index",k.prototype={get:u,getIndex:f,ctxPrm:v,getRsc:w,_getTmpl:m,_getOb:g,_is:"view"},fe=oe.sub,me=oe.settings,!(Ze||t&&t.render)){for(ne in Ge)V(ne,Ge[ne]);if(pe=oe.converters,ue=oe.helpers,ce=oe.tags,fe._tg.prototype={baseApply:j,cvtArgs:_,bndArgs:x,ctxPrm:v},ie=fe.topView=new k,t){if(t.fn.render=Z,se=t.expando,t.observable){if(Ce!==(Ce=t.views.jsviews))throw"JsObservable requires JsRender "+Ce;l(fe,t.views.sub),oe.map=t.views.map}}else t={},te&&(e.jsrender=t),t.renderFile=t.__express=t.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},t.isFunction=function(e){return"function"==typeof e},t.isArray=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},fe._jq=function(e){e!==t&&(l(e,t),t=e,t.fn.render=Z,delete t.jsrender,se=t.expando)},t.jsrender=Ce;ge=fe.settings,ge.allowCode=!1,ae=t.isFunction,t.render=We,t.views=oe,t.templates=le=oe.templates;for(ye in ge)$(ye);(me.debugMode=function(e){return void 0===e?ge.debugMode:(ge.debugMode=e,ge.onError=e+""===e?function(){return e}:ae(e)?e:void 0,me)})(!1),ve=ge.advanced={useViews:!1,_jsv:!1},ce({"if":{render:function(e){var t=this,n=t.tagCtx,r=t.rendering.done||!e&&(n.args.length||!n.index)?"":(t.rendering.done=!0,void(t.selected=n.index));return r},contentCtx:!0,flow:!0},"for":{sortDataMap:M(W),init:function(e,t){var n,r,i,o=this,s=o.tagCtxs;for(n=s.length;n--;)r=s[n],i=r.params.props,r.argDefault=void 0===r.props.end||r.args.length>0,r.argDefault!==!1&&de(r.args[0])&&(void 0!==i.sort||i.start||i.end||i.step||i.filter||i.reverse)&&(r.props.dataMap=o.sortDataMap)},render:function(e){var t,n,r,i,o,s=this,a=s.tagCtx,d=a.argDefault===!1,l=a.props,p=d||a.args.length,u="",c=0;if(!s.rendering.done){if(t=p?e:a.view.data,d)for(d=l.reverse?"unshift":"push",i=+l.end,o=+l.step||1,t=[],r=+l.start||0;(i-r)*o>0;r+=o)t[d](r);void 0!==t&&(n=de(t),u+=a.render(t,!p||l.noIteration),c+=n?t.length:1),(s.rendering.done=c)&&(s.selected=a.index)}return u},flow:!0},props:{baseTag:"for",dataMap:M(H),init:s,flow:!0},include:{flow:!0},"*":{render:o,flow:!0},":*":{render:o,flow:!0},dbg:ue.dbg=pe.dbg=a}),pe({html:X,attr:X,encode:Y,unencode:ee,url:function(e){return void 0!=e?encodeURI(""+e):null===e?e:""}})}return ge=fe.settings,de=(t||Ze).isArray,me.delimiters("{{","}}","^"),ze&&Ze.views.sub._jq(t),t||Ze},window); +!function(e,t){var n=t.jQuery;"object"==typeof exports?module.exports=n?e(t,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return e(t,n)}:"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t,!1)}(function(e,t){"use strict";function n(e,t){return function(){var n,r=this,i=r.base;return r.base=e,n=t.apply(r,arguments),r.base=i,n}}function r(e,t){return se(t)&&(t=n(e?e._d?e:n(a,e):a,t),t._d=(e&&e._d||0)+1),t}function i(e,t){var n,i=t.props;for(n in i)!$e.test(n)||e[n]&&e[n].fix||(e[n]="convert"!==n?r(e.constructor.prototype[n],i[n]):i[n])}function o(e){return e}function a(){return""}function s(e){try{throw console.log("JsRender dbg breakpoint: "+e),"dbg breakpoint"}catch(t){}return this.base?this.baseApply(arguments):e}function l(e){this.name=(t.link?"JsViews":"JsRender")+" Error",this.message=e||this.name}function d(e,t){if(e){for(var n in t)e[n]=t[n];return e}}function p(e,t,n){return e?le(e)?p.apply(oe,e):(we=n?n[0]:we,/^(\W|_){5}$/.test(e+t+we)||S("Invalid delimiters"),he=e[0],_e=e[1],be=t[0],xe=t[1],ge.delimiters=[he+_e,be+xe,we],e="\\"+he+"(\\"+we+")?\\"+_e,t="\\"+be+"\\"+xe,re="(?:(\\w+(?=[\\/\\s\\"+be+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+be+"]|\\"+be+"(?!\\"+xe+"))*?)",fe.rTag="(?:"+re+")",re=new RegExp("(?:"+e+re+"(\\/)?|\\"+he+"(\\"+we+")?\\"+_e+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+t,"g"),fe.rTmpl=new RegExp("^\\s|\\s$|<.*>|([^\\\\]|^)[{}]|"+e+".*"+t),me):ge.delimiters}function u(e,t){t||e===!0||(t=e,e=void 0);var n,r,i,o,a=this,s="root"===t;if(e){if(o=t&&a.type===t&&a,!o)if(n=a.views,a._.useKey){for(r in n)if(o=t?n[r].get(e,t):n[r])break}else for(r=0,i=n.length;!o&&r1,v=f.ctx;if(n){if(f._||(p=f.index,f=f.tag),u=f,v&&v.hasOwnProperty(n)||(v=ue).hasOwnProperty(n)){if(s=v[n],"tag"===n||"tagCtx"===n||"root"===n||"parentTags"===n||f._.it===n)return s}else v=void 0;if((!ke&&f.tagCtx||f.linked)&&(s&&s._cxp||(f=f.tagCtx||se(s)?f:(f=f.scope||f,!f.isTop&&f.ctx.tag||f),void 0!==s&&f.tagCtx&&(f=f.tagCtx.view.scope),v=f._ocps,s=v&&v.hasOwnProperty(n)&&v[n]||s,s&&s._cxp||!i&&!g||((v||(f._ocps=f._ocps||{}))[n]=s=[{_ocp:s,_vw:u,_key:n}],s._cxp={path:Te,ind:0,updateValue:function(e,n){return t.observable(s[0]).setProperty(Te,e),this}})),l=s&&s._cxp)){if(arguments.length>2)return a=s[1]?fe._ceo(s[1].deps):[Te],a.unshift(s[0]),a._cxp=l,a;if(p=l.tagElse,c=s[1]?l.tag&&l.tag.cvtArgs?l.tag.cvtArgs(p,1)[l.ind]:s[1](s[0].data,s[0],fe):s[0]._ocp,g)return s&&c!==r&&fe._ucp(n,r,f,l),f;s=c}return s&&se(s)&&(o=function(){return s.apply(this&&this!==e?this:u,arguments)},d(o,s)),o||s}}function m(e){return e&&(e.fn?e:this.getRsc("templates",e)||de(e))}function h(e,t,n,r){var o,a,s,l,p,u="number"==typeof n&&t.tmpl.bnds[n-1];if(void 0===r&&u&&u._lr&&(r=""),void 0!==r?n=r={props:{},args:[r]}:u&&(n=u(t.data,t,fe)),u=u._bd&&u,e||u){if(a=t._lc,o=a&&a.tag,n.view=t,!o){if(o=d(new fe._tg,{_:{bnd:u,unlinked:!0,lt:n.lt},inline:!a,tagName:":",convert:e,onArrayChange:!0,flow:!0,tagCtx:n,tagCtxs:[n],_is:"tag"}),l=n.args.length,l>1)for(p=o.bindTo=[];l--;)p.unshift(l);a&&(a.tag=o,o.linkCtx=a),n.ctx=Q(n.ctx,(a?a.view:t).ctx),i(o,n)}o._er=r&&s,o.ctx=n.ctx||o.ctx||{},n.ctx=void 0,s=o.cvtArgs()[0],o._er=r&&s}else s=n.args[0];return s=u&&t._.onRender?t._.onRender(s,t,o):s,void 0!=s?s:""}function _(e,t){var n,r,i,o,a,s,l,d=this;if(d.tagName){if(s=d,d=(s.tagCtxs||[d])[e||0],!d)return}else s=d.tag;if(a=s.bindFrom,o=d.args,(l=s.convert)&&""+l===l&&(l="true"===l?void 0:d.view.getRsc("converters",l)||S("Unknown converter: '"+l+"'")),l&&!t&&(o=o.slice()),a){for(i=[],n=a.length;n--;)r=a[n],i.unshift(b(d,r));t&&(o=i)}if(l){if(l=l.apply(s,i||o),void 0===l)return o;if(a=a||[0],n=a.length,le(l)&&l.length===n||(l=[l],a=[0],n=1),t)o=l;else for(;n--;)r=a[n],+r===r&&(o[r]=l[n])}return o}function b(e,t){return e=e[+t===t?"args":"props"],e&&e[t]}function x(e){return this.cvtArgs(e,1)}function w(e,t){var n,r,i=this;if(""+t===t){for(;void 0===n&&i;)r=i.tmpl&&i.tmpl[e],n=r&&r[t],i=i.parent;return n||oe[e][t]}}function y(e,t,n,r,o,a){function s(e){var t=l[e];if(void 0!==t)for(t=le(t)?t:[t],m=t.length;m--;)J=t[m],isNaN(parseInt(J))||(t[m]=parseInt(J));return t||[0]}t=t||ie;var l,d,p,u,c,f,g,m,h,w,y,k,C,T,j,A,P,R,N,M,F,V,$,I,D,J,U,q,K,L,B=0,H="",W=t._lc||!1,Z=t.ctx,z=n||t.tmpl,G="number"==typeof r&&t.tmpl.bnds[r-1];for("tag"===e._is?(l=e,e=l.tagName,r=l.tagCtxs,p=l.template):(d=t.getRsc("tags",e)||S("Unknown tag: {{"+e+"}} "),p=d.template),void 0===a&&G&&(G._lr=d.lateRender&&G._lr!==!1||G._lr)&&(a=""),void 0!==a?(H+=a,r=a=[{props:{},args:[],params:{props:{}}}]):G&&(r=G(t.data,t,fe)),g=r.length;B0&&(a=n)){if(!a)if(/^\.\/[^\\:*?"<>]*$/.test(n))(s=de[e=e||n])?n=s:a=document.getElementById(n);else if(t.fn&&!fe.rTmpl.test(n))try{a=t(n,document)[0]}catch(l){}a&&("SCRIPT"!==a.tagName&&S(n+": Use script block, not "+a.tagName),i?n=a.innerHTML:(o=a.getAttribute(Be),o&&(o!==Qe?(n=de[o],delete de[o]):t.fn&&(n=t.data(a)[Qe])),o&&n||(e=e||(t.fn?Qe:n),n=A(e,a.innerHTML,r,i)),n.tmplName=e=e||o,e!==Qe&&(de[e]=n),a.setAttribute(Be,e),t.fn&&t.data(a,Qe,n))),a=void 0}else n.fn||(n=void 0);return n}var a,s,l=n=n||"";if(fe._html=pe.html,0===i&&(i=void 0,l=o(l)),i=i||(n.markup?n.bnds?d({},n):n:{}),i.tmplName=i.tmplName||e||"unnamed",r&&(i._parentTmpl=r),!l&&n.markup&&(l=o(n.markup))&&l.fn&&(l=l.markup),void 0!==l)return l.render||n.render?l.tmpls&&(s=l):(n=M(l,i),J(l.replace(Pe,"\\$&"),n)),s||(s=d(function(){return s.render.apply(s,arguments)},n),C(s)),s}function P(e,t){return se(e)?e.call(t):e}function R(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0})}function N(e,n){function r(e){p.apply(this,e)}function i(){return new r(arguments)}function o(e,t){for(var n,r,i,o,a,s=0;sE-(U||0))){if(U=I.slice(U,E+i.length),q!==!0)if(K=a||f[m-1].bd,L=K[K.length-1],L&&L.prm){for(;L.sb&&L.sb.prm;)L=L.sb;B=L.sb={path:L.sb,bnd:L.bnd}}else K.push(B={path:K.pop()});V=_e+":"+U+" onerror=''"+be,q=v[V],q||(v[V]=!0,v[V]=q=J(V,n,!0)),q!==!0&&B&&(B._cpfn=q,B.prm=c.bd,B.bnd=B.bnd||B.path&&B.path.indexOf("^")>=0)}return d?(d=!N,d?i:R+'"'):l?(l=!M,l?i:R+'"'):(b?(_[m]=E++,c=f[++m]={bd:[]},b):"")+(O?m?"":(g=I.slice(g,E),(o?(o=s=a=!1,"\b"):"\b,")+g+(g=E+i.length,u&&t.push(c.bd=[]),"\b")):C?(m&&D(e),u&&t.pop(),o="_"+w,s=x,g=E+i.length,u&&(u=c.bd=t[o]=[],u.skp=!x),w+":"):w?w.split("^").join(".").replace(fe.rPath,S)+(A?(c=f[++m]={bd:[]},h[m]=Q,A):y):y?y:F?(F=h[m]||F,h[m]=!1,c=f[--m],F+(A?(c=f[++m],h[m]=Q,A):"")):P?(h[m]||D(e),","):p?"":(d=N,l=M,'"'))}D(e)}var o,a,s,l,d,p,u=t&&t[0],c={bd:u},f={0:c},g=0,v=(n?n.links:u&&(u.links=u.links||{}))||ie.tmpl.links,m=0,h={},_={};return"@"===e[0]&&(e=e.replace(De,".")),p=(e+(n?" ":"")).replace(fe.rPrm,i),!m&&p||D(e)}function B(e,t,n){var r,i,o,a,s,l,d,p,u,c,f,g,v,m,h,_,b,x,w,y,k,C,T,j,A,P,R,N,F,V,$,O,E,I=0,S=ve.useViews||t.useViews||t.tags||t.templates||t.helpers||t.converters,J="",q={},L=e.length;for(""+t===t?(x=n?'data-link="'+t.replace(je," ").slice(1,-1)+'"':t,t=0):(x=t.tmplName||"unnamed",t.allowCode&&(q.allowCode=!0),t.debug&&(q.debug=!0),f=t.bnds,b=t.tmpls),r=0;r":a+o):(k&&(w=M(C,q),w.tmplName=x+"/"+o,w.useViews=w.useViews||S,B(k,w),S=w.useViews,b.push(w)),A||(y=o,S=S||o&&(!ce[o]||!ce[o].flow),j=J,J=""),T=e[r+1],T=T&&"else"===T[0]),F=N?";\ntry{\nret+=":"\n+",m="",h="",P&&(g||V||a&&a!==Ke||$)){if(R=new Function("data,view,j,u","// "+x+" "+ ++I+" "+o+O+"{"+s+"};"+E),R._er=N,R._tag=o,R._bd=!!g,R._lr=$,n)return R;U(R,g),_='c("'+a+'",view,',c=!0,m=_+I+",",h=")"}if(J+=P?(n?(N?"try{\n":"")+"return ":F)+(c?(c=void 0,S=u=!0,_+(R?(f[I-1]=R,I):"{"+s+"}")+")"):">"===o?(d=!0,"h("+v[0]+")"):(p=!0,"((v="+v[0]+")!=null?v:"+(n?"null)":'"")'))):(l=!0,"\n{view:view,content:false,tmpl:"+(k?b.length:"false")+","+s+"},"),y&&!T){if(J="["+J.slice(0,-1)+"]",_='t("'+y+'",view,this,',n||g){if(J=new Function("data,view,j,u"," // "+x+" "+I+" "+y+O+J+E),J._er=N,J._tag=y,g&&U(f[I-1]=J,g),J._lr=$,n)return J;m=_+I+",undefined,",h=")"}J=j+F+_+(g&&I||J)+")",g=0,y=0}N&&!T&&(S=!0,J+=";\n}catch(e){ret"+(n?"urn ":"+=")+m+"j._err(e,view,"+N+")"+h+";}"+(n?"":"ret=ret"))}J="// "+x+(q.debug?"\ndebugger;":"")+"\nvar v"+(l?",t=j._tag":"")+(u?",c=j._cnvt":"")+(d?",h=j._html":"")+(n?(i[8]?", ob":"")+";\n":',ret=""')+J+(n?"\n":";\nreturn ret;");try{J=new Function("data,view,j,u",J)}catch(Q){D("Compiled template code:\n\n"+J+'\n: "'+(Q.message||Q)+'"')}return t&&(t.fn=J,t.useViews=!!S),J}function Q(e,t){return e&&e!==t?t?d(d({},t),e):e:t&&d({},t)}function H(e,n){var r,i,o=n.map,a=o&&o.propsArr;if(!a){if(a=[],typeof e===Le||se(e))for(r in e)i=e[r],r===ae||!e.hasOwnProperty(r)||n.props.noFunctions&&t.isFunction(i)||a.push({key:r,prop:i});o&&(o.propsArr=o.options&&a)}return W(a,n)}function W(e,n){var r,i,o,a=n.tag,s=n.props,l=n.params.props,d=s.filter,p=s.sort,u=p===!0,c=parseInt(s.step),f=s.reverse?-1:1;if(!le(e))return e;if(u||p&&""+p===p?(r=e.map(function(e,t){return e=u?e:g(e,p),{i:t,v:""+e===e?e.toLowerCase():e}}),r.sort(function(e,t){return e.v>t.v?f:e.ve.length?e.length:+o,e=e.slice(i,o)),c>1){for(i=0,o=e.length,r=[];i\s]/,Fe=/[\x00`><"'&=]/g,Ve=/[\x00`><\"'&=]/,$e=/^on[A-Z]|^convert(Back)?$/,Oe=/^\#\d+_`[\s\S]*\/\d+_`$/,Ee=Fe,Ie=/[&<>]/g,Se=/&(amp|gt|lt);/g,De=/\[['"]?|['"]?\]/g,Je=0,Ue={"&":"&","<":"<",">":">","\0":"�","'":"'",'"':""","`":"`","=":"="},qe={amp:"&",gt:">",lt:"<"},Ke="html",Le="object",Be="data-jsv-tmpl",Qe="jsvTmpl",He="For #index in nested block use #getIndex().",We={},Ze=e.jsrender,ze=Ze&&t&&!t.render,Ge={template:{compile:A},tag:{compile:T},viewModel:{compile:N},helper:{},converter:{}};if(oe={jsviews:Ce,sub:{rPath:/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,rPrm:/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(~?[\w$.^]+)?\s*((\+\+|--)|\+|-|~(?![\w$])|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?(@)?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,View:k,Err:l,tmplFn:J,parse:L,extend:d,extendCtx:Q,syntaxErr:D,onStore:{template:function(e,t){null===t?delete We[e]:e&&(We[e]=t)}},addSetting:V,settings:{allowCode:!1},advSet:a,_thp:i,_gm:r,_tg:function(){},_cnvt:h,_tag:y,_er:S,_err:I,_cp:o,_sq:function(e){return"constructor"===e&&D(""),e}},settings:{delimiters:p,advanced:function(e){return e?(d(ve,e),fe.advSet(),me):ve}},map:$},(l.prototype=new Error).constructor=l,c.depends=function(){return[this.get("item"),"index"]},f.depends="index",k.prototype={get:u,getIndex:f,ctxPrm:v,getRsc:w,_getTmpl:m,_getOb:g,_is:"view"},fe=oe.sub,me=oe.settings,!(Ze||t&&t.render)){for(ne in Ge)F(ne,Ge[ne]);if(pe=oe.converters,ue=oe.helpers,ce=oe.tags,fe._tg.prototype={baseApply:j,cvtArgs:_,bndArgs:x,ctxPrm:v},ie=fe.topView=new k,t){if(t.fn.render=Z,ae=t.expando,t.observable){if(Ce!==(Ce=t.views.jsviews))throw"JsObservable requires JsRender "+Ce;d(fe,t.views.sub),oe.map=t.views.map}}else t={},te&&(e.jsrender=t),t.renderFile=t.__express=t.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},t.isFunction=function(e){return"function"==typeof e},t.isArray=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},fe._jq=function(e){e!==t&&(d(e,t),t=e,t.fn.render=Z,delete t.jsrender,ae=t.expando)},t.jsrender=Ce;ge=fe.settings,ge.allowCode=!1,se=t.isFunction,t.render=We,t.views=oe,t.templates=de=oe.templates;for(ye in ge)V(ye);(me.debugMode=function(e){return void 0===e?ge.debugMode:(ge.debugMode=e,ge.onError=e+""===e?function(){return e}:se(e)?e:void 0,me)})(!1),ve=ge.advanced={useViews:!1,_jsv:!1},ce({"if":{render:function(e){var t=this,n=t.tagCtx,r=t.rendering.done||!e&&(n.args.length||!n.index)?"":(t.rendering.done=!0,void(t.selected=n.index));return r},contentCtx:!0,flow:!0},"for":{sortDataMap:$(W),init:function(e,t){this.setDataMap(this.tagCtxs)},render:function(e){var t,n,r,i,o,a=this,s=a.tagCtx,l=s.argDefault===!1,d=s.props,p=l||s.args.length,u="",c=0;if(!a.rendering.done){if(t=p?e:s.view.data,l)for(l=d.reverse?"unshift":"push",i=+d.end,o=+d.step||1,t=[],r=+d.start||0;(i-r)*o>0;r+=o)t[l](r);void 0!==t&&(n=le(t),u+=s.render(t,!p||d.noIteration),c+=n?t.length:1),(a.rendering.done=c)&&(a.selected=s.index)}return u},setDataMap:function(e){for(var t,n,r,i=this,o=e.length;o--;)t=e[o],n=t.props,r=t.params.props,t.argDefault=void 0===n.end||t.args.length>0,n.dataMap=t.argDefault!==!1&&le(t.args[0])&&(r.sort||r.start||r.end||r.step||r.filter||r.reverse||n.sort||n.start||n.end||n.step||n.filter||n.reverse)&&i.sortDataMap},flow:!0},props:{baseTag:"for",dataMap:$(H),init:a,flow:!0},include:{flow:!0},"*":{render:o,flow:!0},":*":{render:o,flow:!0},dbg:ue.dbg=pe.dbg=s}),pe({html:X,attr:X,encode:Y,unencode:ee,url:function(e){return void 0!=e?encodeURI(""+e):null===e?e:""}})}return ge=fe.settings,le=(t||Ze).isArray,me.delimiters("{{","}}","^"),ze&&Ze.views.sub._jq(t),t||Ze},window); //# sourceMappingURL=jsrender.min.js.map diff --git a/jsrender.min.js.map b/jsrender.min.js.map index 7c11d4e..7c39db9 100644 --- a/jsrender.min.js.map +++ b/jsrender.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["jsrender.js"],"names":["factory","global","$","jQuery","exports","module","fn","define","amd","getDerivedMethod","baseMethod","method","ret","tag","this","prevBase","base","apply","arguments","getMethod","$isFunction","_d","noop","tagHandlersFromProps","tagCtx","prop","props","rHasHandlers","test","fix","constructor","prototype","retVal","val","dbgBreak","console","log","e","baseApply","JsViewsError","message","name","link","$extend","target","source","$viewsDelimiters","openChars","closeChars","$isArray","$views","linkChar","error","delimOpenChar0","delimOpenChar1","delimCloseChar0","delimCloseChar1","$subSettings","delimiters","rTag","$sub","RegExp","rTmpl","$viewsSettings","getView","inner","type","undefined","views","i","l","found","view","root","_","useKey","get","length","parent","getNestedIndex","index","getIndex","getPathObject","ob","path","ltOb","prevOb","tokens","split","lt","contextParameter","key","value","wrapped","deps","res","obsCtxPrm","tagElse","callView","newRes","storeView","isUpdate","isRenderCall","store","ctx","hasOwnProperty","$helpers","it","linked","_cxp","scope","isTop","_ocps","_ocp","_vw","_key","ind","updateValue","observable","setProperty","_ceo","unshift","cvtArgs","data","_ucp","getTemplate","tmpl","getRsc","$templates","convertVal","converter","onError","linkCtx","argsLen","bindTo","boundTag","bnds","_lr","args","_bd","_lc","_tg","bnd","unlinked","inline","tagName","convert","flow","tagCtxs","_is","extendCtx","_er","onRender","convertArgs","bound","boundArgs","bindFrom","slice","argOrProp","context","convertBoundArgs","getResource","resourceType","itemName","renderTag","parentView","bindToOrBindFrom","bindArray","m","isNaN","parseInt","topView","tagDef","template","tags","attr","parentTag","n","itemRet","tagCtxCtx","ctxPrm","initVal","content","callInit","mapDef","thisMap","bdArgs","tagDataMap","contentCtx","bindFromLength","bindToLength","linkedElement","defaultCtx","parentTmpl","lateRender","params","tmpls","render","renderContent","bndArgs","_getTmpl","init","_ctr","ths","arrVws","dataBoundOnly","dataMap","map","parents","parentTags","rendering","rndr","argDefault","linkedCtxParam","fromIndex","toIndex","_dfAt","noVws","HTML","_cp","cvt","src","unmap","tgt","rWrappedInViewMarker","links","renderWithViews","$converters","html","View","contentTmpl","parentView_","self_","self","isArray","id","viewId","scp","indexStr","push","splice","compileChildResources","storeName","storeNames","resources","jsvStores","compileTag","Tag","baseTag","compiledDef","depends","$tags","_parentTmpl","compileTmpl","options","lookupTemplate","currentName","nodeType","elem","document","getElementById","innerHTML","getAttribute","tmplAttr","jsvTmpl","tmplName","setAttribute","compiledTmpl","tmplOrMarkup","_html","markup","tmplObject","tmplFn","replace","rEscapeQuotes","getDefaultVal","defaultVal","call","unmapArray","modelArr","arr","compileViewModel","GetNew","vm","iterate","action","getterType","j","g","getters","getter","viewModels","JSON","parse","merge","viewModel","$expando","getterNames","mod","assigned","newModArr","k","model","$observable","refresh","concat","charAt","extend","proto","body","privField","set","Function","htmlTag","wrapMap","$subSettingsAdvanced","_wm","rFirstElem","exec","toLowerCase","div","trim","registerStore","storeSettings","theStore","item","compile","thisStore","onStore","OBJECT","getTgt","addSetting","st","Map","baseMap","noIteration","isTopRenderCall","prevData","prevIndex","result","useViews","setItemVar","newCtx","itemVar","newView","childView","itemResult","swapContent","outerOnRender","noLinking","_wrp","syntaxError","nl","helpers","contentView","onRenderError","fallback","Err","isLinkExpr","convertBack","hasElse","pushprecedingContent","shift","loc","substr","rNewLine","blockTagCheck","block","parseTag","all","bind","colon","codeTag","slash","bind2","closeBlock","late","openTagName","isLateOb","pathBindings","ctxProps","paramsArgs","paramsProps","paramsCtxProps","useTrigger","allowCode","rUnescapeQuotes","rTestElseIf","current","substring","stack","pop","parseParams","rBuildHash","onerror","isCtxPrm","keyToken","keyValue","arg","param","hasHandlers","newNode","parsedParam","bindings","astTop","buildCode","setPaths","pathsArr","paths","skp","paramStructure","parts","parseTokens","lftPrn0","lftPrn","operator","err","eq","path2","prn","comma","lftPrn2","apos","quot","rtPrn","rtPrnDot","prn2","space","full","parsePath","allPath","not","object","helper","viewProperty","pathTokens","leafToken","subPath","binds","named","bindto","_jsvto","bndCtx","bd","theOb","_cpfn","sb","pathStart","parenDepth","join","expr","exprFn","newOb","rtSq","aposed","quoted","bndStack","prm","tmplLinks","indexOf","paramIndex","boundName","rPath","fnCall","0","rBracketQuote","rPrm","ast","node","hasTag","hasEncoder","getsVal","hasCnvt","useCnvt","tmplBindings","boundOnErrStart","boundOnErrEnd","tagRender","nestedTmpls","nestedTmpl","tagAndElses","nextIsElse","oldCode","isElse","isGetVal","tagCtxFn","tagStart","trigger","retStrOpen","retStrClose","tmplBindingKey","templates","converters","code","tmplOptions","debug","debugMode","_tag","parentContext","getTargetProps","propsArr","noFunctions","isFunction","getTargetSorted","mapped","start","end","propParams","filter","sort","directSort","step","reverse","v","a","b","onFilter","sorted","paged","$fnRender","tmplElem","jquery","getCharEntity","ch","charEntities","charCodeAt","getCharFromEntity","match","token","charsFromEntities","htmlEncode","text","rIsHtml","rHtmlEncode","dataEncode","rDataEncode","dataUnencode","rDataUnencode","setGlobals","jsvStoreName","setting","versionNumber","rAttrEncode","&","<",">","\u0000","'","\"","`","=","amp","gt","$render","jsr","jsrender","jsrToJq","jsviews","sub","syntaxErr","settings","advSet","_thp","_gm","_cnvt","_err","_sq","advanced","Error","_getOb","expando","renderFile","__express","Array","obj","_jq","jq","_jsv","if","done","selected","for","sortDataMap","cloned","range","include","*",":*","dbg","encode","unencode","url","encode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KAAKmD,KAEhC6c,EAKH,IAJAA,EAAQ9iB,EAAMse,QAAU,UAAY,OACpCN,GAAOhe,EAAMge,IACbK,GAAQre,EAAMqe,MAAQ,EACtBna,KACKvB,GAAK3C,EAAM+d,OAAS,GAAIC,EAAMrb,GAAK0b,EAAO,EAAG1b,GAAK0b,EACtDna,EAAM4e,GAAOngB,EAGDF,UAAVyB,IACH8I,EAAUzL,GAAS2C,GACnBuP,GAAU3T,EAAO6K,OAAOzG,GAAQgM,GAAWlQ,EAAMqT,aAGjDoP,GAAQzV,EAAU9I,EAAMf,OAAS,IAE9B4J,EAAKvB,UAAUiX,KAAOA,KACzB1V,EAAK2V,SAAW5iB,EAAOwD,OAIzB,MAAOmQ,IAERhM,MAAM,GAEPzH,OACC8N,QAAS,MACT1C,QAASA,EAAQqS,GACjB1S,KAAMnL,EACN6H,MAAM,GAEPsb,SACCtb,MAAM,GAEPub,KAECrY,OAAQrK,EACRmH,MAAM,GAEPwb,MAECtY,OAAQrK,EACRmH,MAAM,GAEPyb,IAAKle,GAASke,IAAMzW,GAAYyW,IAAM1iB,IAGvCiM,IACCC,KAAM8S,EACNnW,KAAMmW,EACN2D,OAAQvD,EACRwD,SAAUtD,GACVuD,IAAK,SAAS5D,GAEb,MAAehd,SAARgd,EAAoB6D,UAAU,GAAK7D,GAAiB,OAATA,EAAgBA,EAAO,MAY5E,MAPA1d,IAAeG,GAAKof,SACpB/f,IAAY/C,GAAGwiB,IAAKhU,QACpB3K,GAAeL,WAAW,KAAM,KAAM,KAElCkf,IACHF,GAAIte,MAAM0e,IAAIiB,IAAI7jB,GAEZA,GAAKwiB,IACTuC","file":"jsrender.min.js","sourcesContent":["/*! JsRender v1.0.2: http://jsviews.com/#jsrender */\n/*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */\n/*\n * Best-of-breed templating in browser or on Node.js.\n * Does not require jQuery, or HTML DOM\n * Integrates with JsViews (http://jsviews.com/#jsviews)\n *\n * Copyright 2019, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take optional jQuery passed as parameter: require('jsrender')(jQuery)\n\t\t\t\tif ($ && !$.fn) {\n\t\t\t\t\tthrow \"Provide jQuery or null\";\n\t\t\t\t}\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine(function() {\n\t\t\treturn factory(global);\n\t\t});\n\t} else { // Browser using plain ',Kn='',Jn='',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousSibling;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastChild;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild,\n\t\t\t\t\t\t// since we have removed white space within elCnt. Hence support IE < 9\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\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\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = tmpl.links[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\ttmpl.links[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup\n\tfunction handler(ev, eventArgs) {\n\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t}\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\tif (linkCtx.elem.nodeName === \"SELECT\" && linkCtxType === \"link\" && !linkCtx.attr) {\n\t\tvar $elem = $(linkCtx.elem);\n\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\tvar source = linkCtx.fn(view.data, view, $sub);\n\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t}\n\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\tval = props[l];\n\t\t\t\ttag.setValue(val, l, m);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"), source)) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$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._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\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\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete cbBindingsStore[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments);\n\n\tif (oldJsvDelimiters !== $viewsDelimiters) {\n\t\t// If JsRender was loaded before JsViews, then need also to initialize and set globals in that JsRender instance\n\t\tret = $viewsDelimiters.apply(0, arguments);\n\t}\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tvalues[index||0] = val;\n\tif (async) {\n\t\tsetTimeout(function() {\n\t\t\tupdateValues(values, tagElse, bindId, ev);\n\t\t});\n\t} else {\n\t\tupdateValues(values, tagElse, bindId, ev);\n\t}\n\treturn self;\n}\n\nfunction setValues() {\n// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = arguments.length;\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\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\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, linkedCtxPrmKey, indexTo, linkedElems,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse],\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse);\n\n\t\t\t\tif (newVal !== undefined) { // Call tag method tag.setValue(), if implemented\n\t\t\t\t\tval = newVal;\n\t\t\t\t}\n\t\t\t\tif (val !== undefined && (theTag.convert || theTag._.toIndex[indexFrom] === undefined)\n\t\t\t\t\t\t&& (linkedCtxParam = theTag.linkedCtxParam)\n\t\t\t\t\t\t&& linkedCtxParam[indexFrom]\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\t\t&& (linkedCtxPrmKey = linkedCtxParam[indexFrom])\n\t\t\t\t\t) {\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxPrmKey, val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else if ($isArray(val)) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl.value = val; // Don't use jQuery since it replaces array by mapped clone\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\treturn updateValues(arguments, undefined, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) {\n\t\t\t\t\tif (!view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, isMove) {\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, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar prv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\tbindingStore[id].linkCtx.tag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\nreturn $;\n}, window));\n"]} \ No newline at end of file +{"version":3,"sources":["jsviews.js"],"names":["factory","global","$","jQuery","exports","module","define","amd","getDerivedMethod","baseMethod","method","ret","tag","this","prevBase","base","apply","arguments","getMethod","$isFunction","_d","noop","tagHandlersFromProps","tagCtx","prop","props","rHasHandlers","test","fix","constructor","prototype","retVal","val","dbgBreak","console","log","e","baseApply","JsViewsError","message","name","link","$extend","target","source","$viewsDelimiters","openChars","closeChars","$isArray","$views","linkChar","error","delimOpenChar0","delimOpenChar1","delimCloseChar0","delimCloseChar1","$subSettings","delimiters","rTag","$sub","RegExp","rTmpl","$viewsSettings","getView","inner","type","undefined","views","i","l","found","view","root","_","useKey","get","length","parent","getNestedIndex","index","getIndex","getPathObject","ob","path","ltOb","fn","prevOb","tokens","split","lt","contextParameter","key","value","wrapped","deps","res","obsCtxPrm","tagElse","callView","newRes","storeView","isUpdate","isRenderCall","store","ctx","hasOwnProperty","$helpers","it","linked","_cxp","scope","isTop","_ocps","_ocp","_vw","_key","ind","updateValue","observable","setProperty","_ceo","unshift","cvtArgs","data","_ucp","getTemplate","tmpl","getRsc","$templates","convertVal","converter","onError","linkCtx","argsLen","bindTo","boundTag","bnds","_lr","args","_bd","_lc","_tg","bnd","unlinked","inline","tagName","convert","onArrayChange","flow","tagCtxs","_is","extendCtx","_er","onRender","convertArgs","bound","boundArgs","bindFrom","slice","argOrProp","context","convertBoundArgs","getResource","resourceType","itemName","renderTag","parentView","bindToOrBindFrom","bindArray","m","isNaN","parseInt","topView","tagDef","template","tags","attr","parentTag","n","itemRet","tagCtxCtx","ctxPrm","initVal","content","callInit","mapDef","thisMap","bdArgs","tagDataMap","contentCtx","bindFromLength","bindToLength","linkedElement","defaultCtx","parentTmpl","lateRender","params","tmpls","render","renderContent","bndArgs","_getTmpl","init","_ctr","ths","arrVws","dataBoundOnly","dataMap","map","parents","parentTags","rendering","rndr","argDefault","linkedCtxParam","fromIndex","toIndex","_dfAt","noVws","HTML","_cp","cvt","src","unmap","tgt","rWrappedInViewMarker","links","renderWithViews","$converters","html","View","contentTmpl","parentView_","self_","self","isArray","id","viewId","scp","indexStr","push","splice","compileChildResources","storeName","storeNames","resources","jsvStores","compileTag","Tag","baseTag","compiledDef","depends","$tags","_parentTmpl","compileTmpl","options","lookupTemplate","currentName","nodeType","elem","document","getElementById","innerHTML","getAttribute","tmplAttr","jsvTmpl","tmplName","setAttribute","compiledTmpl","tmplOrMarkup","_html","markup","tmplObject","tmplFn","replace","rEscapeQuotes","getDefaultVal","defaultVal","call","addParentRef","ref","Object","defineProperty","configurable","compileViewModel","JsvVm","vm","iterate","action","getterType","parentRef","j","getterCount","getters","getter","viewModels","JSON","parse","childOb","arr","merge","viewModel","$expando","getterNames","mod","assigned","newModArr","k","model","$observable","refresh","concat","unmapArray","modelArr","charAt","extend","proto","cnstr","privField","set","Function","htmlTag","wrapMap","$subSettingsAdvanced","_wm","rFirstElem","exec","toLowerCase","div","trim","registerStore","storeSettings","theStore","item","compile","thisStore","onStore","OBJECT","getTgt","addSetting","st","Map","baseMap","noIteration","isTopRenderCall","prevData","prevIndex","result","useViews","setItemVar","newCtx","itemVar","newView","childView","itemResult","swapContent","outerOnRender","noLinking","_wrp","syntaxError","nl","helpers","contentView","onRenderError","fallback","Err","isLinkExpr","convertBack","hasElse","pushprecedingContent","shift","loc","substr","rNewLine","blockTagCheck","block","parseTag","all","bind","colon","codeTag","slash","bind2","closeBlock","late","openTagName","isLateOb","pathBindings","ctxProps","paramsArgs","paramsProps","paramsCtxProps","useTrigger","allowCode","rUnescapeQuotes","rTestElseIf","current","substring","stack","pop","parseParams","rBuildHash","onerror","isCtxPrm","keyToken","keyValue","arg","param","hasHandlers","newNode","parsedParam","bindings","astTop","buildCode","setPaths","pathsArr","paths","skp","paramStructure","parts","parseTokens","lftPrn0","lftPrn","operator","err","eq","path2","prn","comma","lftPrn2","apos","quot","rtPrn","rtPrnDot","prn2","space","full","parsePath","allPath","not","object","helper","viewProperty","pathTokens","leafToken","subPath","binds","named","bindto","_jsvto","bndCtx","bd","theOb","_cpfn","sb","pathStart","parenDepth","join","expr","exprFn","newOb","rtSq","aposed","quoted","bndStack","prm","tmplLinks","indexOf","paramIndex","boundName","rPath","fnCall","0","rBracketQuote","rPrm","ast","node","hasTag","hasEncoder","getsVal","hasCnvt","useCnvt","tmplBindings","boundOnErrStart","boundOnErrEnd","tagRender","nestedTmpls","nestedTmpl","tagAndElses","nextIsElse","oldCode","isElse","isGetVal","tagCtxFn","tagStart","trigger","retStrOpen","retStrClose","tmplBindingKey","templates","converters","code","tmplOptions","debug","debugMode","_tag","parentContext","getTargetProps","propsArr","noFunctions","isFunction","getTargetSorted","mapped","start","end","propParams","filter","sort","directSort","step","reverse","v","a","b","onFilter","sorted","paged","$fnRender","tmplElem","jquery","getCharEntity","ch","charEntities","charCodeAt","getCharFromEntity","match","token","charsFromEntities","htmlEncode","text","rIsHtml","rHtmlEncode","dataEncode","rDataEncode","dataUnencode","rDataUnencode","updateValues","sourceValues","async","bindId","ev","cvtBack","cnvtName","binding","sourceValue","origVals","sourceElem","sourceEl","tos","to","tcpTag","exprOb","contextCb","_tgId","defineBindToDataTargets","bindingStore","chg","nodeName","multiple","_jsvSel","onBeforeUpdateVal","change","setValue","_jsvInd","_jsvLkEl","_jsvElse","_ctxCb","_cpCtx","onElemChange","fromAttr","defaultAttr","setter","fnSetters","_jsvTr","delegateTarget","activeBody","_jsvChg","rSplitBindings","lastIndex","_jsvBnd","onDataLinkedTagChange","eventArgs","noUpdate","forceUpdate","hasError","bindEarly","linkFn","parentElem","parentNode","oldLinkCtx","onEvent","changeHandler","onBeforeChangeStr","_toLk","VALUE","CHECKBOX","CHECKED","onUpdate","mergeCtxs","NONE","callAfterLink","observeAndBind","onAfterChangeStr","onUnbind","linkedElems","linkedElem","mainElem","displayElem","_cnvt","TRUE","addLinkMethods","updateContent","_noUpd","setDefer","_df","deferAttr","prevNode","nextNode","nodesToRemove","useProp","openIndex","closeIndex","testElem","cStyle","jsvSel","renders","targetParent","$target","targetVal","_val","_elCnt","_prv","_nxt","currentStyle","getComputedStyle","display","_jsvd","displayStyles","createElement","body","appendChild","removeChild","style","RADIO","nodes","transferViewTokens","jsvAttrStr","disposeTokens","previousSibling","lastChild","remove","empty","children","TEXTCONTENT","selected","$inArray","lateLink","arrayChangeHandler","onBeforeChange","onAfterChange","items","srt","addViews","_dly","removeViews","moveViews","oldIndex","fixIndex","setArrayChangeLink","handler","arrayBinding","bndArr","off","arrayChangeStr","on","linkGetVal","_fe","contentEditable","from","renderAndLink","linkToNode","prevView","elCnt","removeViewBinding","nextSibling","addBindingMarkers","bindingKey","viewStore","exprFnDeps","propDeps","tagDepends","allowArray","cvtBk","_hdl","_dp","_depends","bdId","_apply","boundProps","_bndId","bindLinkedElChange","lnkCtx","tmplLink","$link","tmplOrLinkExpr","useInput","elementChangeStr","vwInfos","placeholderParent","targetEl","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","badParent","processViewInfos","deferPath","deferChar","bindChar","onAftCr","deep","addedBindEls","_tkns","len","vwInfo","open","removeSubStr","onAfterCreateStr","onAfterCreate","bindEls","getViewInfos","level","tagDepth","dataLink","wrap","selector","linkViewsSel","elems","qsa","querySelectorAll","prevNodes","markerNodeInfo","contains","isLink","rViewMarkers","skip","processInfos","$viewsLinkAttr","rOpenTagMarkers","unmarkPrevOrNextNode","prevIds","linkInfo","nextView","depth","fragment","copiedNode","firstTag","wrapper","thisId","noValidate","markPrevOrNextNode","namespaceURI","rConvertMarkers","safeFragment","createDocumentFragment","firstChild","insertBefore","linkMarkup","currentView","boundTagId","tagExpr","rTagIndex","linkExpressions","bindDataLinkTarget","normalizeLinkTag","rTagDatalink","linkCtxType","_gccb","$elem","str","SCRIPT","isVal","rBinding","getInfos","close","elPath","infos","rMarkerTokens","removeAttribute","marker","twoway","copyFromTagCtxToTag","linkedElements","$linkCtxElem","linkCtxElem","linkedEl","linkedTag","tagCtxElse","oldVal","indexTo","mapDeps","tagCtxslength","mainElement","displayElement","Array","contents","onBind","mapProps","mapDepends","observe","setSize","height","width","className","_jsvCl","hasClass","removeClass","addClass","onAfterLink","asyncOnElemChange","which","setTimeout","bindTriggerEvent","trig","onoff","isIE","$linkedElem","newTrig","oldTrig","pathIndex","lastPath","bindtoOb","targetPaths","bindTos","targetPathsElses","resolveDataTargetPath","targetPath","topCp","newCtxs","newTagCtx","_thp","clean","elemArray","linkedElemTag","objId","obsId","allLinkedElems","cbId","propertyChangeStr","onDispose","cbBindingsStore","$unlink","each","innerView","getElementsByTagName","inputAttrib","viewOrTagChar","viewOrTag","precedingLength","emptyView","vwItem","rOpenMarkers","values","setValues","tagOrView","theTag","theView","select","filtered","add","find","withMarkers","prevIsFirstNode","lastSibling","childTags","_gm","indexFrom","linkedCtxPrmKey","newVal","extra","domChange","hasListener","_data","events","domChangeNotification","triggerHandler","dataItems","delayed","viewsCount","itemsCount","keepNodes","removeView","viewToRemove","itemView","setPrv","prv","rTagMarkers","selfNxt","backwards","firstChange","lastChange","movedNodes","viewsToMove","appendTo","afterParts","endChange","startView","endView","afterView","startParts","endParts","observeProps","updatePropsArr","update","insert","observeMappedProps","removeProperty","oldValue","shallowArrayFilter","rShallowArrayPath","setGlobals","jsvStoreName","$observe","setting","versionNumber","rAttrEncode","&","<",">","\u0000","'","\"","`","=","amp","gt","$render","jsr","jsrender","jsrToJq","jsviews","sub","syntaxErr","settings","advSet","_err","_sq","advanced","Error","_getOb","expando","renderFile","__express","obj","_jq","jq","_jsv","if","done","for","sortDataMap","cloned","setDataMap","range","include","*",":*","dbg","encode","unencode","url","encodeURI","$eventSpecial","event","special","PARSEINT","rNotWhite","rShallowPath","propChng","arrChng","observeStr","observeObjKey","observeCbKey","observeInnerCbKey","$data","asyncBatch","getCbKey","cb","_cId","ObjectObservable","ns","_ns","ArrayObservable","wrapArray","dependsPaths","callback","rt","nextObj","out","_ar","removeCbBindings","cbBindings","cbBindingsId","onDataChange","isOb","noArray","parentObs","observeAll","_arOk","array","_path","observe_apply","$observeAll","unobserve","$unobserveAll","namespace","objMap","observeArrayItems","unobs","newAllPath","filterAndObserveAll","nestedArray","newObject","newParentObs","_fltr","nextParentObs","updatedTgt","wrappedCb","isObject","obId","notRemoving","un","hasData","shallowFilter","$unobserve","batchTrigger","batch","_go","_trigger","innerObserve","unobserveBinding","observeOnOff","fullPath","pathStr","isArrayBinding","evData","dataOb","boundObOrArr","prntObs","allPth","initialNs","el","inArray","unbind","relPath","prevAllPath","observeObjects","observeObjectPaths","pths","getInnerCb","newObj","observePath","prts","obArrAddRemove","arrIndex","dep","obArr","prt","fnProp","isGet","_inId","pth","innerCb","p","inId","initNsArr","initNsArrLen","lastArg","wait","delay","asyncObserve","_batch","unobserveAll","nonStrict","pair","tempBatch","multi","_setProperty","leaf","removeProp","property","Date","force","previous","_insert","oldLength","numToRemove","_remove","move","newIndex","numToMove","_move","excess","newItems","insertAdded","addedItems","dataLength","newItem","num","oldItems","newLength","_srt","handleObj","oldMapOrTarget","unbound","changing","updatedMap","obsSrc","obs","srcFlt","obsTgt","obt","_updt","tgtFlt","oldMap","newMap","obmp","_def","_gck","_obs","oldAdvSet","window","navigator","userAgent","textContent","bindElsSel","input","valueBinding","isCleanCall","oldCleanData","oldJsvDelimiters","querySelector","ol","ul","table","tbody","thead","tfoot","tr","colgroup","dl","optgroup","svg","svg_ns","br","img","hr","area","col","meta","command","embed","keygen","track","wbr","rViewPath","requiresStr","regularExpression","currentValue","toggle","_hi","activeElem","contextOb","_sel","_evs","_hlr","radiogroup","Math","random","domChngCntnr","useDisable","disabled","forOrIfTagCtx","checked","arrayView","targetLength","arrayBindings","_ars","tagCt","newTagCtxs","prevArg","different","tci","getInnerView","nd","isVl","unlink","oldFn","_glt","regEx","linkCtxs","last","nextPath","addedTagCpDep","paramVal","paramExpr","tagCtxPrm","cloneExprObjects","clones","linkAttr","option","caption","th","td","legend","support","htmlSerialize","textarea"],"mappings":";;CAcC,SAASA,EAASC,GAElB,GAAIC,GAAID,EAAOE,MAEQ,iBAAZC,SACVC,OAAOD,QAAUF,EACdF,EAAQC,EAAQC,GAChB,SAASA,GACV,MAAOF,GAAQC,EAAQC,IAEG,kBAAXI,SAAyBA,OAAOC,IACjDD,QAAQ,UAAW,SAASJ,GAC3B,MAAOF,GAAQC,EAAQC,KAGxBF,EAAQC,GAAQ,IAKlB,SAASA,EAAQC,GACjB,YA4IA,SAASM,GAAiBC,EAAYC,GACrC,MAAO,YACN,GAAIC,GACHC,EAAMC,KACNC,EAAWF,EAAIG,IAKhB,OAHAH,GAAIG,KAAON,EACXE,EAAMD,EAAOM,MAAMJ,EAAKK,WACxBL,EAAIG,KAAOD,EACJH,GAIT,QAASO,GAAUT,EAAYC,GAc9B,MAXIS,IAAYT,K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2B,IAAKtU,EAAE0uC,QAAQC,eAAiB,EAAG,GAAI,KAAO,EAAG,SAAU,WAE5D/jB,KACC+e,OACC7e,KAAMoN,GAAarV,GAAI6C,IAExBkpB,SAAUhF,GACV9Q,OAAQ8Q,GACRc,UACC7nB,GAAI,YAKA7iB,GACJspC","file":"jsviews.min.js","sourcesContent":["/*! jsviews.js v1.0.3 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 2019, Boris Moore\n * Released under the MIT License.\n */\n\n//jshint -W018, -W041, -W120\n\n(function(factory, global) {\n\t// global var is the this object, which is window when running in the usual browser environment\n\tvar $ = global.jQuery;\n\n\tif (typeof exports === \"object\") { // CommonJS e.g. Browserify\n\t\tmodule.exports = $\n\t\t\t? factory(global, $)\n\t\t\t: function($) { // If no global jQuery, take jQuery passed as parameter: require(\"jsviews\")(jQuery)\n\t\t\t\treturn factory(global, $);\n\t\t\t};\n\t} else if (typeof define === \"function\" && define.amd) { // AMD script loader, e.g. RequireJS\n\t\tdefine([\"jquery\"], function($) {\n\t\t\treturn factory(global, $);\n\t\t}); // Require jQuery\n\t} else { // Browser using plain ',\n\topenScript = ' - data-linked tag, close marker\n\t\t\t// We validate with inTag so no script markers are inserted in attribute context e.g. for:\n\t\t\t// \"\" or \"
...{{/if}}...\"\n\t\t\tpreceding = id\n\t\t\t\t? (preceding + endOfElCnt + spaceBefore + (inTag ? \"\" : openScript + id + closeScript)+ spaceAfter + tag)\n\t\t\t\t: endOfElCnt || all;\n\t\t}\n\n\t\tif (validate && boundId) {\n\t\t\tif (inTag) {\n\t\t\t\t// JsViews data-linking tags are not allowed within element markup.\n\t\t\t\t// See jsviews/issues/303\n\t\t\t\tsyntaxError('{^{ within elem markup (' + inTag + ' ). Use data-link=\"...\"');\n\t\t\t}\n\t\t\tif (id.charAt(0) === \"#\") {\n\t\t\t\ttagStack.unshift(id.slice(1));\n\t\t\t} else if (id.slice(1) !== (bndId = tagStack.shift())) {\n\t\t\t\t// See jsviews/issues/213\n\t\t\t\tsyntaxError('Closing tag for {^{...}} under different elem: <' + bndId + '>');\n\t\t\t}\n\t\t}\n\t\tif (tag) {\n\t\t\tinTag = tag;\n\t\t\t// If there are ids (markers since the last tag), move them to the defer string\n\t\t\ttagStack.unshift(parentTag);\n\t\t\tparentTag = tag.slice(1);\n\t\t\tif (validate && tagStack[0] && tagStack[0] === badParent[parentTag]) {\n\t\t\t\t// Missing \n\t\t\t\t// TODO: replace this by smart insertion of tags\n\t\t\t\terror('Parent of must be ');\n\t\t\t}\n\t\t\tisVoid = voidElems[parentTag];\n\t\t\tif ((elCnt = elContent[parentTag]) && !prevElCnt) {\n\t\t\t\tdeferStack.unshift(defer);\n\t\t\t\tdefer = \"\";\n\t\t\t}\n\t\t\tprevElCnt = elCnt;\n//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught,\n//this can cause errors subsequently which are difficult to debug.\n//\t\t\t\tif (elContent[tagStack[0]]>2 && !elCnt) {\n//\t\t\t\t\terror(parentTag + \" in \" + tagStack[0]);\n//\t\t\t\t}\n\t\t\tif (defer && elCnt) {\n\t\t\t\tdefer += \"+\"; // Will be used for stepping back through deferred tokens\n\t\t\t}\n\t\t}\n\t\treturn preceding;\n\t}\n\n\tfunction processViewInfos(vwInfos, targetParent) {\n\t\t// If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc.\n\t\t// (and elem may also be defined - the next node)\n\t\t// If no targetParent, then we are processing viewInfos on newly inserted content\n\t\tvar deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep,\n\t\t\taddedBindEls = [];\n\n\t\t// In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close.\n\t\t// If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the\n\t\t// 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and\n\t\t// its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode.\n\t\tif (vwInfos) {\n\t\t\tif (vwInfos._tkns.charAt(0) === \"@\") {\n\t\t\t\t// We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings,\n\t\t\t\t// and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens.\n\t\t\t\t// We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding\n\t\t\t\t// token belongs to. Set elem to null (the special script element), and remove it from the DOM.\n\t\t\t\ttargetParent = elem.previousSibling;\n\t\t\t\telem.parentNode.removeChild(elem);\n\t\t\t\telem = undefined;\n\t\t\t}\n\t\t\tlen = vwInfos.length;\n\t\t\twhile (len--) {\n\t\t\t\tvwInfo = vwInfos[len];\n//if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding\n\t\t\t\tbindChar = vwInfo.ch;\n\t\t\t\tif (deferPath = vwInfo.path) {\n\t\t\t\t\t// We have a 'deferred path'\n\t\t\t\t\tj = deferPath.length - 1;\n\t\t\t\t\twhile (deferChar = deferPath.charAt(j--)) {\n\t\t\t\t\t\t// Use the \"+\" and\"-\" characters to navigate the path back to the original parent node where the deferred bindings ocurred\n\t\t\t\t\t\tif (deferChar === \"+\") {\n\t\t\t\t\t\t\tif (deferPath.charAt(j) === \"-\") {\n\t\t\t\t\t\t\t\tj--;\n\t\t\t\t\t\t\t\ttargetParent = targetParent.previousSibling;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttargetParent = targetParent.parentNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttargetParent = targetParent.lastChild;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild,\n\t\t\t\t\t\t// since we have removed white space within elCnt. Hence support IE < 9\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (bindChar === \"^\") {\n\t\t\t\t\tif (tag = bindingStore[id = vwInfo.id]) {\n\t\t\t\t\t\t// The binding may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\t\t// This is a tag binding\n\t\t\t\t\t\tdeep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent,\n\t\t\t\t\t\t// or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent.\n\t\t\t\t\t\tif (!elem || deep) {\n\t\t\t\t\t\t\ttag.parentElem = targetParent;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (vwInfo.elCnt && deep) {\n\t\t\t\t\t\t\t// With element only content, if there is no following element, or if the binding is deeper than the following element\n\t\t\t\t\t\t\t// then we need to set the open or close token as a deferred binding annotation on the parent\n\t\t\t\t\t\t\tsetDefer(targetParent, (vwInfo.open ? \"#\" : \"/\") + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls.\n\t\t\t\t\t\taddedBindEls.push([deep ? null : elem, vwInfo]);\n\t\t\t\t\t}\n\t\t\t\t} else if (view = viewStore[id = vwInfo.id]) {\n\t\t\t\t\t// The view may have been deleted, for example in a different handler to an array collectionChange event\n\t\t\t\t\tif (!view.parentElem) {\n\t\t\t\t\t\t// If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view\n\t\t\t\t\t\tview.parentElem = targetParent || elem && elem.parentNode || parentNode;\n\t\t\t\t\t\tview._.onRender = addBindingMarkers;\n\t\t\t\t\t\tview._.onArrayChange = arrayChangeHandler;\n\t\t\t\t\t\tsetArrayChangeLink(view);\n\t\t\t\t\t}\n\t\t\t\t\tparentElem = view.parentElem;\n\t\t\t\t\tif (vwInfo.open) {\n\t\t\t\t\t\t// This is an 'open view' node (preceding script marker node,\n\t\t\t\t\t\t// or if elCnt, the first element in the view, with a data-jsv annotation) for binding\n\t\t\t\t\t\tview._elCnt = vwInfo.elCnt;\n\t\t\t\t\t\tif (targetParent && !elem) {\n\t\t\t\t\t\t\tsetDefer(targetParent, \"#\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem)\n\t\t\t\t\t\t\tif (!view._prv) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This is a 'close view' marker node for binding\n\t\t\t\t\t\tif (targetParent && (!elem || elem.parentNode !== targetParent)) {\n\t\t\t\t\t\t\t// There is no ._nxt so add token to _df. It is deferred.\n\t\t\t\t\t\t\tsetDefer(targetParent, \"/\" + id + bindChar + (targetParent._df || \"\"));\n\t\t\t\t\t\t\tview._nxt = undefined;\n\t\t\t\t\t\t} else if (elem) {\n\t\t\t\t\t\t\t// This view did not have a ._nxt, but has one now, so token may be in _df, and must be removed. (No longer deferred)\n\t\t\t\t\t\t\tif (!view._nxt) {\n\t\t\t\t\t\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + bindChar));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tview._nxt = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (onAftCr = changeHandler(view, onAfterCreateStr) || onAfterCreate) {\n\t\t\t\t\t\t\tonAftCr.call(view.ctx.tag, view);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlen = addedBindEls.length;\n\t\t\twhile (len--) {\n\t\t\t\t// These were added in reverse order to addedBindEls. We push them in BindEls in the correct order.\n\t\t\t\tbindEls.push(addedBindEls[len]);\n\t\t\t}\n\t\t}\n\t\treturn !vwInfos || vwInfos.elCnt;\n\t}\n\n\tfunction getViewInfos(vwInfos) {\n\t\t// Used by view.childTags() and tag.childTags()\n\t\t// Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags.\n\t\tvar level, parentTag, named;\n\n\t\tif (vwInfos) {\n\t\t\tlen = vwInfos.length;\n\t\t\tfor (j = 0; j < len; j++) {\n\t\t\t\tvwInfo = vwInfos[j];\n\t\t\t\t// This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls.\n\t\t\t\t// Note - if bindingStore[vwInfo.id]._is === \"tag\" then getViewInfos is being called too soon - during first linking pass\n\t\t\t\ttag = bindingStore[vwInfo.id];\n\t\t\t\tif (!tag._is && tag.linkCtx) {\n\t\t\t\t\tparentTag = tag = tag.linkCtx.tag;\n\t\t\t\t\tnamed = tag.tagName === tagName;\n\t\t\t\t\tif (!tag.flow || named) {\n\t\t\t\t\t\tif (!deep) {\n\t\t\t\t\t\t\tlevel = 1;\n\t\t\t\t\t\t\twhile (parentTag = parentTag.parent) {\n\t\t\t\t\t\t\t\tlevel++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttagDepth = tagDepth || level; // The level of the first tag encountered.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((deep || level === tagDepth) && (!tagName || named)) {\n\t\t\t\t\t\t\t// Filter on top-level or tagName as appropriate\n\t\t\t\t\t\t\ttags.push(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dataLink() {\n\t\t//================ Data-link and fixup of data-jsv annotations ================\n\t\tvar j, index,\n\t\t\ttokens = \"\",\n\t\t\twrap = {},\n\t\t\tselector = linkViewsSel + (get ? \",[\" + deferAttr + \"]\" : \"\");\n\t\t\t// If a childTags() call, get = \",[\" + deferAttr + \"]\" - since we need to include elements that have a ._df expando for deferred tokens\n\n\t\telems = qsa ? parentNode.querySelectorAll(selector) : $(selector, parentNode).get();\n\t\tl = elems.length;\n\n\t\t// The prevNode will be in the returned query, since we called markPrevOrNextNode() on it.\n\t\t// But it may have contained nodes that satisfy the selector also.\n\t\tif (prevNode && prevNode.innerHTML) {\n\t\t\t// Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query\n\t\t\tprevNodes = qsa ? prevNode.querySelectorAll(selector) : $(selector, prevNode).get();\n\t\t\tprevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode;\n\t\t}\n\n\t\ttagDepth = 0;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = elems[i];\n\t\t\tif (prevNode && !found) {\n\t\t\t\t// If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link.\n\t\t\t\tfound = (elem === prevNode);\n\t\t\t} else if (nextNode && elem === nextNode) {\n\t\t\t\t// If nextNode is set then break when we get to nextNode\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (elem.parentNode) {\n\t\t\t\t// elem has not been removed from DOM\n\t\t\t\tif (get) {\n\t\t\t\t\ttokens += markerNodeInfo(elem);\n\t\t\t\t\tif (elem._df) {\n\t\t\t\t\t\tj = i + 1;\n\t\t\t\t\t\twhile (j < l && elem.contains(elems[j])) {\n\t\t\t\t\t\t\tj++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Add deferred tokens after any tokens on descendant elements of this one\n\t\t\t\t\t\twrap[j-1] = elem._df;\n\t\t\t\t\t}\n\t\t\t\t\tif (wrap[i]) {\n\t\t\t\t\t\ttokens += wrap[i] || \"\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (isLink && (vwInfo = viewInfos(elem, undefined, rViewMarkers)) && (vwInfo = vwInfo[0])) {\n\t\t\t\t\t\t// If this is a link(trueOrString ...) call we will avoid re-binding to elems that are within template-rendered views\n\t\t\t\t\t\tskip = skip ? (vwInfo.id !== skip && skip) : vwInfo.open && vwInfo.id;\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip && processInfos(viewInfos(elem))\n\t\t\t\t\t\t// If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings\n\t\t\t\t\t\t// If a childTags() call, getViewInfos returns array of tag bindings.\n\t\t\t\t\t\t\t&& elem.getAttribute($viewsLinkAttr)) {\n\t\t\t\t\t\tbindEls.push([elem]); // A data-linked element so add to bindEls too\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (get) {\n\t\t\ttokens += parentNode._df || \"\";\n\t\t\tif (index = tokens.indexOf(\"#\" + get.id) + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so start after the open token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(index + get.id.length);\n\t\t\t}\n\t\t\tindex = tokens.indexOf(\"/\" + get.id);\n\t\t\tif (index + 1) {\n\t\t\t\t// We are looking for view.childTags() or tag.childTags() - so don't look beyond the close token of the parent view or tag.\n\t\t\t\ttokens = tokens.slice(0, index);\n\t\t\t}\n\t\t\t// Call getViewInfos to add the found childTags to the tags array\n\t\t\tgetViewInfos(viewInfos(tokens, undefined, rOpenTagMarkers));\n\t\t}\n\n\t\tif (html === undefined && parentNode.getAttribute($viewsLinkAttr)) {\n\t\t\tbindEls.push([parentNode]); // Support data-linking top-level element directly (not within a data-linked container)\n\t\t}\n\n\t\t// Remove temporary marker script nodes they were added by markPrevOrNextNode\n\t\tunmarkPrevOrNextNode(prevNode, elCnt);\n\t\tunmarkPrevOrNextNode(nextNode, elCnt);\n\n\t\tif (get) {\n\t\t\treturn; // We have added childTags to the tags array, so we are done\n\t\t}\n\n\t\tif (elCnt && defer + ids) {\n\t\t\t// There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet\n\t\t\telem = nextNode;\n\t\t\tif (defer) {\n\t\t\t\tif (nextNode) {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer + \"+\", true), nextNode);\n\t\t\t\t} else {\n\t\t\t\t\tprocessViewInfos(viewInfos(defer, true), parentNode);\n\t\t\t\t}\n\t\t\t}\n\t\t\tprocessViewInfos(viewInfos(ids, true), parentNode);\n\t\t\t// If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode\n\t\t\tif (nextNode) {\n\t\t\t\ttokens = nextNode.getAttribute(jsvAttrStr);\n\t\t\t\tif (l = tokens.indexOf(prevIds) + 1) {\n\t\t\t\t\ttokens = tokens.slice(l + prevIds.length - 1);\n\t\t\t\t}\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, ids + tokens);\n\t\t\t}\n\t\t}\n\n// if (context.lazyLink) {\n// setTimeout(doLinking) (doLinking is function wrapper of following lines)\n// See Future tasks, and https://github.com/BorisMoore/jsviews/issues/368.\n// Could call context.lazyLink as callback, on async completion - or return promise.\n\t\t//================ Bind the data-linked elements and tags ================\n\t\tl = bindEls.length;\n\t\tfor (i = 0; i < l; i++) {\n\t\t\telem = bindEls[i];\n\t\t\tlinkInfo = elem[1];\n\t\t\telem = elem[0];\n\t\t\tif (linkInfo) {\n\t\t\t\tif (tag = bindingStore[linkInfo.id]) {\n\t\t\t\t\tif (linkCtx = tag.linkCtx) {\n\t\t\t\t\t\t// The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding\n\t\t\t\t\t\ttag = linkCtx.tag;\n\t\t\t\t\t\ttag.linkCtx = linkCtx;\n\t\t\t\t\t}\n\t\t\t\t\tif (linkInfo.open) {\n\t\t\t\t\t\t// This is an 'open linked tag' binding annotation for a data-linked tag {^{...}}\n\t\t\t\t\t\tif (elem) {\n\t\t\t\t\t\t\ttag.parentElem = elem.parentNode;\n\t\t\t\t\t\t\ttag._prv = elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttag._elCnt = linkInfo.elCnt;\n\t\t\t\t\t\t// We data-link depth-first (\"on the way in\"), which is better for perf - and allows setting parent tags etc.\n\t\t\t\t\t\tview = tag.tagCtx.view;\n\n\t\t\t\t\t\t// Add data binding (unless skipped due to lateRender)\n\t\t\t\t\t\taddDataBinding(late, undefined, tag._prv, view, linkInfo.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttag._nxt = elem;\n\t\t\t\t\t\tif (tag._.unlinked && !tag._toLk) {\n\t\t\t\t\t\t\t// This is a 'close linked tag' binding annotation (and data-binding was not skipped due to lateRender)\n\t\t\t\t\t\t\ttagCtx = tag.tagCtx;\n\t\t\t\t\t\t\tview = tagCtx.view;\n\t\t\t\t\t\t\tcallAfterLink(tag);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Add data binding for a data-linked element (with data-link attribute)\n\t\t\t\taddDataBinding(late, elem.getAttribute($viewsLinkAttr), elem, $view(elem), undefined, isLink, outerData, context);\n\t\t\t}\n\t\t}\n//});\n\t}\n\t//==== /end of nested functions ====\n\n\tvar inTag, linkCtx, tag, i, l, j, len, elems, elem, view, vwInfo, linkInfo, prevNodes, token, prevView, nextView,\n\t\tnode, tags, deep, tagName, tagCtx, validate, tagDepth, depth, fragment, copiedNode, firstTag, parentTag,\n\t\tisVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, skip, isLink, get,\n\t\tself = this,\n\t\tthisId = self._.id + \"_\",\n\t\tdefer = \"\",\n\t\t// The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag\n\t\tbindEls = [],\n\t\ttagStack = [],\n\t\tdeferStack = [],\n\t\tlate = [],\n\t\tonAfterCreate = changeHandler(self, onAfterCreateStr),\n\t\tprocessInfos = processViewInfos;\n\n\tif (refresh) {\n\t\tif (refresh.tmpl) {\n\t\t\t// refresh is the prevView, passed in from addViews()\n\t\t\tprevView = \"/\" + refresh._.id + \"_\";\n\t\t} else {\n\t\t\tisLink = refresh.lnk; // Top-level linking\n\t\t\tif (refresh.tag) {\n\t\t\t\tthisId = refresh.tag + \"^\";\n\t\t\t\trefresh = true;\n\t\t\t}\n\t\t\tif (get = refresh.get) {\n\t\t\t\tprocessInfos = getViewInfos;\n\t\t\t\ttags = get.tags;\n\t\t\t\tdeep = get.deep;\n\t\t\t\ttagName = get.name;\n\t\t\t}\n\t\t}\n\t\trefresh = refresh === true;\n\t}\n\n\tparentNode = parentNode\n\t\t? (\"\" + parentNode === parentNode\n\t\t\t? $(parentNode)[0] // It is a string, so treat as selector\n\t\t\t: parentNode.jquery\n\t\t\t\t? parentNode[0] // A jQuery object - take first element.\n\t\t\t\t: parentNode)\n\t\t: (self.parentElem // view.link()\n\t\t\t|| document.body); // link(null, data) to link the whole document\n\n\tvalidate = !$subSettingsAdvanced.noValidate && parentNode.contentEditable !== TRUE;\n\tparentTag = parentNode.tagName.toLowerCase();\n\telCnt = !!elContent[parentTag];\n\n\tprevNode = prevNode && markPrevOrNextNode(prevNode, elCnt);\n\tnextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null;\n\n\tif (html != undefined) {\n\t\t//================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================\n\t\t// Also convert markers to DOM annotations, based on content model.\n\t\t// Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html);\n\t\t// but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select.\n\t\t// This version should also be slightly faster\n\t\tdiv = document.createElement(\"div\");\n\t\twrapper = div;\n\t\tprevIds = ids = \"\";\n\t\thtmlTag = parentNode.namespaceURI === \"http://www.w3.org/2000/svg\" ? \"svg_ns\" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || \"\";\n\t\tif (elCnt) {\n\t\t\t// Now look for following view, and find its tokens, or if not found, get the parentNode._df tokens\n\t\t\tnode = nextNode;\n\t\t\twhile (node && !(nextView = viewInfos(node))) {\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t\tif (tokens = nextView ? nextView._tkns : parentNode._df) {\n\t\t\t\ttoken = prevView || \"\";\n\t\t\t\tif (refresh || !prevView) {\n\t\t\t\t\ttoken += \"#\" + thisId;\n\t\t\t\t}\n\t\t\t\tj = tokens.indexOf(token);\n\t\t\t\tif (j + 1) {\n\t\t\t\t\tj += token.length;\n\t\t\t\t\t// Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers\n\t\t\t\t\tprevIds = ids = tokens.slice(0, j);\n\t\t\t\t\ttokens = tokens.slice(j);\n\t\t\t\t\tif (nextView) {\n\t\t\t\t\t\tnode.setAttribute(jsvAttrStr, tokens);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetDefer(parentNode, tokens);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//================ Convert the markers to DOM annotations, based on content model. ================\n//\t\t\toldElCnt = elCnt;\n\t\tisVoid = undefined;\n\t\thtml = (\"\" + html).replace(rConvertMarkers, convertMarkers);\n//\t\t\tif (!!oldElCnt !== !!elCnt) {\n//\t\t\t\terror(\"Parse: \" + html); // Parse error. Content not well-formed?\n//\t\t\t}\n\t\tif (validate && tagStack.length) {\n\t\t\tsyntaxError(\"Mismatched '<\" + parentTag + \"...>' in:\\n\" + html); // Unmatched tag\n\t\t}\n\t\tif (validateOnly) {\n\t\t\treturn;\n\t\t}\n\t\t// Append wrapper element to doc fragment\n\t\tsafeFragment.appendChild(div);\n\n\t\t// Go to html and back, then peel off extra wrappers\n\t\t// Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html);\n\t\t// but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster)\n\t\thtmlTag = wrapMap[htmlTag] || wrapMap.div;\n\t\tdepth = htmlTag[0];\n\t\twrapper.innerHTML = htmlTag[1] + html + htmlTag[2];\n\t\twhile (depth--) {\n\t\t\twrapper = wrapper.lastChild;\n\t\t}\n\t\tsafeFragment.removeChild(div);\n\t\tfragment = document.createDocumentFragment();\n\t\twhile (copiedNode = wrapper.firstChild) {\n\t\t\tfragment.appendChild(copiedNode);\n\t\t}\n\t\t// Insert into the DOM\n\t\tparentNode.insertBefore(fragment, nextNode);\n\t}\n\tdataLink();\n\n\treturn late;\n}\n\nfunction addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, data, context) {\n\t// Add data binding for data-linked elements or {^{...}} data-linked tags\n\tvar tmpl, tokens, attr, convertBack, tagExpr, linkFn, linkCtx, tag, rTagIndex, hasElse, lastIndex,\n\t\tlinkExpressions = [];\n\n\tif (boundTagId) {\n\t\t// boundTagId is a string for {^{...}} data-linked tag. So only one linkTag in linkMarkup\n\t\t// data and context arguments are undefined\n\t\ttag = bindingStore[boundTagId];\n\t\ttag = tag.linkCtx ? tag.linkCtx.tag : tag;\n\n\t\tlinkCtx = tag.linkCtx || {\n\t\t\ttype: \"inline\",\n\t\t\tdata: currentView.data, // source\n\t\t\telem: tag._elCnt ? tag.parentElem : node, // target\n\t\t\tview: currentView,\n\t\t\tctx: currentView.ctx,\n\t\t\tattr: HTML, // Script marker nodes are associated with {^{ and always target HTML.\n\t\t\tfn: tag._.bnd,\n\t\t\ttag: tag,\n\t\t\t// Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind\n\t\t\t_bndId: boundTagId\n\t\t};\n\t\ttag.linkCtx = linkCtx;\n\t\tbindDataLinkTarget(linkCtx, late);\n\t\ttag._toLk = linkCtx._bndId; // If data binding happened, remove _toLk flag from tag\n\t} else if (linkMarkup && node) {\n\t\t// Data-linked element\n\n\t\t// If isLink then this is a top-level linking: .link(expression, target, data, ....) or\n\t\t// .link(true, target, data, ....) scenario - and data and context are passed in separately from the view\n\t\tdata = isLink ? data : currentView.data;\n\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\tlastIndex = rTagDatalink.lastIndex = 0;\n\t\twhile (tokens = rTagDatalink.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \\}(!\\}) option.\n\t\t\tlinkExpressions.push(tokens);\n\t\t\tlastIndex = rTagDatalink.lastIndex;\n\t\t}\n\t\tif (lastIndex < linkMarkup.length) {\n\t\t\tsyntaxError(linkMarkup);\n\t\t}\n\t\twhile (tokens = linkExpressions.shift()) {\n\t\t\t// Iterate over the data-link expressions, for different target attrs,\n\t\t\t// e.g. ~description(firstName, lastName)}\"\n\t\t\t// tokens: [all, attr, bindOnly, tagExpr, tagName, converter, colon, html, comment, code, params]\n\t\t\trTagIndex = rTagDatalink.lastIndex;\n\t\t\tattr = tokens[1];\n\t\t\ttagExpr = tokens[3];\n\t\t\twhile (linkExpressions[0] && linkExpressions[0][4] === \"else\") { // If this is {sometag...} and is followed by an {else...} add to tagExpr\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + linkExpressions.shift()[3];\n\t\t\t\thasElse = true;\n\t\t\t}\n\t\t\tif (hasElse) { // If an {else} has been added, need also to add closing {{/sometag}}\n\t\t\t\ttagExpr += delimCloseChar1 + delimOpenChar0 + delimOpenChar1 + \"/\" + tokens[4] + delimCloseChar0;\n\t\t\t}\n\t\t\tlinkCtx = {\n\t\t\t\ttype: isLink || \"link\",\n\t\t\t\tdata: data, // source\n\t\t\t\telem: node, // target\n\t\t\t\tview: currentView,\n\t\t\t\tctx: context,\n\t\t\t\tattr: attr,\n\t\t\t\t_toLk : 1, // Flag to data-link on initial data-link call rendering call\n\t\t\t\t_noUpd : tokens[2] // Flag for data-link=\"^{...}\" so on initial data-link call will bind, but not render)\n\t\t\t};\n\n\t\t\tconvertBack = undefined;\n\t\t\tif (tokens[6]) {\n\t\t\t\tconvertBack = tokens[10] || undefined;\n\t\t\t\tlinkCtx.convert = tokens[5] || \"\";\n\t\t\t\tif (convertBack !== undefined && defaultAttr(node)) {\n\t\t\t\t\tif (attr) {\n\t\t\t\t\t\tsyntaxError(tagExpr + \"- Remove target: \" + attr);\n\t\t\t\t\t}\n\t\t\t\t\t// Default target, so allow 2 way binding\n\t\t\t\t\tlinkCtx.convertBack = convertBack = convertBack.slice(1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Compile the linkFn expression which evaluates and binds a data-link expression\n\t\t\t// TODO - optimize for the case of simple data path with no conversion, helpers, etc.:\n\t\t\t// i.e. data-link=\"a.b.c\". Avoid creating new instances of Function every time. Can use a default function for all of these...\n\n\t\t\tlinkCtx.expr = attr + tagExpr;\n\t\t\tlinkFn = tmpl.links[tagExpr];\n\t\t\tif (!linkFn) {\n\t\t\t\ttmpl.links[tagExpr] = linkFn = $sub.tmplFn(tagExpr.replace(rEscapeQuotes, \"\\\\$&\"), tmpl, true, convertBack, hasElse);\n\t\t\t}\n\t\t\tlinkCtx.fn = linkFn;\n\t\t\tbindDataLinkTarget(linkCtx, late);\n\t\t\t// We store rTagIndex in local scope, since this addDataBinding method can sometimes be called recursively,\n\t\t\t// and each is using the same rTagDatalink instance.\n\t\t\trTagDatalink.lastIndex = rTagIndex;\n\t\t}\n//\t\t}\n\t}\n}\n\nfunction bindDataLinkTarget(linkCtx, late) {\n\t// Add data link bindings for a link expression in data-link attribute markup\n\tfunction handler(ev, eventArgs) {\n\t\t// If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx\n\t\tif (!eventArgs || !eventArgs.refresh) {\n\t\t\tonDataLinkedTagChange.call(linkCtx, ev, eventArgs);\n\t\t}\n\t}\n\tvar view,\n\t\tlinkCtxType = linkCtx.type;\n\tif (linkCtxType === \"top\" || linkCtxType === \"expr\") {\n\t\t// Top-level linking: .link(expressionOrTrue, data, context) - so we need to create a view for the linking, with the data and ctx\n\t\t// which may be different than the current context of the target. Note that this view is not a standard data-linked view, so it will\n\t\t// be disposed only when its parent view is disposed.\n\t\tlinkCtx.view = new $sub.View(\n\t\t\t$sub.extendCtx(linkCtx.ctx, linkCtx.view.ctx),\n\t\t\t\"link\", linkCtx.view, linkCtx.data, linkCtx.expr, undefined, addBindingMarkers);\n\t}\n\tlinkCtx._ctxCb = $sub._gccb(view = linkCtx.view); // getContextCallback: _ctxCb, for filtering/appending to dependency paths: function(path, object) { return [(object|path)*]}\n\tlinkCtx._hdl = handler;\n\t// handler._ctx = linkCtx; Could pass linkCtx for use in a depends = function() {} call, so depends is different for different linkCtx's\n\tif (linkCtx.elem.nodeName === \"SELECT\" && linkCtxType === \"link\" && !linkCtx.attr) {\n\t\tvar $elem = $(linkCtx.elem);\n\t\t$elem.on(\"jsv-domchange\", function() {\n\t\t\t// If the options have changed dynamically under the select, we need to refresh the data-linked selection, using the new options\n\t\t\tif (!arguments[3].refresh) { // eventArgs.refresh !== true - so a refresh action will only set the selection once\n\t\t\t\tvar source = linkCtx.fn(view.data, view, $sub);\n\t\t\t\t$elem.val(linkCtx.convert || linkCtx.convertBack ? $sub._cnvt(linkCtx.convert, view, source) : source);\n\t\t\t}\n\t\t});\n\t}\n\n\tif (linkCtx.fn._lr) {\n\t\tlinkCtx._toLk = 1;\n\t\tlate.push(linkCtx); // lateRender - defer rendering and linking (sync but after first linking pass)\n\t} else {\n\t\thandler(true);\n\t}\n}\n\n//=====================\n// Data-linking helpers\n//=====================\n\nfunction removeSubStr(str, substr) {\n\tvar k;\n\treturn str\n\t\t? (k = str.indexOf(substr),\n\t\t\t(k + 1\n\t\t\t\t? str.slice(0, k) + str.slice(k + substr.length)\n\t\t\t\t: str))\n\t\t: \"\";\n}\n\nfunction markerNodeInfo(node) {\n\treturn node &&\n\t\t(\"\" + node === node\n\t\t\t? node\n\t\t\t: node.tagName === SCRIPT\n\t\t\t\t? node.type.slice(3)\n\t\t\t\t: node.nodeType === 1 && node.getAttribute(jsvAttrStr) || \"\");\n}\n\nfunction viewInfos(node, isVal, rBinding) {\n\t// Test whether node is a script marker node, and if so, return metadata\n\tfunction getInfos(all, open, close, id, ch, elPath) {\n\t\tinfos.push({\n\t\t\telCnt: elCnt,\n\t\t\tid: id,\n\t\t\tch: ch,\n\t\t\topen: open,\n\t\t\tclose: close,\n\t\t\tpath: elPath,\n\t\t\ttoken: all\n\t\t});\n\t}\n\tvar elCnt, tokens,\n\t\tinfos = [];\n\tif (tokens = isVal ? node : markerNodeInfo(node)) {\n\t\telCnt = infos.elCnt = node.tagName !== SCRIPT;\n\t\telCnt = tokens.charAt(0) === \"@\" || elCnt;\n\t\tinfos._tkns = tokens;\n\t\t// rMarkerTokens = /(?:(#)|(\\/))(\\d+)([_^])([-+@\\d]+)?/g;\n\t\ttokens.replace(rBinding || rMarkerTokens, getInfos);\n\t\treturn infos;\n\t}\n}\n\nfunction unmarkPrevOrNextNode(node, elCnt) {\n\tif (node) {\n\t\tif (node.type === \"jsv\") {\n\t\t\tnode.parentNode.removeChild(node);\n\t\t} else if (elCnt && node.getAttribute($viewsLinkAttr) === \"\") {\n\t\t\tnode.removeAttribute($viewsLinkAttr);\n\t\t}\n\t}\n}\n\nfunction markPrevOrNextNode(node, elCnt) {\n\tvar marker = node;\n\twhile (elCnt && marker && marker.nodeType !== 1) {\n\t\tmarker = marker.previousSibling;\n\t}\n\tif (marker) {\n\t\tif (marker.nodeType !== 1) {\n\t\t\t// For text nodes, we will add a script node before\n\t\t\tmarker = document.createElement(SCRIPT);\n\t\t\tmarker.type = \"jsv\";\n\t\t\tnode.parentNode.insertBefore(marker, node);\n\t\t} else if (!markerNodeInfo(marker) && !marker.getAttribute($viewsLinkAttr)) {\n\t\t\t// For element nodes, we will add a data-link attribute (unless there is already one)\n\t\t\t// so that this node gets included in the node linking process.\n\t\t\tmarker.setAttribute($viewsLinkAttr, \"\");\n\t\t}\n\t}\n\treturn marker;\n}\n\nfunction normalizeLinkTag(linkMarkup, twoway) {\n\tlinkMarkup = $.trim(linkMarkup);\n\treturn linkMarkup.slice(-1) !== delimCloseChar0\n\t// If simplified syntax is used: data-link=\"expression\", convert to data-link=\"{:expression}\",\n\t// or for inputs, data-link=\"{:expression:}\" for (default) two-way binding\n\t\t? linkMarkup = delimOpenChar1 + \":\" + linkMarkup + (twoway ? \":\" : \"\") + delimCloseChar0\n\t\t: linkMarkup;\n}\n\n//===========================\n// Methods for views and tags\n//===========================\n\nfunction callAfterLink(tag, ev, eventArgs) {\n\tfunction copyFromTagCtxToTag() {\n\t\tlinkedElems = tagCtx.linkedElems || tag.linkedElems || tag.linkedElem && [tag.linkedElem];\n\t\tif (linkedElems) {\n\t\t\ttag.linkedElems = tagCtx.linkedElems = linkedElems;\n\t\t\ttag.linkedElem = linkedElems[0] = tag.linkedElem || linkedElems[0];\n\t\t}\n\t\tif (linkedElem = tagCtx.mainElem || tag.mainElem) {\n\t\t\ttagCtx.mainElem = tag.mainElem = linkedElem;\n\t\t}\n\t\tif (linkedElem = tagCtx.displayElem || tag.displayElem) {\n\t\t\ttagCtx.displayElem = tag.displayElem = linkedElem;\n\t\t}\n\t}\n\n\tvar linkedElems, linkedElements, linkedElem, l, m, $linkCtxElem, linkCtxElem, linkedEl, linkedTag,\n\t\ttagCtxElse, props, val, oldVal, indexTo, i, mapDeps, propDeps,\n\t\ttagCtx = tag.tagCtx,\n\t\ttagCtxs = tag.tagCtxs,\n\t\ttagCtxslength = tagCtxs && tagCtxs.length,\n\t\tlinkCtx = tag.linkCtx,\n\t\tbindTo = tag.bindTo || {};\n\n\tif (tag._.unlinked) { // First call to onAfterLink, or first call after onUpdate: updateContent. Initialize and call onBind and set properties\n\t\t$linkCtxElem = $(linkCtx.elem);\n\t\tif (tag.linkedElement || tag.mainElement || tag.displayElement) {\n\t\t\tif (linkedElements = tag.linkedElement) {\n\t\t\t\t// tag.linkedElement: - selector, or array of selectors, for identifying linked elements in template/rendered content.\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\ttag.linkedElem = undefined;\n\t\t\t\tl = linkedElements.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\tif (linkedElements[l]) {\n\t\t\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements[l]);\n\t\t\t\t\t\tm = tagCtxslength;\n\t\t\t\t\t\twhile (m--) {\n\t\t\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\t\t\tlinkedElems = tagCtxElse.linkedElems = tagCtxElse.linkedElems || new Array(l);\n\t\t\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements[l]);\n\t\t\t\t\t\t\tif (linkedElem[0] && linkedElem[0].type !== RADIO) {\n\t\t\t\t\t\t\t\tlinkedElems[l] = linkedElem.eq(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.mainElement) {\n\t\t\t\t// tag.mainElement: - selector for identifying mainElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.mainElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (linkedElements = tag.displayElement) {\n\t\t\t\t// tag.displayElement: - selector for identifying displayElem in template/rendered content\n\t\t\t\t// (But for tag bindings on data-linked elements, defaults to data-linked element)\n\t\t\t\tlinkCtxElem = !tag.inline && $linkCtxElem.filter(linkedElements);\n\t\t\t\tm = tagCtxslength;\n\t\t\t\twhile (m--) {\n\t\t\t\t\ttagCtxElse = tagCtxs[m];\n\t\t\t\t\tlinkedElem = linkCtxElem[0] ? linkCtxElem : tagCtxElse.contents(true, linkedElements).eq(0);\n\t\t\t\t\tif (linkedElem[0]) {\n\t\t\t\t\t\ttagCtxElse.displayElem = linkedElem;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t\tif (tag.onBind) {\n\t\t\ttag.onBind(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\t\tcopyFromTagCtxToTag();\n\t\t}\n\t}\n\n\tm = tagCtxslength;\n\twhile (m--) {\n\t\ttagCtxElse = tagCtxs[m];\n\t\tprops = tagCtxElse.props;\n\n\t\tif (tag._.unlinked && tagCtxElse.map && tag.mapProps) {\n\t\t\t// Compile the dependency paths for observable changes in mapProps (e.g. start, end, filter)\n\t\t\ti = tag.mapProps.length;\n\t\t\tmapDeps = props.mapDepends || tag.mapDepends || []; // dependency paths\n\t\t\tmapDeps = $isArray(mapDeps) ? mapDeps : [mapDeps];\n\t\t\twhile (i--) { // Iterate through mapProps\n\t\t\t\tvar prop = tag.mapProps[i];\n\t\t\t\tpropDeps = tag._.bnd.paths[m][\"_\" + prop]; // paths for mapProps on this tagCtx\n\t\t\t\tif (propDeps && propDeps.length && propDeps.skp) { // Not already a bound prop ^prop=expression;\n\t\t\t\t\tmapDeps = mapDeps.concat(propDeps); // Add dependencies for this prop expression\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (mapDeps.length) {\n\t\t\t\ttagCtxElse.map.observe(mapDeps, linkCtx); // Listen to observable changes of mapProps, and call map.update when change happens\n\t\t\t}\n\t\t}\n\t\tif (linkedElem = tagCtxElse.mainElem || !tag.mainElement && tagCtxElse.linkedElems && tagCtxElse.linkedElems[0]) {\n\t\t\t// linkedElem is the mainElem (defaulting to linkedElem)\n\t\t\tif (linkedElem[0] && props.id && !linkedElem[0].id) {\n\t\t\t\tlinkedElem[0].id = props.id;\n\t\t\t}\n\t\t\tif (tag.setSize) {\n\t\t\t\tif (val = !bindTo.height && props.height || tag.height) {\n\t\t\t\t\tlinkedElem.height(val);\n\t\t\t\t}\n\t\t\t\tif (val = !bindTo.width && props.width || tag.width) {\n\t\t\t\t\tlinkedElem.width(val);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (val = (linkedElem = tagCtxElse.displayElem || linkedElem) && (!bindTo[\"class\"] && props[\"class\"] || tag.className)) {\n\t\t\t// This code supports dynamic binding to class - where it adds the class if absent, and removes/adds if a previous value is present\n\t\t\toldVal = linkedElem[0]._jsvCl;\n\t\t\tif (val !== oldVal) {\n\t\t\t\tif (linkedElem.hasClass(oldVal)) {\n\t\t\t\t\tlinkedElem.removeClass(oldVal);\n\t\t\t\t}\n\t\t\t\tlinkedElem.addClass(val);\n\t\t\t\tlinkedElem[0]._jsvCl = val;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (tag.onAfterLink) {\n\t\ttag.onAfterLink(tagCtx, linkCtx, tag.ctx, ev, eventArgs);\n\t\tcopyFromTagCtxToTag();\n\t}\n\n\tif (!tag.flow && !tag._.chg) {\n\t\tif (tag._tgId && tag._.unlinked && (tag.linkedElems || tag.bindTo)) {\n\t\t\tdefineBindToDataTargets(bindingStore[tag._tgId], tag);\n\t\t}\n\t\tm = tagCtxs.length;\n\t\twhile (m--) {\n\t\t\tprops = tag.cvtArgs(m, 1); // array of bindFrom args/props\n\t\t\tl = props.length;\n\t\t\twhile (l--) {\n\t\t\t\tval = props[l];\n\t\t\t\ttag.setValue(val, l, m);\n\t\t\t}\n\t\t\tif (tag._.unlinked) {\n\t\t\t\ttagCtx = tagCtxs[m];\n\t\t\t\tlinkedElems = tagCtx.linkedElems || !m && tag.linkedElem && [tag.linkedElem];\n\t\t\t\tindexTo = (tag.bindTo || [0]).length;\n\t\t\t\twhile (indexTo--) {\n\t\t\t\t\tif ((linkedElem = linkedElems && linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\tlinkedTag = linkedEl._jsvLkEl;\n\t\t\t\t\t\t\tif (!linkedTag || linkedTag !== tag) {\n\t\t\t\t\t\t\t\t// For data-linked tags, identify the linkedEl with the tag, for \"to\" binding\n\t\t\t\t\t\t\t\t// (For data-linked elements, if not yet bound, we identify later when the linkCtx.elem is bound)\n\t\t\t\t\t\t\t\tlinkedEl._jsvLkEl = tag;\n\t\t\t\t\t\t\t\tlinkedEl._jsvInd = indexTo;\n\t\t\t\t\t\t\t\tlinkedEl._jsvElse = m;\n\t\t\t\t\t\t\t\tbindLinkedElChange(tag, linkedEl);\n\t\t\t\t\t\t\t\tlinkedEl._jsvBnd = \"&\" + tag._tgId + \"+\"; // Add a \"+\" for cloned binding - so removing\n\t\t\t\t\t\t\t\t// elems with cloned bindings will not remove the 'parent' binding from the bindingStore.\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttag._.unlinked = undefined;\n\tif (tag._.lt) { // Late tag: Late path: @some.path had not returned @some object, so try again with refresh\n\t\ttag.refresh();\n\t}\n}\n\nfunction asyncOnElemChange(ev) {\n\tvar which = ev.which;\n\tif (!(which > 15 && which < 21 || which > 32 && which < 41 || which > 111 && which < 131 || which === 27 || which === 144)) {\n\t\t// Shift, Ctrl, Alt, Pause, Caplock, Page up/down End, Home, Left, Up, Right, Down, Function keys, Escape, Numlock\n\t\tsetTimeout(function() {\n\t\t\tonElemChange(ev);\n\t\t});\n\t}\n}\n\nfunction bindTriggerEvent($elem, trig, onoff) {\n\t// Bind keydown, or other trigger - (rather than use the default change event bubbled to activeBody)\n\tif (trig === true && useInput && (!isIE || $elem[0].contentEditable !== TRUE)) { // IE oninput event is not raised for contenteditable changes\n\t\t$elem[onoff](\"input.jsv\", onElemChange); // For HTML5 browser with \"oninput\" support - for mouse editing of text\n\t} else {\n\t\ttrig = \"\" + trig === trig ? trig : \"keydown.jsv\"; // Set trigger to (true || truey non-string (e.g. 1) || 'keydown')\n\t\t$elem[onoff](trig, trig.indexOf(\"keydown\") >= 0 ? asyncOnElemChange : onElemChange); // Get 'keydown' with async\n\t}\n}\n\nfunction bindLinkedElChange(tag, linkedElem) {\n\t// Two-way binding for linkedElem - in the case of input, textarea or contentEditable elements.\n\t// Trigger setting may have changed. Unbind previous trigger binding (if any) and bind new one.\n\n\tvar $linkedElem, newTrig,\n\t\toldTrig = linkedElem._jsvTr || false;\n\n\tif (tag) {\n\t\tnewTrig = tag.tagCtx.props.trigger;\n\t\tif (newTrig === undefined) {\n\t\t\tnewTrig = tag.trigger;\n\t\t}\n\t}\n\tif (newTrig === undefined) {\n\t\tnewTrig = $subSettings.trigger;\n\t}\n\t// Trigger is noop except for text box, textarea, contenteditable...\n\tnewTrig = newTrig && (linkedElem.tagName === \"INPUT\" && linkedElem.type !== CHECKBOX && linkedElem.type !== RADIO\n\t\t|| linkedElem.type === \"textarea\" || linkedElem.contentEditable === TRUE) && newTrig || false;\n\n\tif (oldTrig !== newTrig) {\n\t\t$linkedElem = $(linkedElem);\n\t\tbindTriggerEvent($linkedElem, oldTrig, \"off\");\n\t\tbindTriggerEvent($linkedElem, linkedElem._jsvTr = newTrig, \"on\");\n\t}\n}\n\nfunction defineBindToDataTargets(binding, tag, cvtBk) {\n\t// Two-way binding.\n\t// We set the binding.to[1] to be the cvtBack, and binding.to[0] to be either the path to the target, or [object, path] where the target is the\n\t// path on the provided object. So for a computed path with an object call: a.b.getObject().d.e, we set to[0] to be [exprOb, \"d.e\"], and\n\t// we bind to the path on the returned object, exprOb.ob, as target. Otherwise our target is the first path, paths[0], which we will convert\n\t// with contextCb() for paths like ~a.b.c or #x.y.z\n\n\tvar pathIndex, path, lastPath, bindtoOb, to, bindTo, paths, k, obsCtxPrm, linkedCtxParam, contextCb, targetPaths, bindTos, fromIndex,\n\t\ttagElse = 1,\n\t\ttos = [],\n\t\tlinkCtx = binding.linkCtx,\n\t\tsource = linkCtx.data,\n\t\ttargetPathsElses = linkCtx.fn.paths;\n\n\tif (binding && !binding.to) {\n\t\tif (tag) {\n\t\t\tif (!tag.convertBack) {\n\t\t\t\ttag.convertBack = cvtBk;\n\t\t\t}\n\t\t\tbindTo = tag.bindTo;\n\t\t\ttagElse = tag.tagCtxs ? tag.tagCtxs.length : 1;\n\t\t}\n\t\twhile (tagElse--) {\n\t\t\tbindTos = [];\n\t\t\tif (targetPaths = targetPathsElses[tagElse]) {\n\t\t\t\tbindTo = targetPaths._jsvto ? [\"jsvto\"] : (bindTo || [0]);\n\t\t\t\tif (!tagElse && tag && tag._.ths) {\n\t\t\t\t\t// Tag has a this=expr bindign for which we will create an additional 'to' target (at index bindTo.length)\n\t\t\t\t\tbindTo = bindTo.concat(\"this\");\n\t\t\t\t}\n\t\t\t\tk = bindTo.length;\n\t\t\t\twhile (k--) {\n\t\t\t\t\tpath = \"\";\n\t\t\t\t\tcontextCb = linkCtx._ctxCb;\n\t\t\t\t\tpaths = bindTo[k];\n\t\t\t\t\tpaths = targetPaths[+paths === paths ? paths : \"_\" + paths]; // If path is a string, prepend \"_\" to avoid collision (e.g. with array.length if path is \"length\")\n\t\t\t\t\tif (pathIndex = paths && paths.length) {\n\t\t\t\t\t\tlastPath = paths[pathIndex - 1];\n\t\t\t\t\t\tif (lastPath._cpfn) { // Computed property exprOb\n\n\t\t\t\t\t\t\tbindtoOb = lastPath;\n\t\t\t\t\t\t\twhile (lastPath.sb && lastPath.sb._cpfn) {\n\t\t\t\t\t\t\t\tpath = lastPath = lastPath.sb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpath = lastPath.sb || path && path.path;\n\t\t\t\t\t\t\tlastPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tto = path\n\t\t\t\t\t\t\t? [bindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\t\t\t\tlastPath]\n\t\t\t\t\t\t\t: resolveDataTargetPath(lastPath, source, contextCb); // Get 'to' for target path: lastPath\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Contextual parameter ~foo with no external binding - has ctx.foo = [{_ocp: xxx}] and binds to ctx.foo._ocp\n\t\t\t\t\t\tlinkedCtxParam = tag.linkedCtxParam;\n\t\t\t\t\t\tto = [];\n\t\t\t\t\t\tfromIndex = tag._.fromIndex;\n\t\t\t\t\t\tif (fromIndex && linkedCtxParam && linkedCtxParam[fromIndex[k]]) {\n\t\t\t\t\t\t\t// This is a tag binding, with linked tag contextual parameters\n\t\t\t\t\t\t\tto = [tag.tagCtxs[tagElse].ctx[linkedCtxParam[fromIndex[k]]][0], _ocp];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ((obsCtxPrm = to._cxp) && obsCtxPrm.tag && lastPath.indexOf(\".\")<0) {\n\t\t\t\t\t\t// This is a binding for a tag contextual parameter (e.g. within a tag block content\n\t\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t\t}\n\t\t\t\t\tbindTos.unshift(to);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttos.unshift(bindTos);\n\t\t}\n\t\tbinding.to = tos;\n\t}\n}\n\nfunction resolveDataTargetPath(targetPath, source, contextCb) {\n\t// Iteratively process targetPath, resolving ~a.b.c paths for contextual parameters\n\tvar path, bindtoOb, to, l, obsCtxPrm, view, topCp, data;\n\n\twhile (targetPath && targetPath !== _ocp && (to = contextCb(path = targetPath.split(\"^\").join(\".\"), source)) && (l = to.length)) {\n\t\tif (obsCtxPrm = to[0]._cxp) { // Two-way binding to a contextual parameter reference, ~foo (declared as ~foo=expr on a parent tag)\n\t\t\ttopCp = topCp || obsCtxPrm;\n\t\t\tview = to[0][0];\n\t\t\tif (_ocp in view) {\n\t\t\t\tdata = view;\n\t\t\t\tview = view._vw;\n\t\t\t} else {\n\t\t\t\tdata = view.data;\n\t\t\t}\n\t\t\ttopCp.path = targetPath = to[0][1];\n\t\t\tto = [topCp.data = data, targetPath];\n\t\t\t\tcontextCb = $sub._gccb(view);\n\t\t\t\tif (targetPath._cpfn) { // computed property\n\t\t\t\t\tbindtoOb = targetPath;\n\t\t\t\t\tbindtoOb.data = to[0];\n\t\t\t\t\tbindtoOb._cpCtx = contextCb;\n\t\t\t\t\twhile (targetPath.sb && targetPath.sb._cpfn) {\n\t\t\t\t\t\tpath = targetPath = targetPath.sb;\n\t\t\t\t\t}\n\t\t\t\t\tpath = targetPath.sb || path && path.path;\n\t\t\t\t\ttargetPath = path ? path.slice(1) : bindtoOb.path;\n\t\t\t\t\tto = [\n\t\t\t\t\t\tbindtoOb, // 'exprOb' for this expression and view-binding. So bindtoOb.ob is current object returned by expression.\n\t\t\t\t\t\ttargetPath\n\t\t\t\t\t];\n\t\t\t\t} else if (obsCtxPrm.tag && obsCtxPrm.path === _ocp) {\n\t\t\t\t\tto = obsCtxPrm;\n\t\t\t\t}\n\t\t} else { // Two-way binding to a helper - e.g. ~address.street, or computed, e.g. ~fullName(), or view property e.g. #data.foo\n\t\t\tto = l>1\n\t\t\t\t? [to[l-2], to[l-1]] // With path: [object, path]\n\t\t\t\t: [to[l-1]]; // No path, (e.g. [function] for computed with setter)\n\t\t}\n\t\tsource = to[0];\n\t\ttargetPath = to[1];\n\t}\n\tto = to || [source, path];\n\tto._cxp = topCp;\n\treturn to;\n}\n\nfunction mergeCtxs(tag, newCtxs, replace) { // Merge updated tagCtxs into tag.tagCtxs\n\tvar tagCtx, newTagCtx, latePath,\n\t\tview = tag.tagCtx.view,\n\t\ttagCtxs = tag.tagCtxs || [tag.tagCtx],\n\t\tl = tagCtxs.length,\n\t\trefresh = !newCtxs;\n\n\tif (refresh) {\n\t\tnewCtxs = tag._.bnd.call(view.tmpl, (tag.linkCtx || view).data, view, $sub);\n\t\tif (newCtxs.lt) {\n\t\t\treturn; // We are calling tag.refresh() but a late path (@a.b.c) has not yet returned an object (@a) so cancel the refresh()\n\t\t}\n\t\ttag._.lt = undefined; // All late paths are now resolved, so this is no longer a late tag\n\t\tnewCtxs = $isArray(newCtxs) ? newCtxs : [newCtxs];\n\t}\n\n\tif (replace) {\n\t\t// Replace previous tagCtxs by new ones, rather than merging\n\t\ttagCtxs = tag.tagCtxs = newCtxs;\n\t\ttag.tagCtx = tagCtxs[0];\n\t\taddLinkMethods(tag);\n\t} else {\n\t\twhile (l--) {\n\t\t\ttagCtx = tagCtxs[l];\n\t\t\tnewTagCtx = newCtxs[l];\n\t\t\t$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._thp(tag, tagCtxs[0]); // tagHandlersFromProps\n\treturn tagCtxs;\n}\n\n//=========\n// Disposal\n//=========\n\nfunction clean(elems) {\n\t// Remove data-link bindings, or contained views\n\tvar l, elem, bindings,\n\t\telemArray = [],\n\t\tlen = elems.length,\n\t\ti = len;\n\twhile (i--) {\n\t\t// Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted\n\t\t// (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...)\n\t\telemArray.push(elems[i]);\n\t}\n\ti = len;\n\twhile (i--) {\n\t\telem = elemArray[i];\n\t\tif (elem.parentNode) {\n\t\t\t// Has not already been removed from the DOM\n\t\t\tif (bindings = elem._jsvBnd) {\n\t\t\t\t// Get propertyChange bindings for this element\n\t\t\t\t// This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}}\n\t\t\t\t// bindings is a string with the syntax: \"(&bindingId)*\"\n\t\t\t\tbindings = bindings.slice(1).split(\"&\");\n\t\t\t\telem._jsvBnd = \"\";\n\t\t\t\tl = bindings.length;\n\t\t\t\twhile (l--) {\n\t\t\t\t\t// Remove associated bindings\n\t\t\t\t\tremoveViewBinding(bindings[l], elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view\n\t\t\t\t}\n\t\t\t}\n\t\t\tdisposeTokens(markerNodeInfo(elem) + (elem._df || \"\"), elem);\n\t\t}\n\t}\n}\n\nfunction removeViewBinding(bindId, linkedElemTag, elem) {\n\t// Unbind\n\tvar objId, linkCtx, tag, object, obsId, tagCtxs, l, map, linkedElem, trigger, view, tagCtx, linkedElems, allLinkedElems,\n\t\tbinding = bindingStore[bindId];\n\n\tif (linkedElemTag) {\n\t\telem._jsvLkEl = undefined;\n\t} else if (binding && (!elem || elem === binding.elem)) { // Test that elem is actually binding.elem, since cloned elements can have inappropriate markerNode info\n\t\tdelete bindingStore[bindId]; // Delete already, so call to onDispose handler below cannot trigger recursive deletion (through recursive call to jQuery cleanData)\n\t\tfor (objId in binding.bnd) {\n\t\t\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\ttagCtx = tagCtxs[l];\n\t\t\t\t\t\tif (map = tagCtx.map) {\n\t\t\t\t\t\t\tmap.unmap(); //unobserve\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Copy linkedElems in case tag.linkedElem or tag.linkedElems are undefined in onUnbind\n\t\t\t\t\t\tif (linkedElems = tagCtx.linkedElems) {\n\t\t\t\t\t\t\tallLinkedElems = (allLinkedElems || []).concat(linkedElems);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (tag.onUnbind) {\n\t\t\t\t\ttag.onUnbind(tag.tagCtx, linkCtx, tag.ctx);\n\t\t\t\t}\n\t\t\t\tif (tag.onDispose) {\n\t\t\t\t\ttag.onDispose();\n\t\t\t\t}\n\n\t\t\t\tif (!tag._elCnt) {\n\t\t\t\t\tif (tag._prv) {\n\t\t\t\t\t\ttag._prv.parentNode.removeChild(tag._prv);\n\t\t\t\t\t}\n\t\t\t\t\tif (tag._nxt) {\n\t\t\t\t\t\ttag._nxt.parentNode.removeChild(tag._nxt);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlinkedElems = allLinkedElems || [$(linkCtx.elem)];\n\t\t\tl = linkedElems.length;\n\t\t\twhile (l--) {\n\t\t\t\tlinkedElem = linkedElems[l];\n\t\t\t\tif (trigger = linkedElem && linkedElem[0] && linkedElem[0]._jsvTr) {\n\t\t\t\t\tbindTriggerEvent(linkedElem, trigger, \"off\");\n\t\t\t\t\tlinkedElem[0]._jsvTr = undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tview = linkCtx.view;\n\t\t\tif (view.type === \"link\") {\n\t\t\t\tview.parent.removeViews(view._.key, undefined, true); // A \"link\" view is associated with the binding, so should be disposed with binding.\n\t\t\t} else {\n\t\t\t\tdelete view._.bnds[bindId];\n\t\t\t}\n\t\t}\n\t\tdelete cbBindingsStore[binding.cbId];\n\t}\n}\n\nfunction $unlink(to) {\n\tif (to) {\n\t\tto = to.jquery ? to : $(to);\n\t\tto.each(function() {\n\t\t\tvar innerView;\n\t\t\t//TODO fix this for better perf. Rather that calling inner view multiple times which does querySelectorAll each time, consider a single querySelectorAll\n\t\t\t// or simply call view.removeViews() on the top-level views under the target 'to' node, then clean(...)\n\t\t\t// And/or replace each() by for() or while()\n\t\t\twhile ((innerView = $view(this, true)) && innerView.parent) {\n\t\t\t\tinnerView.parent.removeViews(innerView._.key, undefined, true);\n\t\t\t}\n\t\t\tclean(this.getElementsByTagName(\"*\"));\n\t\t});\n\t\tclean(to);\n\t} else {\n\t\t// Call to $.unlink() is equivalent to $.unlink(true, \"body\")\n\t\tif (activeBody) {\n\t\t\t$(activeBody)\n\t\t\t\t.off(elementChangeStr, onElemChange)\n\t\t\t\t.off('blur.jsv', '[contenteditable]', onElemChange);\n\t\t\tactiveBody = undefined;\n\t\t}\n\t\ttopView.removeViews();\n\t\tclean(document.body.getElementsByTagName(\"*\"));\n\t}\n}\n\n//========\n// Helpers\n//========\n\nfunction inputAttrib(elem) {\n\treturn elem.type === CHECKBOX ? elem[CHECKED] : elem.value;\n}\n\nfunction changeHandler(view, name, tag) {\n\t// Get onBeforeChange, onAfterChange, onAfterCreate handler - if there is one;\n\treturn tag && tag[name] || view.ctx[name] && view.ctxPrm(name) || $views.helpers[name];\n}\n\n//========================== Initialize ==========================\n\n//=====================\n// JsRender integration\n//=====================\n\naddLinkMethods($sub.View.prototype); // Modify the View prototype to include link methods\n\n$sub.onStore.template = function(name, item, parentTmpl) {\n\tif (item === null) {\n\t\tdelete $.link[name];\n\t\tdelete $.render[name];\n\t} else {\n\t\titem.link = tmplLink;\n\n\t\tif (name && !parentTmpl && name !== \"jsvTmpl\") {\n\t\t\t$.render[name] = item;\n\t\t\t$.link[name] = function() {\n\t\t\t\treturn tmplLink.apply(item, arguments);\n\t\t\t};\n\t\t}\n\t}\n};\n\n$sub.viewInfos = viewInfos; // Expose viewInfos() as public helper method\n\n// Define JsViews version of delimiters(), and initialize\n($viewsSettings.delimiters = function() {\n\t// Run delimiters initialization in context of jsrender.js\n\tvar ret = oldJsvDelimiters.apply(0, arguments);\n\n\tif (oldJsvDelimiters !== $viewsDelimiters) {\n\t\t// If JsRender was loaded before JsViews, then need also to initialize and set globals in that JsRender instance\n\t\tret = $viewsDelimiters.apply(0, arguments);\n\t}\n\n\t// Data-linking must use new delimiters\n\trTagDatalink = new RegExp(\"(?:^|\\\\s*)([\\\\w-]*)(\\\\\" + linkChar + \")?(\\\\\" + delimOpenChar1 + $sub.rTag + \"(:\\\\w*)?\\\\\" + delimCloseChar0 + \")\", \"g\");\n\treturn ret;\n})(); // jshint ignore:line\n\n$sub.addSetting(\"trigger\");\n\n//====================================\n// Additional members for linked views\n//====================================\n\nfunction transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) {\n\t// Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._df\n\t// view marker tokens: #m_...VIEW.../m_\n\t// tag marker tokens: #m^...TAG..../m^\n\n\tvar i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens,\n\t\tprecedingLength = 0,\n\t\temptyView = prevNode === nextNode;\n\n\tif (prevNode) {\n\t\t// prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string\n\t\tvwInfos = viewInfos(prevNode) || [];\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\t// Step through views or tags on the prevNode\n\t\t\tvwInfo = vwInfos[i];\n\t\t\tviewId = vwInfo.id;\n\t\t\tif (viewId === id && vwInfo.ch === viewOrTagChar) {\n\t\t\t\tif (refresh) {\n\t\t\t\t\t// This is viewOrTagToRefresh, this is the last viewOrTag to process...\n\t\t\t\t\tl = 0;\n\t\t\t\t} else {\n\t\t\t\t\t// This is viewOrTagToRemove, so we are done...\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!emptyView) {\n\t\t\t\tviewOrTag = vwInfo.ch === \"_\"\n\t\t\t\t\t? viewStore[viewId] // A view: \"#m_\" or \"/m_\"\n\t\t\t\t\t: bindingStore[viewId].linkCtx.tag; // A tag \"#m^\" or \"/m^\"\n\t\t\t\tif (viewOrTag) {\n\t\t\t\t\tif (vwInfo.open) { // A \"#m_\" or \"#m^\" token\n\t\t\t\t\t\tviewOrTag._prv = nextNode;\n\t\t\t\t\t} else if (vwInfo.close) { // A \"/m_\" or \"/m^\" token\n\t\t\t\t\t\tviewOrTag._nxt = nextNode;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tprecedingLength += viewId.length + 2;\n\t\t}\n\n\t\tif (precedingLength) {\n\t\t\tprevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength));\n\t\t}\n\t\ttokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._df;\n\t\tif (l = tokens.indexOf(\"/\" + id + viewOrTagChar) + 1) {\n\t\t\ttokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1));\n\t\t}\n\t\tif (tokens) {\n\t\t\tif (nextNode) {\n\t\t\t\t// If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n\n\t\t\t\t// (and any intervening tokens) from the nextNode (=== prevNode)\n\t\t\t\t// If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode,\n\t\t\t\t// and concatenate with tokens following /n on nextNode\n\t\t\t\tnextNode.setAttribute(jsvAttrStr, tokens);\n\t\t\t} else {\n\t\t\t\tsetDefer(parentElem, tokens);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// !prevNode, so there may be a deferred nodes token on the parentElem. Remove it.\n\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"#\" + id + viewOrTagChar));\n\t\tif (!refresh && !nextNode) {\n\t\t\t// If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens\n\t\t\tsetDefer(parentElem, removeSubStr(parentElem._df, \"/\" + id + viewOrTagChar));\n\t\t}\n\t}\n}\n\nfunction disposeTokens(tokens, elem) {\n\tvar i, l, vwItem, vwInfos;\n\tif (vwInfos = viewInfos(tokens, true, rOpenMarkers)) {\n\t\tfor (i = 0, l = vwInfos.length; i < l; i++) {\n\t\t\tvwItem = vwInfos[i];\n\t\t\tif (vwItem.ch === \"_\") {\n\t\t\t\tif ((vwItem = viewStore[vwItem.id]) && vwItem.type && (!elem || vwItem._prv === elem || vwItem.parentElem === elem )) {\n\t\t\t\t\t// If this is the _prv (prevNode) for a view, remove the view\n\t\t\t\t\t// - unless view.type is undefined, in which case it is already being removed\n\t\t\t\t\t// (or unless the elem is not related - e.g. a cloned element which 'accidentally' picked up the data-jsv atttribute of the ._df expando)\n\t\t\t\t\tvwItem.parent.removeViews(vwItem._.key, undefined, true);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tremoveViewBinding(vwItem.id, undefined, elem); // unbind bindings with this bindingId on this view\n\t\t\t}\n\t\t}\n\t}\n}\n\n//============================================\n// Add link methods to data-linked view or tag\n//============================================\n\nfunction updateValue(val, index, tagElse, async, bindId, ev) {\n// async, bindId and ev not documented - used internally, e.g. for paged and sorted arrays on tags with dataMap, such as {{for}}\n// Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes\n// Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined\n// Called directly as tag.updateValue(val, index, tagElse) - this: tag\n\tvar self = this,\n\t\tvalues = [];\n\tif (self && self._tgId) {\n\t\tbindId = self;\n\t}\n\tif (arguments.length < 4) {\n\t\tif (+index !== index) {\n\t\t\tasync = index;\n\t\t\ttagElse = index = 0;\n\t\t} else if (+tagElse !== tagElse) {\n\t\t\tasync = tagElse;\n\t\t\ttagElse = 0;\n\t\t}\n\t}\n\tvalues[index||0] = val;\n\tupdateValues(values, tagElse, async, bindId, ev);\n\treturn self;\n}\n\nfunction setValues() {\n// tagCtx.setValues() calls tag.setValue() on that tagCtx for each bindTo target\n\tvar m = arguments.length;\n\twhile (m--) {\n\t\tthis.tag.setValue(arguments[m], m, this.index);\n\t}\n}\n\nfunction addLinkMethods(tagOrView) { // tagOrView is View prototype or tag instance\n\n\tvar l, m, tagCtx, boundProps, bindFrom, key, theTag, theView;\n\n\ttagOrView.contents = function(deep, select) {\n\t\t// For a view, a tag or a tagCtx, return jQuery object with the content nodes,\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is contents(selector)\n\t\t\tselect = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\t\tvar filtered,\n\t\t\tnodes = $(this.nodes());\n\t\tif (nodes[0]) {\n\t\t\tselect = deep ? select || \"*\" : select;\n\t\t\tfiltered = select ? nodes.filter(select) : nodes;\n\t\t\tnodes = deep ? filtered.add(nodes.find(select)) : filtered;\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.nodes = function(withMarkers, prevNode, nextNode) {\n\t\t// For a view, a tag or a tagCtx, return top-level nodes\n\t\t// Do not return any script marker nodes, unless withMarkers is true\n\t\t// Optionally limit range, by passing in prevNode or nextNode parameters\n\n\t\tvar node,\n\t\t\tself = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\telCnt = self._elCnt,\n\t\t\tprevIsFirstNode = !prevNode && elCnt,\n\t\t\tnodes = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tprevNode = prevNode || self._prv;\n\t\t\tnextNode = nextNode || self._nxt;\n\n\t\t\tnode = prevIsFirstNode\n\t\t\t\t? (prevNode === self._nxt\n\t\t\t\t\t? self.parentElem.lastSibling\n\t\t\t\t\t: prevNode)\n\t\t\t\t: (self.inline === false\n\t\t\t\t\t? prevNode || self.linkCtx.elem.firstChild\n\t\t\t\t\t: prevNode && prevNode.nextSibling);\n\n\t\t\twhile (node && (!nextNode || node !== nextNode)) {\n\t\t\t\tif (withMarkers || elCnt || node.tagName !== SCRIPT) {\n\t\t\t\t\t// All the top-level nodes in the view\n\t\t\t\t\t// (except script marker nodes, unless withMarkers = true)\n\t\t\t\t\t// (Note: If a script marker node, viewInfo.elCnt undefined)\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t}\n\t\t\t\tnode = node.nextSibling;\n\t\t\t}\n\t\t}\n\t\treturn nodes;\n\t};\n\n\ttagOrView.childTags = function(deep, tagName) {\n\t\t// For a view, a tag or a tagCtx, return child tags - at any depth, or as immediate children only.\n\t\tif (deep !== !!deep) {\n\t\t\t// deep not boolean, so this is childTags(tagName) - which looks for top-level tags of given tagName\n\t\t\ttagName = deep;\n\t\t\tdeep = undefined;\n\t\t}\n\n\t\tvar self = this.contentView || this, // If tagCtx, use tagCtx.contentView\n\t\t\tview = self.link ? self : self.tagCtx.view, // This may be a view or a tag. If a tag, get the view from tag.tagCtx.view\n\t\t\tprevNode = self._prv,\n\t\t\telCnt = self._elCnt,\n\t\t\ttags = [];\n\n\t\tif (!self.args) { // If tagCtx with no content (so no contentView) self is tagCtx: return empty [];\n\t\t\tview.link(\n\t\t\t\tundefined,\n\t\t\t\tself.parentElem,\n\t\t\t\telCnt ? prevNode && prevNode.previousSibling : prevNode,\n\t\t\t\tself._nxt,\n\t\t\t\tundefined,\n\t\t\t\t{get:{\n\t\t\t\t\ttags: tags,\n\t\t\t\t\tdeep: deep,\n\t\t\t\t\tname: tagName,\n\t\t\t\t\tid: self.link ? self._.id + \"_\" : self._tgId + \"^\"\n\t\t\t\t}}\n\t\t\t);\n\t\t}\n\t\treturn tags;\n\t};\n\n\tif (tagOrView._is === \"tag\") {\n\t\t//=======================\n\t\t// This is a TAG instance\n\t\t//=======================\n\n\t\ttheTag = tagOrView;\n\n\t\tm = theTag.tagCtxs.length;\n\t\twhile (m--) {\n\t\t\ttagCtx = theTag.tagCtxs[m];\n\n\t\t\ttagCtx.setValues = setValues;\n\t\t\ttagCtx.contents = tagOrView.contents;\n\t\t\ttagCtx.childTags = tagOrView.childTags;\n\t\t\ttagCtx.nodes = tagOrView.nodes;\n\t\t}\n\n\t\tboundProps = theTag.boundProps = theTag.boundProps || [];\n\t\tif (bindFrom = theTag.bindFrom) {\n\t\t\tl = bindFrom.length;\n\t\t\twhile (l--) {\n\t\t\t\tkey = bindFrom[l];\n\t\t\t\tif (key + \"\" === key) {\n\t\t\t\t\tbindFrom[key] = 1;\n\t\t\t\t\tif ($inArray(key, boundProps) < 0) {\n\t\t\t\t\t\tboundProps.push(key); // Add any 'bindFrom' props to boundProps array. (So two-way binding works without writing ^foo=expression)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ttheTag.setValue = $sub._gm( // getMethod\n\t\t\ttheTag.constructor.prototype.setValue || function(val) { // base method\n\t\t\t\treturn val;\n\t\t\t},\n\t\t\tfunction(val, indexFrom, tagElse) {\n\t\t\t\tindexFrom = indexFrom || 0;\n\t\t\t\ttagElse = tagElse || 0;\n\n\t\t\t\tvar linkedElem, linkedEl, linkedCtxParam, linkedCtxPrmKey, indexTo, linkedElems,\n\t\t\t\t\ttagCtx = theTag.tagCtxs[tagElse],\n\t\t\t\t\tnewVal = theTag.base.call(theTag, val, indexFrom, tagElse);\n\n\t\t\t\tif (newVal !== undefined) { // Call tag method tag.setValue(), if implemented\n\t\t\t\t\tval = newVal;\n\t\t\t\t}\n\t\t\t\tif (val !== undefined && (theTag.convert || theTag._.toIndex[indexFrom] === undefined)\n\t\t\t\t\t\t&& (linkedCtxParam = theTag.linkedCtxParam)\n\t\t\t\t\t\t&& linkedCtxParam[indexFrom]\n\t\t\t\t\t\t// If this setValue call corresponds to a tag contextual parameter and the tag has a converter, then we need to set the\n\t\t\t\t\t\t// value of this contextual parameter (since it is not directly bound to the tag argument/property when there is a converter).\n\t\t\t\t\t\t&& (linkedCtxPrmKey = linkedCtxParam[indexFrom])\n\t\t\t\t\t) {\n\t\t\t\t\ttagCtx.ctxPrm(linkedCtxPrmKey, val);\n\t\t\t\t}\n\t\t\t\tindexTo = theTag._.toIndex[indexFrom];\n\t\t\t\tif (indexTo !== undefined) {\n\t\t\t\t\tif (linkedElems = tagCtx.linkedElems || theTag.linkedElem && [theTag.linkedElem]) {\n\t\t\t\t\t\tif ((linkedElem = linkedElems[indexTo]) && (l = linkedElem.length)) {\n\t\t\t\t\t\t\twhile (l--) {\n\t\t\t\t\t\t\t\tlinkedEl = linkedElem[l];\n\t\t\t\t\t\t\t\tif (val !== undefined && !linkedEl._jsvChg && theTag.linkCtx._val !== val) {\n\t\t\t\t\t\t\t\t\tif (linkedEl.value !== undefined) {\n\t\t\t\t\t\t\t\t\t\tif (linkedEl.type === CHECKBOX) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = val && val !== \"false\";\n\t\t\t\t\t\t\t\t\t\t} else if (linkedEl.type === RADIO) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl[CHECKED] = (linkedEl.value === val);\n\t\t\t\t\t\t\t\t\t\t} else if ($isArray(val)) {\n\t\t\t\t\t\t\t\t\t\t\tlinkedEl.value = val; // Don't use jQuery since it replaces array by mapped clone\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t$(linkedEl).val(val); // Use jQuery for attrHooks - can't just set value (on select, for example)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlinkedEl[linkedEl.contentEditable === TRUE ? \"innerHTML\" : TEXTCONTENT] = val;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (tagCtx.props.name) {\n\t\t\t\t\t\t\t\t\tlinkedEl.name = linkedEl.name || tagCtx.props.name;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn theTag;\n\t\t\t}\n\t\t);\n\t\ttheTag.updateValue = updateValue;\n\n\t\ttheTag.updateValues = function() {\n\t\t\tvar tagElse, async,\n\t\t\t\ttag = this,\n\t\t\t\tbindToLength = tag.bindTo ? tag.bindTo.length : 1,\n\t\t\t\textra = arguments.length - bindToLength;\n\n\t\t\tif (extra) {\n\t\t\t\ttagElse = arguments[bindToLength];\n\t\t\t\tif (extra > 1) {\n\t\t\t\t\tasync = extra > 1 ? arguments[bindToLength + 1] : undefined;\n\t\t\t\t} else if (+tagElse !== tagElse) {\n\t\t\t\t\tasync = tagElse;\n\t\t\t\t\ttagElse = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn updateValues(arguments, tagElse, async, this);\n\t\t};\n\n\t\ttheTag.setValues = function() {\n\t\t// tag.setValues(a, b, c) calls tagCtx.setValues(a, b, c) on the first tagCtx\n\t\t\tsetValues.apply(theTag.tagCtx, arguments);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.refresh = function() {\n\t\t\tvar attr, sourceValue,\n\t\t\t\tlinkCtx = theTag.linkCtx,\n\t\t\t\tview = theTag.tagCtx.view;\n\n\t\t\tif (!(sourceValue = mergeCtxs(theTag))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (theTag.onUnbind) {\n\t\t\t\ttheTag.onUnbind(theTag.tagCtx, linkCtx, theTag.ctx);\n\t\t\t\ttheTag._.unlinked = true;\n\t\t\t}\n\t\t\tattr = theTag.inline ? HTML : (linkCtx.attr || defaultAttr(theTag.parentElem, true));\n\t\t\tsourceValue = theTag.tagName === \":\"\n\t\t\t\t? $sub._cnvt(theTag.convert, view, theTag.tagCtx)\n\t\t\t\t: $sub._tag(theTag, view, view.tmpl, sourceValue, true); // Get rendered HTML for tag, based on refreshed tagCtxs\n\n\t\t\tobserveAndBind(linkCtx, linkCtx.data, linkCtx.elem);\n\t\t\tupdateContent(sourceValue, linkCtx, attr, theTag);\n\t\t\tcallAfterLink(theTag);\n\t\t\treturn theTag;\n\t\t};\n\n\t\ttheTag.domChange = function() { // domChange notification support\n\t\t\tvar elem = this.parentElem,\n\t\t\t\thasListener = $._data(elem).events,\n\t\t\t\tdomChangeNotification = \"jsv-domchange\";\n\n\t\t\tif (hasListener && hasListener[domChangeNotification]) {\n\t\t\t\t// Only trigger handler if there is a handler listening for this event. (Note using triggerHandler - so no event bubbling.)\n\t\t\t\t$(elem).triggerHandler(domChangeNotification, arguments);\n\t\t\t}\n\t\t};\n\n\t\t//====================================\n\t\t// End of added link methods for TAG\n\t\t//====================================\n\t} else {\n\t\t//=========================\n\t\t// This is a VIEW prototype\n\t\t//=========================\n\n\t\ttheView = tagOrView;\n\n\t\t// Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ...\n\t\ttheView.addViews = function(index, dataItems, delayed) {\n\t\t\t// if view is not an array view, do nothing\n\t\t\tvar i, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\titemsCount = dataItems.length,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (!view._.useKey && itemsCount) {\n\t\t\t\t// view is of type \"array\"\n\t\t\t\tviewsCount = views.length + itemsCount;\n\n\t\t\t\tif ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\t&& renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false\n\t\t\t\t\t&& !view._.srt) { // Not part of a 'sort' on refresh\n\t\t\t\t\tview.fixIndex(index + itemsCount);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.removeViews = function(index, itemsCount, keepNodes, delayed) {\n\t\t\t// view.removeViews() removes all the child views\n\t\t\t// view.removeViews(index) removes the child view with specified index or key\n\t\t\t// view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index\n\t\t\tfunction removeView(index) {\n\t\t\t\tvar id, bindId, parentElem, prevNode, nextNode, nodesToRemove,\n\t\t\t\t\tviewToRemove = views[index];\n\n\t\t\t\tif (viewToRemove && viewToRemove.link) {\n\t\t\t\t\tid = viewToRemove._.id;\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tnodesToRemove = viewToRemove.nodes();\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove child views, without removing nodes\n\t\t\t\t\tviewToRemove.removeViews(undefined, undefined, true);\n\n\t\t\t\t\tviewToRemove.type = undefined; // Set type to undefined: used as a flag that this view is being removed\n\t\t\t\t\tprevNode = viewToRemove._prv;\n\t\t\t\t\tnextNode = viewToRemove._nxt;\n\t\t\t\t\tparentElem = viewToRemove.parentElem;\n\t\t\t\t\t// If prevNode and nextNode are the same, the view is empty\n\t\t\t\t\tif (!keepNodes) {\n\t\t\t\t\t\t// Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views\n\t\t\t\t\t\tif (viewToRemove._elCnt) {\n\t\t\t\t\t\t\t// if keepNodes is false (and transferring of tokens has not already been done at a higher level)\n\t\t\t\t\t\t\t// then transfer tokens from prevNode which is being removed, to nextNode.\n\t\t\t\t\t\t\ttransferViewTokens(prevNode, nextNode, parentElem, id, \"_\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$(nodesToRemove).remove();\n\t\t\t\t\t}\n\t\t\t\t\tif (!viewToRemove._elCnt) {\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, childView, viewsCount,\n\t\t\t\tview = this,\n\t\t\t\tisArray = !view._.useKey,\n\t\t\t\tviews = view.views;\n\n\t\t\tif (isArray) {\n\t\t\t\tviewsCount = views.length;\n\t\t\t}\n\t\t\tif (index === undefined) {\n\t\t\t\t// Remove all child views\n\t\t\t\tif (isArray) {\n\t\t\t\t\t// views and data are arrays\n\t\t\t\t\tcurrent = viewsCount;\n\t\t\t\t\twhile (current--) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = [];\n\t\t\t\t} else {\n\t\t\t\t\t// views and data are objects\n\t\t\t\t\tfor (childView in views) {\n\t\t\t\t\t\t// Remove by key\n\t\t\t\t\t\tremoveView(childView);\n\t\t\t\t\t}\n\t\t\t\t\tview.views = {};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (itemsCount === undefined) {\n\t\t\t\t\tif (isArray) {\n\t\t\t\t\t\t// The parentView is data array view.\n\t\t\t\t\t\t// Set itemsCount to 1, to remove this item\n\t\t\t\t\t\titemsCount = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Remove child view with key 'index'\n\t\t\t\t\t\tremoveView(index);\n\t\t\t\t\t\tdelete views[index];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (isArray && itemsCount\n\t\t\t\t\t&& (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301)\n\t\t\t\t\tcurrent = index + itemsCount;\n\t\t\t\t\t// Remove indexed items (parentView is data array view);\n\t\t\t\t\twhile (current-- > index) {\n\t\t\t\t\t\tremoveView(current);\n\t\t\t\t\t}\n\t\t\t\t\tviews.splice(index, itemsCount);\n\t\t\t\t\tif (!view._.srt) {\n\t\t\t\t\t\tview.fixIndex(index);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.moveViews = function(oldIndex, index, itemsCount) {\n\t\t\tfunction parts(itemView, str) { // Get the totkens preceding the 'open' token for this view, #n_, and the tokens following (and including) the 'open' token\n\t\t\t\treturn RegExp(\"^(.*)(\" + (str ? \"\\\\/\" : \"#\") + itemView._.id + \"_.*)$\").exec(str || itemView._prv.getAttribute(jsvAttrStr));\n\t\t\t}\n\t\t\tfunction setPrv(itemView, tokens) {\n\t\t\t\tvar prv = itemView._prv;\n\t\t\t\tprv.setAttribute(jsvAttrStr, tokens);\n\t\t\t\ttokens.replace(rTagMarkers, function(all, open, close, id) {\n\t\t\t\t\tbindingStore[id].linkCtx.tag[open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t\ttokens.replace(rViewMarkers, function(all, open, close, id) {\n\t\t\t\t\tviewStore[id][open ? \"_prv\" : \"_nxt\"] = prv;\n\t\t\t\t});\n\t\t\t}\n\t\t\tvar nodes, childView, nxtView, insertBefore, viewId,\n\t\t\t\tview = this,\n\t\t\t\tselfNxt = view._nxt,\n\t\t\t\tviews = view.views,\n\t\t\t\tbackwards = index < oldIndex,\n\t\t\t\tfirstChange = backwards ? index : oldIndex,\n\t\t\t\tlastChange = backwards ? oldIndex : index,\n\t\t\t\ti = index,\n\t\t\t\tmovedNodes = [],\n\n\t\t\t\tviewsToMove = views.splice(oldIndex, itemsCount); // remove\n\n\t\t\tif (index > views.length) {\n\t\t\t\tindex = views.length;\n\t\t\t}\n\t\t\tviews.splice.apply(views, [index, 0].concat(viewsToMove)); //re-insert\n\n\t\t\titemsCount = viewsToMove.length;\n\t\t\tinsertBefore = index + itemsCount;\n\t\t\tlastChange += itemsCount;\n\n\t\t\tfor (i; i < insertBefore; i++) {\n\t\t\t\tchildView = views[i];\n\t\t\t\tnodes = childView.nodes(true);\n\t\t\t\tmovedNodes = view._elCnt ? movedNodes.concat(nodes) : movedNodes.concat(childView._prv, nodes, childView._nxt);\n\t\t\t}\n\t\t\tmovedNodes = $(movedNodes);\n\n\t\t\tif (insertBefore < views.length) {\n\t\t\t\tmovedNodes.insertBefore(views[insertBefore]._prv);\n\t\t\t} else if (selfNxt) {\n\t\t\t\tmovedNodes.insertBefore(selfNxt);\n\t\t\t} else {\n\t\t\t\tmovedNodes.appendTo(view.parentElem);\n\t\t\t}\n\n\t\t\tif (view._elCnt) {\n\t\t\t\tvar afterParts,\n\t\t\t\t\tendChange = backwards ? firstChange + itemsCount : lastChange - itemsCount,\n\t\t\t\t\tbeforeView = views[firstChange-1],\n\t\t\t\t\tstartView = views[firstChange],\n\t\t\t\t\tendView = views[endChange],\n\t\t\t\t\tafterView = views[lastChange],\n\t\t\t\t\tstartParts = parts(startView),\n\t\t\t\t\tendParts = parts(endView);\n\n\t\t\t\tsetPrv(startView, endParts[1] + startParts[2]);\n\t\t\t\tif (afterView) {\n\t\t\t\t\tafterParts = parts(afterView);\n\t\t\t\t\tsetPrv(afterView, startParts[1] + afterParts[2]);\n\t\t\t\t} else {\n\t\t\t\t\tviews[lastChange-1]._nxt = selfNxt;\n\t\t\t\t\tif (selfNxt) {\n\t\t\t\t\t\tafterParts = parts(view, selfNxt.getAttribute(jsvAttrStr));\n\t\t\t\t\t\tselfNxt.setAttribute(jsvAttrStr, startParts[1] + afterParts[2]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tafterParts = parts(view, view.parentElem._df);\n\n\t\t\t\t\t\tsetDefer(view.parentElem, startParts[1] + afterParts[2]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetPrv(endView, afterParts[1] + endParts[2]);\n\t\t\t}\n\t\t\tview.fixIndex(firstChange);\n\t\t};\n\n\t\ttheView.refresh = function() {\n\t\t\tvar view = this,\n\t\t\t\tparent = view.parent;\n\n\t\t\tif (parent) {\n\t\t\t\trenderAndLink(view, view.index, view.tmpl, parent.views, view.data, undefined, true);\n\t\t\t\tsetArrayChangeLink(view);\n\t\t\t}\n\t\t\treturn view;\n\t\t};\n\n\t\ttheView.fixIndex = function(fromIndex) {\n\t\t\t// Fixup index on following view items...\n\t\t\tvar views = this.views,\n\t\t\t\tindex = views.length;\n\t\t\twhile (fromIndex < index--) {\n\t\t\t\tif (views[index].index !== index) {\n\t\t\t\t\t$observable(views[index]).setProperty(\"index\", index);\n\t\t\t\t\t// This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex()\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\ttheView.link = viewLink;\n\n\t\t//====================================\n\t\t// End of added link methods for VIEW\n\t\t//====================================\n\t}\n}\n\n//========================\n// JsViews-specific converters\n//========================\n\n$converters.merge = function(val) {\n\t// Special converter used in data-linking to space-separated lists, such as className:\n\t// Currently only supports toggle semantics - and has no effect if toggle string is not specified\n\t// data-link=\"class{merge:boolExpr toggle=className}\"\n\tvar regularExpression,\n\t\tcurrentValue = this.linkCtx.elem.className,\n\t\ttoggle = this.tagCtx.props.toggle;\n\n\tif (toggle) {\n\t\t// We are toggling the class specified by the toggle property,\n\t\t// and the boolean val binding is driving the insert/remove toggle\n\n\t\tregularExpression = toggle.replace(/[\\\\^$.|?*+()[{]/g, \"\\\\$&\");\n\t\t// Escape any regular expression special characters (metacharacters) within the toggle string\n\t\tregularExpression = \"(\\\\s(?=\" + regularExpression + \"$)|(\\\\s)|^)(\" + regularExpression + \"(\\\\s|$))\";\n\t\t// Example: /(\\s(?=myclass$)|(\\s)|^)?(myclass(\\s|$))/ - so matches (\" myclass\" or \" \" or ^ ) followed by (\"myclass \" or \"myclass$\") where ^/$ are beginning/end of string\n\t\tcurrentValue = currentValue.replace(new RegExp(regularExpression), \"$2\");\n\t\tval = currentValue + (val ? (currentValue && \" \") + toggle : \"\");\n\t}\n\treturn val;\n};\n\n//========================\n// JsViews-specific tags\n//========================\n\n$tags({\n\ton: {\n\t\tattr: NONE,\n\t\tbindTo: [], // Don't need to bind to first arg, so prevent the default [0] binding\n\t\tinit: function(tagCtx) {\n\t\t\tvar content,\n\t\t\t\ttag = this,\n\t\t\t\ti = 0,\n\t\t\t\targs = tagCtx.args, // [events,] [selector,] handler\n\t\t\t\tl = args.length;\n\n\t\t\tfor (; ii && i+1; // handler index\n\t\t\tif (tag.inline) {\n\t\t\t\tif (!$sub.rTmpl.exec(content = $.trim(tagCtx.tmpl.markup))) {\n\t\t\t\t\t// Inline {^{on}} tag with no content (or external template content) or with content containing\n\t\t\t\t\t// no HTML or JsRender tags: We will wrap the (text) content, or the operation name in a \";\n\t\t\t\t}\n\t\t\t\ttag.attr = HTML;\n\t\t\t}\n\t\t},\n\t\tonBind: function() {\n\t\t\tif (this.template) { // {^{on/}} with no content has template rendering
\", \"
\"],\n\t\ttr: [2, \"\", \"
\"],\n\t\ttd: [3, \"\", \"
\"],\n\t\tcol: [2, \"\", \"
\"],\n\t\tsvg_ns: [1, \"\", \"\"],\n\t\t// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n\t\t// unless wrapped in a div with non-breaking characters in front of it.\n\t\tdiv: $.support.htmlSerialize ? [0, \"\", \"\"] : [1, \"X
\", \"
\"]\n\t},\n\t_fe: {\n\t\tinput: {\n\t\t\tfrom: inputAttrib, to: VALUE\n\t\t},\n\t\ttextarea: valueBinding,\n\t\tselect: valueBinding,\n\t\toptgroup: {\n\t\t\tto: \"label\"\n\t\t}\n\t}\n});\n\nreturn $;\n}, window));\n"]} \ No newline at end of file diff --git a/package.json b/package.json index 1a71449..69280f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jsviews", - "version": "v1.0.2", + "version": "v1.0.3", "description": "Next-generation MVVM and MVP framework - built on top of JsRender templates. Bringing templates to life...", "main": "./jsviews.js", "author": { @@ -34,7 +34,7 @@ "browserify": "^11.0.1", "glob-stream": "^5.0.0", "gulp": "^3.9.0", - "jsrender": "^1.0.2", + "jsrender": "^1.0.3", "qunit": "^0.7.6" }, "dependencies": { diff --git a/test/browserify/bundles/1-bundle.js b/test/browserify/bundles/1-bundle.js index df1a564..d8d40f2 100644 --- a/test/browserify/bundles/1-bundle.js +++ b/test/browserify/bundles/1-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -2795,20 +2834,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -2848,6 +2874,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -2956,4 +2997,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[2]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvanNyZW5kZXIvanNyZW5kZXIuanMiLCJ0ZXN0L2Jyb3dzZXJpZnkvMS11bml0LXRlc3RzLmpzIiwidGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQ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Fx0XHRcdDogJ1VubWF0Y2hlZCBvciBtaXNzaW5nIHt7LycgKyB0YWdOYW1lKSArICcsIGluIHRlbXBsYXRlOlxcbicgKyBtYXJrdXApO1xuXHRcdH1cblx0fVxuXG5cdGZ1bmN0aW9uIHBhcnNlVGFnKGFsbCwgYmluZCwgdGFnTmFtZSwgY29udmVydGVyLCBjb2xvbiwgaHRtbCwgY29kZVRhZywgcGFyYW1zLCBzbGFzaCwgYmluZDIsIGNsb3NlQmxvY2ssIGluZGV4KSB7XG4vKlxuXG4gICAgIGJpbmQgICAgIHRhZ05hbWUgICAgICAgICBjdnQgICBjbG4gaHRtbCBjb2RlICAgIHBhcmFtcyAgICAgICAgICAgIHNsYXNoICAgYmluZDIgICAgICAgICBjbG9zZUJsayAgY29tbWVudFxuLyg/OnsoXFxeKT97KD86KFxcdysoPz1bXFwvXFxzfV0pKXwoXFx3Kyk/KDopfCg+KXwoXFwqKSlcXHMqKCg/OltefV18fSg/IX0pKSo/KShcXC8pP3x7KFxcXik/eyg/Oig/OlxcLyhcXHcrKSlcXHMqfCEtLVtcXHNcXFNdKj8tLSkpfX0vZ1xuXG4oPzpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogIC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ckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfChcXCg/KVxcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdC8vbGZ0UHJuMCAgICAgICAgICAgbGZ0UHJuICAgICAgICAgYm91bmQgICAgIHBhdGggICAgICAgICAgICAgICBvcGVyYXRvciAgICAgZXJyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXEgICAgICBwYXRoMiBsYXRlICAgICAgICAgICAgcHJuICAgICAgY29tbWEgIGxmdFBybjIgICBhcG9zIHF1b3QgICAgICAgIHJ0UHJuICBydFBybkRvdCAgICAgICAgICAgICAgICAgIHBybjIgICAgIHNwYWNlXG5cdC8vIChsZWZ0IHBhcmVuPyBmb2xsb3dlZCBieSAocGF0aD8gZm9sbG93ZWQgYnkgb3BlcmF0b3IpIG9yIChwYXRoIGZvbGxvd2VkIGJ5IHBhcmVuPykpIG9yIGNvbW1hIG9yIGFwb3Mgb3IgcXVvdCBvciByaWdodCBwYXJlbiBvciBzcGFjZVxuXG5cdFx0ZnVuY3Rpb24gcGFyc2VQYXRoKGFsbFBhdGgsIG5vdCwgb2JqZWN0LCBoZWxwZXIsIHZpZXcsIHZpZXdQcm9wZXJ0eSwgcGF0aFRva2VucywgbGVhZlRva2VuKSB7XG5cdFx0XHQvLyAvXighKj8pKD86bnVsbHx0cnVlfGZhbHNlfFxcZFtcXGQuXSp8KFtcXHckXSt8XFwufH4oW1xcdyRdKyl8Iyh2aWV3fChbXFx3JF0rKSk/KShbXFx3JC5eXSo/KSg/OlsuW15dKFtcXHckXSspXFxdPyk/KSQvZyxcblx0XHRcdC8vICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB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g/OlsuW15dKFtcXHckXSspXFxdPyk/KSQvZyxcblx0XHRcdC8vICAgICAgICBub3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0ICAgICBoZWxwZXIgICAgdmlldyAgdmlld1Byb3BlcnR5IHBhdGhUb2tlbnMgICAgICBsZWFmVG9rZW5cblxuXHRcdFx0clBybTogLyhcXCgpKD89XFxzKlxcKCl8KD86KFsoW10pXFxzKik/KD86KFxcXj8pKH4/W1xcdyQuXl0rKT9cXHMqKChcXCtcXCt8LS0pfFxcK3wtfH4oPyFbXFx3JF0pfCYmfFxcfFxcfHw9PT18IT09fD09fCE9fDw9fD49fFs8PiUqOj9cXC9dfCg9KSlcXHMqfCghKj8oQCk/WyN+XT9bXFx3JC5eXSspKFsoW10pPyl8KCxcXHMqKXwoXFwoPylcXFxcPyg/OignKXwoXCIpKXwoPzpcXHMqKChbKVxcXV0pKD89Wy5eXXxcXHMqJHxbXihbXSl8WylcXF1dKShbKFtdPykpfChcXHMrKS9nLFxuXHRcdFx0Ly8gICBsZnRQcm4wICAgICAgICAgICBsZnRQcm4gICAgICAgICBib3VuZCAgICAgcGF0aCAgICAgICAgICAgICAgIG9wZXJhdG9yICAgICBlcnIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcSAgICAgIHBhdGgyIGxhdGUgICAgICAgICAgICBwcm4gICAgICBjb21tYSAgbGZ0UHJuMiAgIGFwb3MgcXVvdCAgICAgICAgcnRQcm4gIHJ0UHJuRG90ICAgICAgICAgICAgICAgICAgcHJuMiAgICAgc3BhY2VcblxuXHRcdFx0VmlldzogVmlldyxcblx0XHRcdEVycjogSnNWaWV3c0Vycm9yLFxuXHRcdFx0dG1wbEZuOiB0bXBsRm4sXG5cdFx0XHRwYXJzZTogcGFyc2VQYXJhbXMsXG5cdFx0XHRleHRlbmQ6ICRleHRlbmQsXG5cdFx0XHRleHRlbmRDdHg6IGV4dGVuZEN0eCxcblx0XHRcdHN5bnRheEVyc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l0aG91dCB7eycgKyB0YWdOYW1lXG5cdFx0XHRcdFx0OiAnVW5tYXRjaGVkIG9yIG1pc3Npbmcge3svJyArIHRhZ05hbWUpICsgJywgaW4gdGVtcGxhdGU6XFxuJyArIG1hcmt1cCk7XG5cdFx0fVxuXHR9XG5cblx0ZnVuY3Rpb24gcGFyc2VUYWcoYWxsLCBiaW5kLCB0YWdOYW1lLCBjb252ZXJ0ZXIsIGNvbG9uLCBodG1sLCBjb2RlVGFnLCBwYXJhbXMsIHNsYXNoLCBiaW5kMiwgY2xvc2VCbG9jaywgaW5kZXgpIHtcbi8qXG5cbiAgICAgYmluZCAgICAgdGFnTmFtZSAgICAgICAgIGN2dCAgIGNsbiBodG1sIGNvZGUgICAgcGFyYW1zICAgICAgICAgICAgc2xhc2ggICBiaW5kMiAgICAgICAgIGNsb3NlQmxrICBjb21tZW50XG4vKD86eyhcXF4pP3soPzooXFx3Kyg/PVtcXC9cXHN9XSkpfChcXHcrKT8oOil8KD4pfChcXCopKVxccyooKD86W159XXx9KD8hfSkpKj8pKFxcLyk/fHsoXFxeKT97KD86KD86XFwvKFxcdyspKVxccyp8IS0tW1xcc1xcU10qPy0tKSl9fS9nXG5cbig/OlxuICB7KFxcXik/eyAgICAgICAgICAgIGJpbmRcbiAgKD86XG4gICAgKFxcdysgICAgICAgICAgICAgdGFnTmFtZVxuICAgICAgKD89W1xcL1xcc31dKVxuICAgIClcbiAgICB8XG4gICAgKFxcdyspPyg6KSAgICAgICAgY29udmVydGVyIGNvbG9uXG4gICAgfFxuICAgICg+KSAgICAgICAgICAgICAgaHRtbFxuICAgIHxcbiAgICAoXFwqKSAgICAgICAgICAgICBjb2RlVGFnXG4gIClcbiAgXFxzKlxuICAoICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgKD86W159XXx9KD8hfSkpKj9cbiAgKVxuICAoXFwvKT8gICAgICAgICAgICAgIHNsYXNoXG4gIHxcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kMlxuICA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ZXMvbmFtZS10ZW1wbGF0ZS5odG1sXCIsIG1rdXApXG4gIH07Il19 diff --git a/test/browserify/bundles/10-errors-bundle.js b/test/browserify/bundles/10-errors-bundle.js index a46b800..0d9e08e 100644 --- a/test/browserify/bundles/10-errors-bundle.js +++ b/test/browserify/bundles/10-errors-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o - close marker for view 2 and open marker for view 6 @@ -3014,8 +3115,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -3823,14 +3926,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -3856,8 +3962,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -4019,7 +4126,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -4073,7 +4194,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -4084,16 +4205,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -4177,7 +4297,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -4427,6 +4547,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -4565,16 +4686,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -14941,7 +15053,7 @@ return jQuery; })); },{}],4:[function(require,module,exports){ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -14987,7 +15099,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -15482,6 +15594,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -15930,6 +16043,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -16157,18 +16273,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -17737,20 +17888,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -17790,6 +17928,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -18025,4 +18178,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[5]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqcXVlcnkub2JzZXJ2YWJsZS5qcyIsImpxdWVyeS52aWV3cy5qcyIsIm5vZGVfbW9kdWxlcy9qUXVlcnkvZGlzdC9qcXVlcnkuanMiLCJub2RlX21vZHVsZXMvanNyZW5kZXIvanNyZW5kZXIuanMiLCJ0ZXN0L2Jyb3dzZXJpZnkvMTAtZXJyb3JzLXVuaXQtdGVzdHMuanMiLCJ0ZXN0L3RlbXBsYXRlcy9uYW1lLXRlbXBsYXRlLmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTt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uXHQkdmlld3MgPSB7XG5cdFx0anN2aWV3czogdmVyc2lvbk51bWJlcixcblx0XHRzdWI6IHtcblx0XHRcdC8vIHN1YnNjcmlwdGlvbiwgZS5nLiBKc1ZpZXdzIGludGVncmF0aW9uXG5cdFx0XHRyUGF0aDogL14oISo/KSg/Om51bGx8dHJ1ZXxmYWxzZXxcXGRbXFxkLl0qfChbXFx3JF0rfFxcLnx+KFtcXHckXSspfCModmlld3woW1xcdyRdKykpPykoW1xcdyQuXl0qPykoPzpbLlteXShbXFx3JF0rKVxcXT8pPykkL2csXG5cdFx0XHQvLyAgICAgICAgbm90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iamVjdCAgICAgaGVscGVyICAgIHZpZXcgIHZpZXdQcm9wZXJ0eSBwYXRoVG9rZW5zICAgICAgbGVhZlRva2VuXG5cblx0XHRcdHJQcm06IC8oXFwoKSg/PVxccypcXCgpfCg/OihbKFtdKVxccyopPyg/OihcXF4/KSh+P1tcXHckLl5dKyk/XFxzKigoXFwrXFwrfC0tKXxcXCt8LXx+KD8hW1xcdyRdKXwmJnxcXHxcXHx8PT09fCE9PXw9PXwhPXw8PXw+PXxbPD4lKjo/XFwvXXwoPSkpXFxzKnwoISo/KEApP1sjfl0/W1xcdyQuXl0rKShbKFtdKT8pfCgsXFxzKil8KFxcKD8pXFxcXD8oPzooJyl8KFwiKSl8KD86XFxzKigoWylcXF1dKSg/PVsuXl18XFxzKiR8W14oW10pfFspXFxdXSkoWyhbXT8pKXwoXFxzKykvZyxcblx0XHRcdC8vICAgbGZ0UHJuMCAgICAgICAgICAgbGZ0UHJuICAgICAgICAgYm91bmQgICAgIHBhdGggICAgICAgICAgICAgICBvcGVyYXRvciAgICAgZXJyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXEgICAgICBwYXRoMiBsYXRlICAgICAgICAgICAgcHJuICAgICAgY29tbWEgIGxmdFBybjIgICBhcG9zIHF1b3QgICAgICAgIHJ0UHJuIC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ZiBqUXVlcnkgaXMgbG9hZGVkLCBqc3JlbmRlci52aWV3cyBpZiBubyBqUXVlcnksIGUuZy4gaW4gTm9kZS5qcylcblx0JHZpZXdzID0ge1xuXHRcdGpzdmlld3M6IHZlcnNpb25OdW1iZXIsXG5cdFx0c3ViOiB7XG5cdFx0XHQvLyBzdWJzY3JpcHRpb24sIGUuZy4gSnNWaWV3cyBpbnRlZ3JhdGlvblxuXHRcdFx0clBhdGg6IC9eKCEqPykoPzpudWxsfHRydWV8ZmFsc2V8XFxkW1xcZC5dKnwoW1xcdyRdK3xcXC58fihbXFx3JF0rKXwjKHZpZXd8KFtcXHckXSspKT8pKFtcXHckLl5dKj8pKD86Wy5bXl0oW1xcdyRdKylcXF0/KT8pJC9nLFxuXHRcdFx0Ly8gICAgICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgICAgIGhlbHBlciAgICB2aWV3ICB2aWV3UHJvcGVydHkgcGF0aFRva2VucyAgICAgIGxlYWZUb2tlblxuXG5cdFx0XHRyUHJtOiAvKFxcKCkoPz1cXHMqXFwoKXwoPzooWyhbXSlcXHMqKT8oPzooXFxePykofj9bXFx3JC5eXSspP1xccyooKFxcK1xcK3wtLSl8XFwrfC18fig/IVtcXHckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfChcXCg/KVxcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcG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XG4gICAgcmV0dXJuICQudGVtcGxhdGVzKFwiLi90ZXN0L3RlbXBsYXRlcy9uYW1lLXRlbXBsYXRlLmh0bWxcIiwgbWt1cClcbiAgfTsiXX0= diff --git a/test/browserify/bundles/11-errors-bundle.js b/test/browserify/bundles/11-errors-bundle.js index 0342ba5..f2e0407 100644 --- a/test/browserify/bundles/11-errors-bundle.js +++ b/test/browserify/bundles/11-errors-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o - close marker for view 2 and open marker for view 6 @@ -1753,8 +1755,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -2562,14 +2566,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -2595,8 +2602,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -2758,7 +2766,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -2812,7 +2834,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -2823,16 +2845,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -2916,7 +2937,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -3166,6 +3187,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -3304,16 +3326,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -3864,7 +3877,7 @@ $viewsSettings.advanced({ }, window)); },{}],2:[function(require,module,exports){ -/*! jsviews.js v1.0.2 single-file version: http://jsviews.com/ */ +/*! jsviews.js v1.0.3 single-file version: http://jsviews.com/ */ /*! includes JsRender, JsObservable and JsViews - see: http://jsviews.com/#download */ /* Interactive data-driven views using JsRender templates */ @@ -3913,7 +3926,7 @@ if (!$ || !$.fn) { throw "JsViews requires jQuery"; // We require jQuery } -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $observe, $observable, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -4409,6 +4422,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -4857,6 +4871,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -5084,18 +5101,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -6664,20 +6716,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -6717,6 +6756,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -6793,6 +6847,7 @@ if (!$.observe) { observeInnerCbKey = 1, $data = $.data, remove = {}, // flag for removeProperty + asyncBatch = [], //========================== Top-level functions ========================== @@ -6939,13 +6994,12 @@ if (!$.observe) { function filterAndObserveAll(obj, prop, unobs, nestedArray) { var newObject, newParentObs; - if (prop !== $expando && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { + if ((+prop === prop || prop !== $expando) && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { newParentObs = nextParentObs.slice(); if (nestedArray && updatedTgt && newParentObs[0] !== updatedTgt) { newParentObs.unshift(updatedTgt); // For array change events when observing an array which is not the root, need to add updated array to parentObs } observeAll(namespace, newObject, cb, filter || (nestedArray ? undefined : 0), newParentObs, newAllPath, unobs, objMap); - // If nested array, need to observe the array too - so set filter to undefined } } @@ -7037,6 +7091,19 @@ if (!$.observe) { $unobserve = function() { [].push.call(arguments, true); // Add true as additional final argument return $observe.apply(undefined, arguments); + }, + + batchTrigger = function(async) { + var event, + batch = this.slice(); + this.length = 0; + this._go = 0; + while (event = batch.shift()) { + if (!event.skip) { + event[0]._trigger(event[1], event[2], true); + } + } + this.paths = {}; }; $observe = function() { @@ -7059,7 +7126,7 @@ if (!$.observe) { } function observeOnOff(cb, object, fullPath, namespace, pathStr, isArrayBinding, off) { - var j, evData, + var j, evData, dataOb, boundObOrArr = wrapArray(object), prntObs = parentObs, allPth = allPath; @@ -7114,10 +7181,9 @@ if (!$.observe) { }; } $(boundObOrArr).on(namespace, null, evData, onDataChange); - if (cbBindings) { // Add object to cbBindings - cbBindings[$data(object).obId || $data(object, "obId", observeObjKey++)] = object; + cbBindings[(dataOb = $data(object)).obId || (dataOb.obId = observeObjKey++)] = object; } } } @@ -7125,7 +7191,7 @@ if (!$.observe) { function bindArray(cb, arr, unbind, isArray, relPath) { if (allowArray) { // allowArray is 1 if this is a call to observe that does not come from observeAndBind (tag binding), or is from a 'depends' path, - // so we allow arrayChange binding. Otherwise allowArray is zero. + // or for a tag with tag.onArrayChange = true - so we allow arrayChange binding. Otherwise allowArray is zero. var object, prevAllPath = allPath; @@ -7202,7 +7268,7 @@ if (!$.observe) { // remove previous observeAll wrapped callback, if inner callback was the same; } - var arrIndex, skip, dep, obArr, prt, + var arrIndex, skip, dep, obArr, prt, fnProp, isGet, obj = object; if (object && object._cxp) { return observeObjectPaths(object[0], [object[1]], callback, contextCb); @@ -7213,6 +7279,10 @@ if (!$.observe) { if (prop === "") { continue; } + if (prop.slice(-2) === "()") { + prop = prop.slice(0, -2); + isGet = true; + } if ((prts.length < depth + 1) && !obj.nodeType) { // Add observer for each token in path starting at depth, and on to the leaf if (!unobserve && (events = $._data(obj).events)) { @@ -7225,6 +7295,7 @@ if (!$.observe) { && data.ns === initialNs && data.cb._cId === callback._cId && data.cb._inId === callback._inId + && !data._arOk === !allowArray && (data.prop === prop || data.prop === "*" || data.prop === "**")) { if (prt = prts.join(".")) { data.paths.push(prt); // We will skip this binding, but if it is not a leaf binding, @@ -7288,7 +7359,8 @@ if (!$.observe) { } } if ($isFunction(prop)) { - if (dep = prop.depends) { + fnProp = prop; + if (dep = fnProp.depends) { // This is a computed observable. We will observe any declared dependencies. if (obj._vw && obj._ocp) { // Observable contextual parameter, so context was ocp object. Now move context to view.data for dependencies @@ -7301,7 +7373,17 @@ if (!$.observe) { } observeObjects(concat.apply([], [[obj], dependsPaths(dep, obj, callback)])); } - break; + + if (isGet) { + if (!prts[0]) { + bindArray(callback, fnProp.call(obj), unobserve); + break; + } + prop = fnProp.call(obj); + if (!prop) { + break; + } + } } obj = prop; } @@ -7413,6 +7495,8 @@ if (!$.observe) { } } +//END OF FUNCTIONS + var ns = observeStr, paths = this != 1 // Using != for IE<10 bug- see jsviews/issues/237 ? concat.apply([], arguments) // Flatten the arguments - this is a 'recursive call' with params using the 'wrapped array' @@ -7421,7 +7505,6 @@ if (!$.observe) { lastArg = paths.pop() || false, m = paths.length; -//END OF FUNCTIONS if (lastArg + "" === lastArg) { // If last arg is a string then this observe call is part of an observeAll call, allPath = lastArg; // and the last three args are the parentObs array, the filter, and the allPath string. parentObs = paths.pop(); @@ -7484,9 +7567,10 @@ if (!$.observe) { } var initialNs, - allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind - doing binding of datalink expressions. We don't bind - // arrayChange events in this scenario. Instead, {^{for}} and similar do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. - // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug- see jsviews/issues/237 + allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind (doing binding of datalink expressions), + // and tag.onArrayChange is not set to true. We don't bind arrayChange events in this scenario. Instead, {^{for}} and similar + // do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. + // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug - see jsviews/issues/237 paths = slice.call(arguments), pth = paths[0]; @@ -7497,14 +7581,42 @@ if (!$.observe) { return innerObserve.apply(1, paths); }; - $observable = function(ns, data) { - if (arguments.length === 1) { + asyncBatch.wait = function() { + var batch = this; + batch._go = 1; + setTimeout(function() { + batch.trigger(true); + batch._go = 0; + batch.paths = {}; + }); + }; + + $observable = function(ns, data, delay) { + if (ns + "" !== ns) { + delay = data; data = ns; ns = ""; } - return $isArray(data) + delay = delay === undefined ? $subSettingsAdvanced.asyncObserve : delay; + var observable = $isArray(data) ? new ArrayObservable(ns, data) : new ObjectObservable(ns, data); + if (delay) { + if (delay === true) { + observable.async = true; + delay = asyncBatch; + } + if (!delay.trigger) { + if ($isArray(delay)) { + delay.trigger = batchTrigger; + delay.paths = {}; + } else { + delay = undefined; + } + } + observable._batch = delay; + } + return observable; }; //========================== Initialize ========================== @@ -7540,10 +7652,11 @@ if (!$.observe) { setProperty: function(path, value, nonStrict) { path = path || ""; - var key, pair, parts, + var key, pair, parts, tempBatch, multi = path + "" !== path, // Hash of paths self = this, - object = self._data; + object = self._data, + batch = self._batch; if (object) { if (multi) { @@ -7557,10 +7670,18 @@ if (!$.observe) { self.setProperty(pair.name, pair.value, nonStrict === undefined || nonStrict); //If nonStrict not specified, default to true; } } else { - // Object representation where property name is path and property value is value. - for (key in path) { + if (!batch) { + self._batch = tempBatch = []; + tempBatch.trigger = batchTrigger; + tempBatch.paths = {}; + } + for (key in path) { // Object representation where property name is path and property value is value. self.setProperty(key, path[key], nonStrict); } + if (tempBatch) { + self._batch.trigger(); + self._batch = undefined; + } } } else if (path !== $expando) { // Simple single property case. @@ -7623,8 +7744,24 @@ if (!$.observe) { } }, - _trigger: function(target, eventArgs) { - $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + _trigger: function(target, eventArgs, force) { + var key, batch, previous, + self = this; + if ($.hasData(target)) { + if (!force && (batch = self._batch)) { + if (self.async && !batch._go) { + batch.wait(); + } + batch.push([self, target, eventArgs]); + key = $data(target).obId + eventArgs.path; + if (previous = batch.paths[key]) { + batch[previous-1].skip = 1; + } + batch.paths[key] = batch.length; + } else { + $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } + } } }; @@ -7774,17 +7911,28 @@ if (!$.observe) { return self; }, - _trigger: function(eventArgs, oldLength) { - var self = this, - _data = self._data, - length = _data.length, - $_data = $([_data]); - if (self._srt) { - eventArgs.refresh = true; // We are sorting during refresh - } else if (length !== oldLength) { // We have finished sort operations during refresh - $_data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + _trigger: function(eventArgs, oldLength, force) { + var length, _data, batch, + self = this; + if ($.hasData(_data = self._data)) { + if (!force && (batch = self._batch)) { + eventArgs._dly = true; // Delayed event (async or batch change) + batch.push([self, eventArgs, oldLength]); + if (self.async && !batch._go) { + batch.wait(); + } + } else { + length = _data.length; + _data = $([_data]); + + if (self._srt) { + eventArgs.refresh = true; // We are sorting during refresh + } else if (length !== oldLength) { // We have finished sort operations during refresh + _data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + } + _data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } } - $_data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only } }; @@ -7935,8 +8083,9 @@ if (!$.observe) { }; $sub.advSet = function() { // refresh advanced settings + $subSettingsAdvanced = $subSettings.advanced; $sub._gccb = this._gccb; // getContextCallback method - global._jsv = $subSettings.advanced._jsv + global._jsv = $subSettingsAdvanced._jsv ? { // create global _jsv, for accessing views, etc cbBindings: cbBindingsStore } @@ -7945,6 +8094,10 @@ if (!$.observe) { $sub._dp = dependsPaths; $sub._gck = getCbKey; $sub._obs = $observe; + $subSettingsAdvanced = $subSettings.advanced = $subSettingsAdvanced || { + useViews: false, + _jsv: false // For global access to JsViews store + }; } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsViews >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -8039,7 +8192,7 @@ $observe = $observable.observe; // Event handlers //=============== -function updateValues(sourceValues, tagElse, bindId, ev) { +function updateValues(sourceValues, tagElse, async, bindId, ev) { // Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes // Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined // Called directly as tag.updateValues(val1, val2, val3, ...) - this: tag @@ -8142,7 +8295,7 @@ function updateValues(sourceValues, tagElse, bindId, ev) { exprOb = exprOb.sb; } } - $observable(target).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object + $observable(target, async).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object } } } @@ -8505,10 +8658,10 @@ function arrayChangeHandler(ev, eventArgs) { // array change handler for 'array' self._.srt = eventArgs.refresh; // true if part of a 'sort' on refresh switch (action) { case "insert": - self.addViews(index, items); + self.addViews(index, items, eventArgs._dly); break; case "remove": - self.removeViews(index, items.length); + self.removeViews(index, items.length, undefined, eventArgs._dly); break; case "move": self.moveViews(eventArgs.oldIndex, index, items.length); @@ -8702,6 +8855,7 @@ function addBindingMarkers(value, view, tag) { function observeAndBind(linkCtx, source, target) { var binding, l, k, linkedElem, exprFnDeps, exprOb, prop, propDeps, depends, tagDepends, bindId, linkedElems, tag = linkCtx.tag, + allowArray = !tag, cvtBk = linkCtx.convertBack, handler = linkCtx._hdl; source = typeof source === "object" && source; // If not an object set to false @@ -8747,6 +8901,7 @@ function observeAndBind(linkCtx, source, target) { } } } + allowArray = tag.onArrayChange === undefined || tag.onArrayChange === true; } l = exprFnDeps.length; @@ -8759,7 +8914,7 @@ function observeAndBind(linkCtx, source, target) { } } binding = $observable._apply( - 1, // Use as 'this' pointer - arbitrary + allowArray ? 0 : 1, // 'this' pointer for observeAndBind, used to set allowArray to 1 or 0. [source], exprFnDeps, // flatten the paths - to gather all the dependencies across args and bound params depends, @@ -9010,7 +9165,7 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont } } } - if (elCnt) { + if (elCnt && !inTag) { // elContent maps tagNames which have only element content, so may not support script nodes. // We are in element-only content, can remove white space, and use data-jsv attributes on elements as markers // Example: - close marker for view 2 and open marker for view 6 @@ -9629,8 +9784,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -10435,14 +10592,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -10468,8 +10628,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -10631,7 +10792,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -10685,7 +10860,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -10696,16 +10871,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -10789,7 +10963,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -11039,6 +11213,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -11177,16 +11352,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -21553,7 +21719,7 @@ return jQuery; })); },{}],4:[function(require,module,exports){ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -21599,7 +21765,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -22094,6 +22260,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -22542,6 +22709,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -22769,18 +22939,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -24349,20 +24554,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -24402,6 +24594,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -24533,4 +24740,4 @@ test('More Errors for require() for JsRender, JsViews, JsObservable, JsRender te }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../":2,"../../jquery.views":1,"jQuery":3,"jsrender":4}]},{},[5]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqcXVlcnkudmlld3MuanMiLCJqc3ZpZXdzLmpzIiwibm9kZV9tb2R1bGVzL2pRdWVyeS9kaXN0L2pxdWVyeS5qcyIsIm5vZGVfbW9kdWxlcy9qc3JlbmRlci9qc3JlbmRlci5qcyIsInRlc3QvYnJvd3NlcmlmeS8xMS1lcnJvcnMtdW5pdC10ZXN0cy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E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bCwgY29kZVRhZywgcGFyYW1zLCBzbGFzaCwgYmluZDIsIGNsb3NlQmxvY2ssIGluZGV4KSB7XG4vKlxuXG4gICAgIGJpbmQgICAgIHRhZ05hbWUgICAgICAgICBjdnQgICBjbG4gaHRtbCBjb2RlICAgIHBhcmFtcyAgICAgICAgICAgIHNsYXNoICAgYmluZDIgICAgICAgICBjbG9zZUJsayAgY29tbWVudFxuLyg/OnsoXFxeKT97KD86KFxcdysoPz1bXFwvXFxzfV0pKXwoXFx3Kyk/KDopfCg+KXwoXFwqKSlcXHMqKCg/OltefV18fSg/IX0pKSo/KShcXC8pP3x7KFxcXik/eyg/Oig/OlxcLyhcXHcrKSlcXHMqfCEtLVtcXHNcXFNdKj8tLSkpfX0vZ1xuXG4oPzpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogICBjbG9zZUJsb2NrXG4gICAgfFxuICAgICEtLVtcXHNcXFNdKj8tLSAgICBjb21tZW50XG4gIClcbilcbn19L2dcblxuKi9cblx0XHRpZiAoY29kZVRhZyAmJiBiaW5kIHx8IHNsYXNoICYmICF0YWdOYW1lIHx8IHBhcmFtcyAmJiBwYXJhbXMuc2xpY2UoLTEpID09PSBcIjpcIiB8fC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wgdW5kZWZpbmVkLCBodG1sLCB1bmRlZmluZWQsIHVuZGVmaW5lZCwgMSk7XG4vL1x0XHR9XG4vL1x0XHRjYXRjaCAoZSkge1xuLy9cdFx0XHRyZXR1cm4gZS5tZXNzYWdlO1xuLy9cdFx0fVxuLy9cdH1cbi8vfTtcblxuLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09XG4vLyBFeHRlbmQgalF1ZXJ5IGluc3RhbmNlIHBsdWdpbnNcbi8vPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG4kZXh0ZW5kKCQuZm4sIHtcblx0bGluazogZnVuY3Rpb24oZXhwciwgZnJvbSwgY29udGV4dCwgbm9JdGVyYXRpb24sIHBhcmVudFZpZXcsIHByZXZOb2RlLCBuZXh0Tm9kZSkge1xuXHRcdHJldHVybiAkbGluayhleHByLCB0aGlzLCBmcm9tLCBjb250ZXh0LCBub0l0ZXJhdGlvbiwgcGFyZW50VmlldywgcHJldk5vZGUsIG5leHROb2RlKTtcblx0fSxcblx0dW5saW5rOiBmdW5jdGlvbigpIHtcblx0XHRyZXR1cm4gJHVubGluayh0aGlzKTtcblx0fSxcblx0dmlldzogZnVuY3Rpb24oaW5uZXIsIHR5cGUpIHtcblx0XHRyZXR1cm4gJHZpZXcodGhpc1swXSwgaW5uZXIsIHR5cGUpO1xuXHR9XG59KTtcblxuLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cbi8vIE92ZXJyaWRlIGpRdWVyeSBtZXRob2RzIHRoYXQgY2FsbCBvdXIgb3ZlcnJpZGRlbiBjbGVhbkRhdGEsIGZvciBkaXNwb3NhbCBldGMuXG4vLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuXG4kLmVhY2goW0hUTUwsIFwicmVwbGFjZVdpdGhcIiwgXCJlbX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zLCBzbGFzaCwgYmluZDIsIGNsb3NlQmxvY2ssIGluZGV4KSB7XG4vKlxuXG4gICAgIGJpbmQgICAgIHRhZ05hbWUgICAgICAgICBjdnQgICBjbG4gaHRtbCBjb2RlICAgIHBhcmFtcyAgICAgICAgICAgIHNsYXNoICAgYmluZDIgICAgICAgICBjbG9zZUJsayAgY29tbWVudFxuLyg/OnsoXFxeKT97KD86KFxcdysoPz1bXFwvXFxzfV0pKXwoXFx3Kyk/KDopfCg+KXwoXFwqKSlcXHMqKCg/OltefV18fSg/IX0pKSo/KShcXC8pP3x7KFxcXik/eyg/Oig/OlxcLyhcXHcrKSlcXHMqfCEtLVtcXHNcXFNdKj8tLSkpfX0vZ1xuXG4oPzpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogICBjbG9zZUJsb2NrXG4gICAgfFxuICAgICEtLVtcXHNcXFNdKj8tLSAgICBjb21tZW50XG4gIClcbilcbn19L2dcblxuKi9cblx0XHRpZiAoY29kZVRhZyAmJiBiaW5kIHx8IHNsYXNoICYmICF0YWdOYW1lIHx8IHBhcmFtcyAmJiBwYXJhbXMuc2xpY2UoLTEpID09PSBcIjpcIiB8fCBiaW5kMikge1xuXHRcdFx0c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XG5cdH1cblxuXHQvLyAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uIEFzc2VydCAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi5cblx0ZXF1YWwocmVzdWx0LCBcIkpzVmlld3MgcmVxdWlyZXMgalF1ZXJ5XCIsICdyZXF1aXJlKFwianN2aWV3c1wiKShqUXVlcnkpIHRocm93cyBcIkpzVmlld3MgcmVxdWlyZXMgalF1ZXJ5XCInKTtcblxuXHQvLyAuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uIFJlc2V0IC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLlxuXHRnbG9iYWwualF1ZXJ5ID0galF1ZXJ5OyAvLyBSZXBsYWNlIFFVbml0IGdsb2JhbCBqUXVlcnlcblx0Z2xvYmFsLmpzcmVuZGVyID0ganNyOyAvLyBSZXBsYWNlIGFueSBwcmV2aW91cyBnbG9iYWwganNyZW5kZXJcbn0pO1xufVxufSkoKTtcbiJdfQ== diff --git a/test/browserify/bundles/12-nested-bundle.js b/test/browserify/bundles/12-nested-bundle.js index a1051a7..b5a2871 100644 --- a/test/browserify/bundles/12-nested-bundle.js +++ b/test/browserify/bundles/12-nested-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -2795,20 +2834,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -2848,6 +2874,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -2974,4 +3015,4 @@ module.exports = $ ? $.templates("./test/templates/outer.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./inner.html":3}]},{},[2]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvanNyZW5kZXIvanNyZW5kZXIuanMiLCJ0ZXN0L2Jyb3dzZXJpZnkvMTItbmVzdGVkLXVuaXQtdGVzdHMuanM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Ly8gICAgICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgICAgIGhlbHBlciAgICB2aWV3ICB2aWV3UHJvcGVydHkgcGF0aFRva2VucyAgICAgIGxlYWZUb2tlblxuXG5cdFx0XHRyUHJtOiAvKFxcKCkoPz1cXHMqXFwoKXwoPzooWyhbXSlcXHMqKT8oPzooXFxePykofj9bXFx3JC5eXSspP1xccyooKFxcK1xcK3wtLSl8XFwrfC18fig/IVtcXHckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfChcXCg/KVxcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcGF0aDIgbGF0ZSAgICAgICAgICAgIHBybiAgICAgIGNvbW1hICBsZnRQcm4yICAgYXBvcyBxdW90ICAgICAgICBydFBybiAgcnRQcm5Eb3QgICAgICAgICAgICAgICAgICBwcm4yICAgICBzcGFjZVxuXG5cdFx0XHRWaWV3OiBWaWV3LFxuXHRcdFx0RXJyOiBKc1ZpZXdzRXJyb3IsXG5cdFx0XHR0bXBsRm46IHRtcGxGbixcblx0XHRcdHBhcnNlOiBwYXJzZVBhcmFtcyxcblx0XHRcdGV4dGVuZDogJGV4dGVuZCxcblx0XHRcdGV4dGVuZEN0eDogZXh0ZW5kQ3R4LFxuXHRcdFx0c3ludGF4RXJyOiBzeW50YXhFcnJvcixcblx0XHRcdG9uU3RvcmU6IHtcblx0XHRcdF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ckXSt8XFwufH4oW1xcdyRdKyl8Iyh2aWV3fChbXFx3JF0rKSk/KShbXFx3JC5eXSo/KSg/OlsuW15dKFtcXHckXSspXFxdPyk/KSQvZyxcblx0XHRcdC8vICAgICAgICBub3QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0ICAgICBoZWxwZXIgICAgdmlldyAgdmlld1Byb3BlcnR5IHBhdGhUb2tlbnMgICAgICBsZWFmVG9rZW5cblxuXHRcdFx0clBybTogLyhcXCgpKD89XFxzKlxcKCl8KD86KFsoW10pXFxzKik/KD86KFxcXj8pKH4/W1xcdyQuXl0rKT9cXHMqKChcXCtcXCt8LS0pfFxcK3wtfH4oPyFbXFx3JF0pfCYmfFxcfFxcfHw9PT18IT09fD09fCE9fDw9fD49fFs8PiUqOj9cXC9dfCg9KSlcXHMqfCghKj8oQCk/WyN+XT9bXFx3JC5eXSspKFsoW10pPyl8KCxcXHMqKXwoXFwoPylcXFxcPyg/OignKXwoXCIpKXwoPzpcXHMqKChbKVxcXV0pKD89Wy5eXXxcXHMqJHxbXihbXSl8WylcXF1dKShbKFtdPykpfChcXHMrKS9nLFxuXHRcdFx0Ly8gICBsZnRQcm4wICAgICAgICAgICBsZnRQcm4gICAgICAgICBib3VuZCAgICAgcGF0aCAgICAgICAgICAgICAgIG9wZXJhdG9yICAgICBlcnIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlcSAgICAgIHBhdGgyIGxhdGUgICAgICAgICAgICBwcm4gICAgICBjb21tYSAgbGZ0UHJuMiAgIGFwb3MgcXVvdCAgICAgICAgcnRQcm4gIHJ0UHJuRG90ICAgICAgICAgICAgICAgICAgcHJuMiAgICAgc3BhY2VcblxuXHRcdFx0VmlldzogVmlldyxcblx0XHRcdEVycjogSnNWaWV3c0Vycm9yLFxuXHRcdFx0dG1wbEZuOiB0bXBsRm4sXG5cdFx0XHRwYXJzZTogcGFyc2VQYXJhbXMsXG5cdFx0XHRleHRlbmQ6ICR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WxlIG5lc3RlZCB0ZW1wbGF0ZVxuICAgIH1cblxuICAgIHJldHVybiAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvaW5uZXIuaHRtbFwiLCBta3VwKVxuICB9OyIsInZhciB0bXBsUmVmcyA9IFtdLFxuICBta3VwID0gJ05hbWU6IHt7Om5hbWV9fSAob3V0ZXIuaHRtbCkge3tpbmNsdWRlIHRtcGw9XFxcIi4vdGVzdC90ZW1wbGF0ZXMvaW5uZXIuaHRtbFxcXCIvfX0nLFxuICAkID0gZ2xvYmFsLmpzcmVuZGVyIHx8IGdsb2JhbC5qUXVlcnk7XG5cbnRtcGxSZWZzLnB1c2gocmVxdWlyZShcIi4vaW5uZXIuaHRtbFwiKSk7XG5tb2R1bGUuZXhwb3J0cyA9ICQgPyAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvb3V0ZXIuaHRtbFwiLCBta3VwKSA6XG4gIGZ1bmN0aW9uKCQpIHtcbiAgICBpZiAoISQgfHwgISQudmlld3MpIHt0aHJvdyBcIlJlcXVpcmVzIGpzcmVuZGVyL2pRdWVyeVwiO31cbiAgICB3aGlsZSAodG1wbFJlZnMubGVuZ3RoKSB7XG4gICAgICB0bXBsUmVmcy5wb3AoKSgkKTsgLy8gY29tcGlsZSBuZXN0ZWQgdGVtcGxhdGVcbiAgICB9XG5cbiAgICByZXR1cm4gJC50ZW1wbGF0ZXMoXCIuL3Rlc3QvdGVtcGxhdGVzL291dGVyLmh0bWxcIiwgbWt1cClcbiAgfTsiXX0= diff --git a/test/browserify/bundles/2-bundle.js b/test/browserify/bundles/2-bundle.js index 0afdccd..7cb33a2 100644 --- a/test/browserify/bundles/2-bundle.js +++ b/test/browserify/bundles/2-bundle.js @@ -9815,7 +9815,7 @@ return jQuery; })); },{}],2:[function(require,module,exports){ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -9861,7 +9861,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -10356,6 +10356,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -10804,6 +10805,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -11031,18 +11035,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -12611,20 +12650,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -12664,6 +12690,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -12773,4 +12814,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[3]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvanF1ZXJ5L2Rpc3QvanF1ZXJ5LmpzIiwibm9kZV9tb2R1bGVzL2pzcmVuZGVyL2pzcmVuZGVyLmpzIiwidGVzdC9icm93c2VyaWZ5LzItdW5pdC10ZXN0cy5qcyIsInRlc3QvdGVtcGxhdGVzL25hbWUtdGVtcGxhdGUuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQ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zaCwgYmluZDIsIGNsb3NlQmxvY2ssIGluZGV4KSB7XG4vKlxuXG4gICAgIGJpbmQgICAgIHRhZ05hbWUgICAgICAgICBjdnQgICBjbG4gaHRtbCBjb2RlICAgIHBhcmFtcyAgICAgICAgICAgIHNsYXNoICAgYmluZDIgICAgICAgICBjbG9zZUJsayAgY29tbWVudFxuLyg/OnsoXFxeKT97KD86KFxcdysoPz1bXFwvXFxzfV0pKXwoXFx3Kyk/KDopfCg+KXwoXFwqKSlcXHMqKCg/OltefV18fSg/IX0pKSo/KShcXC8pP3x7KFxcXik/eyg/Oig/OlxcLyhcXHcrKSlcXHMqfCEtLVtcXHNcXFNdKj8tLSkpfX0vZ1xuXG4oPzpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogICBjbG9zZUJsb2NrXG4gICAgfFxuICAgICEtLVtcXHNcXFNdKj8tLSAgICBjb21tZW50XG4gIClcbilcbn19L2dcblxuKi9cblx0XHRpZiAoY29kZVRhZyAmJiBiaW5kIHx8IHNsYXNoICYmICF0YWdOYW1lIHx8IHBhcmFtcyAmJiBwYXJhbXMuc2xpY2UoLTEpID09PSBcIjpcIiB8fCBiaW5kMikge1xuXHRcdFx0c3ludGF4RX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uanNyZW5kZXIgPSBqc3I7IC8vIFJlcGxhY2UgYW55IHByZXZpb3VzIGdsb2JhbCBqc3JlbmRlclxufSk7XG59XG59KSgpO1xuIiwidmFyIHRtcGxSZWZzID0gW10sXG4gIG1rdXAgPSAnTmFtZToge3s6bmFtZX19IChuYW1lLXRlbXBsYXRlLmh0bWwpJyxcbiAgJCA9IGdsb2JhbC5qc3JlbmRlciB8fCBnbG9iYWwualF1ZXJ5O1xuXG5tb2R1bGUuZXhwb3J0cyA9ICQgPyAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sXCIsIG1rdXApIDpcbiAgZnVuY3Rpb24oJCkge1xuICAgIGlmICghJCB8fCAhJC52aWV3cykge3Rocm93IFwiUmVxdWlyZXMganNyZW5kZXIvalF1ZXJ5XCI7fVxuICAgIHdoaWxlICh0bXBsUmVmcy5sZW5ndGgpIHtcbiAgICAgIHRtcGxSZWZzLnBvcCgpKCQpOyAvLyBjb21waWxlIG5lc3RlZCB0ZW1wbGF0ZVxuICAgIH1cblxuICAgIHJldHVybiAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sXCIsIG1rdXApXG4gIH07Il19 diff --git a/test/browserify/bundles/3-bundle.js b/test/browserify/bundles/3-bundle.js index 53f3d1b..251a6b4 100644 --- a/test/browserify/bundles/3-bundle.js +++ b/test/browserify/bundles/3-bundle.js @@ -9815,7 +9815,7 @@ return jQuery; })); },{}],2:[function(require,module,exports){ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -9861,7 +9861,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -10356,6 +10356,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -10804,6 +10805,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -11031,18 +11035,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -12611,20 +12650,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -12664,6 +12690,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -12773,4 +12814,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[3]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvanF1ZXJ5L2Rpc3QvanF1ZXJ5LmpzIiwibm9kZV9tb2R1bGVzL2pzcmVuZGVyL2pzcmVuZGVyLmpzIiwidGVzdC9icm93c2VyaWZ5LzMtdW5pdC10ZXN0cy5qcyIsInRlc3QvdGVtcGxhdGVzL25hbWUtdGVtcGxhdGUuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7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ICsgJyB3aXRob3V0IHt7JyArIHRhZ05hbWVcblx0XHRcdFx0XHQ6ICdVbm1hdGNoZWQgb3IgbWlzc2luZyB7ey8nICsgdGFnTmFtZSkgKyAnLCBpbiB0ZW1wbGF0ZTpcXG4nICsgbWFya3VwKTtcblx0XHR9XG5cdH1cblxuXHRmdW5jdGlvbiBwYXJzZVRhZyhhbGwsIGJpbmQsIHRhZ05hbWUsIGNvbnZlcnRlciwgY29sb24sIGh0bWwsIGNvZGVUYWcsIHBhcmFtcywgc2xhc2gsIGJpbmQyLCBjbG9zZUJsb2NrLCBpbmRleCkge1xuLypcblxuICAgICBiaW5kICAgICB0YWdOYW1lICAgICAgICAgY3Z0ICAgY2xuIGh0bWwgY29kZSAgICBwYXJhbXMgICAgICAgICAgICBzbGFzaCAgIGJpbmQyICAgICAgICAgY2xvc2VCbGsgIGNvbW1lbnRcbi8oPzp7KFxcXik/eyg/OihcXHcrKD89W1xcL1xcc31dKSl8KFxcdyspPyg6KXwoPil8KFxcKikpXFxzKigoPzpbXn1dfH0oPyF9KSkqPykoXFwvKT98eyhcXF4pP3soPzooPzpcXC8oXFx3KykpXFxzKnwhLS1bXFxzXFxTXSo/LS0pKX19L2dcblxuKD86XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZFxuICAoPzpcbiAgICAoXFx3KyAgICAgICAgICAgICB0YWdOYW1lXG4gICAgICAoPz1bXFwvXFxzfV0pXG4gICAgKVxuICAgIHxcbiAgICAoXFx3Kyk/KDopICAgICAgICBjb252ZXJ0ZXIgY29sb25cbiAgICB8XG4gICAgKD4pICAgICAgICAgICAgICBodG1sXG4gICAgfFxuICAgIChcXCopICAgICAgICAgICAgIGNvZGVUYWdcbiAgKVxuICBcXHMqXG4gICggICAgICAgICAgICAgICAgICBwYXJhbXNcbiAgICAoPzpbXn1dfH0oPyF9KSkqP1xuICApXG4gIChcXC8pPyAgICAgICAgICAgICAgc2xhc2hcbiAgfFxuICB7KFxcXik/eyAgICAgICAgICAgIGJp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FtcyAgICAgICAgICAgIHNsYXNoICAgYmluZDIgICAgICAgICBjbG9zZUJsayAgY29tbWVudFxuLyg/OnsoXFxeKT97KD86KFxcdysoPz1bXFwvXFxzfV0pKXwoXFx3Kyk/KDopfCg+KXwoXFwqKSlcXHMqKCg/OltefV18fSg/IX0pKSo/KShcXC8pP3x7KFxcXik/eyg/Oig/OlxcLyhcXHcrKSlcXHMqfCEtLVtcXHNcXFNdKj8tLSkpfX0vZ1xuXG4oPzpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogICBjbG9zZUJsb2NrXG4gICAgfFxuICAgICEtLVtcXHNcXFNdKj8tLSAgICBjb21tZW50XG4gIClcbilcbn19L2dcblxuKi9cblx0XHRpZiAoY29kZVRhZyAmJiBiaW5kIHx8IHNsYXNoICYmICF0YWdOYW1lIHx8IHBhcmFtcyAmJiBwYXJhbXMuc2xpY2UoLTEpID09PSBcIjpcIiB8fCBiaW5kMikge1xuXHRcdFx0c3ludGF4RXJyb3IoYWxsKTtcblx0XHR9XG5cblx0XHQvLyBCdWlsZCBhYnN0cmFjdCBzeW50YXggdHJlZSAoQVNUKTogW3RhZ05hbWUsIGNvbnZlcnRlciwgcGFyYW1zLCBjb250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W55IHByZXZpb3VzIGdsb2JhbCBqc3JlbmRlclxufSk7XG59XG59KSgpO1xuIiwidmFyIHRtcGxSZWZzID0gW10sXG4gIG1rdXAgPSAnTmFtZToge3s6bmFtZX19IChuYW1lLXRlbXBsYXRlLmh0bWwpJyxcbiAgJCA9IGdsb2JhbC5qc3JlbmRlciB8fCBnbG9iYWwualF1ZXJ5O1xuXG5tb2R1bGUuZXhwb3J0cyA9ICQgPyAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sXCIsIG1rdXApIDpcbiAgZnVuY3Rpb24oJCkge1xuICAgIGlmICghJCB8fCAhJC52aWV3cykge3Rocm93IFwiUmVxdWlyZXMganNyZW5kZXIvalF1ZXJ5XCI7fVxuICAgIHdoaWxlICh0bXBsUmVmcy5sZW5ndGgpIHtcbiAgICAgIHRtcGxSZWZzLnBvcCgpKCQpOyAvLyBjb21waWxlIG5lc3RlZCB0ZW1wbGF0ZVxuICAgIH1cblxuICAgIHJldHVybiAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sXCIsIG1rdXApXG4gIH07Il19 diff --git a/test/browserify/bundles/4-bundle.js b/test/browserify/bundles/4-bundle.js index e5811a5..75b0448 100644 --- a/test/browserify/bundles/4-bundle.js +++ b/test/browserify/bundles/4-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o - close marker for view 2 and open marker for view 6 @@ -3014,8 +3115,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -3823,14 +3926,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -3856,8 +3962,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -4019,7 +4126,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -4073,7 +4194,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -4084,16 +4205,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -4177,7 +4297,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -4427,6 +4547,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -4565,16 +4686,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -14941,7 +15053,7 @@ return jQuery; })); },{}],4:[function(require,module,exports){ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -14987,7 +15099,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -15482,6 +15594,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -15930,6 +16043,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -16157,18 +16273,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -17737,20 +17888,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -17790,6 +17928,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -17906,4 +18059,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[5]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqcXVlcnkub2JzZXJ2YWJsZS5qcyIsImpxdWVyeS52aWV3cy5qcyIsIm5vZGVfbW9kdWxlcy9qcXVlcnkvZGlzdC9qcXVlcnkuanMiLCJub2RlX21vZHVsZXMvanNyZW5kZXIvanNyZW5kZXIuanMiLCJ0ZXN0L2Jyb3dzZXJpZnkvNi11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zY3JpcHRpb24sIGUuZy4gSnNWaWV3cyBpbnRlZ3JhdGlvblxuXHRcdFx0clBhdGg6IC9eKCEqPykoPzpudWxsfHRydWV8ZmFsc2V8XFxkW1xcZC5dKnwoW1xcdyRdK3xcXC58fihbXFx3JF0rKXwjKHZpZXd8KFtcXHckXSspKT8pKFtcXHckLl5dKj8pKD86Wy5bXl0oW1xcdyRdKylcXF0/KT8pJC9nLFxuXHRcdFx0Ly8gICAgICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgICAgIGhlbHBlciAgICB2aWV3ICB2aWV3UHJvcGVydHkgcGF0aFRva2VucyAgICAgIGxlYWZUb2tlblxuXG5cdFx0XHRyUHJtOiAvKFxcKCkoPz1cXHMqXFwoKXwoPzooWyhbXSlcXHMqKT8oPzooXFxePykofj9bXFx3JC5eXSspP1xccyooKFxcK1xcK3wtLSl8XFwrfC18fig/IVtcXHckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfChcXCg/KVxcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcGF0aDIgbGF0ZSAgICAgICAgICAgIHBybiAgICAgIGNvbW1hICBsZnRQcm4yICAgYXBvcyBxdW90ICAgICAgICBydFBybiAgcnRQcm5Eb3QgICAgICAgICAgICAgICAgICBwcm4yICAgICBzcGFjZVxuXG5cdFx0XHRWaWV3OiBWaWV3LFxuXHRcdFx0RX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i4uLi4uLi4uLi4uLi4uLi4uLi4uIFJlc2V0IC4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLlxuXHRnbG9iYWwualF1ZXJ5ID0galF1ZXJ5OyAvLyBSZXBsYWNlIFFVbml0IGdsb2JhbCBqUXVlcnlcblx0Z2xvYmFsLmpzcmVuZGVyID0ganNyOyAvLyBSZXBsYWNlIGFueSBwcmV2aW91cyBnbG9iYWwganNyZW5kZXJcbn0pO1xufVxufSkoKTtcbiIsInZhciB0bXBsUmVmcyA9IFtdLFxuICBta3VwID0gJ05hbWU6IHt7Om5hbWV9fSAobmFtZS10ZW1wbGF0ZS5odG1sKScsXG4gICQgPSBnbG9iYWwuanNyZW5kZXIgfHwgZ2xvYmFsLmpRdWVyeTtcblxubW9kdWxlLmV4cG9ydHMgPSAkID8gJC50ZW1wbGF0ZXMoXCIuL3Rlc3QvdGVtcGxhdGVzL25hbWUtdGVtcGxhdGUuaHRtbFwiLCBta3VwKSA6XG4gIGZ1bmN0aW9uKCQpIHtcbiAgICBpZiAoISQgfHwgISQudmlld3MpIHt0aHJvdyBcIlJlcXVpcmVzIGpzcmVuZGVyL2pRdWVyeVwiO31cbiAgICB3aGlsZSAodG1wbFJlZnMubGVuZ3RoKSB7XG4gICAgICB0bXBsUmVmcy5wb3AoKSgkKTsgLy8gY29tcGlsZSBuZXN0ZWQgdGVtcGxhdGVcbiAgICB9XG5cbiAgICByZXR1cm4gJC50ZW1wbGF0ZXMoXCIuL3Rlc3QvdGVtcGxhdGVzL25hbWUtdGVtcGxhdGUuaHRtbFwiLCBta3VwKVxuICB9OyJdfQ== diff --git a/test/browserify/bundles/7-bundle.js b/test/browserify/bundles/7-bundle.js index 42b2e1f..ba52a10 100644 --- a/test/browserify/bundles/7-bundle.js +++ b/test/browserify/bundles/7-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o - close marker for view 2 and open marker for view 6 @@ -3014,8 +3115,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -3823,14 +3926,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -3856,8 +3962,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -4019,7 +4126,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -4073,7 +4194,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -4084,16 +4205,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -4177,7 +4297,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -4427,6 +4547,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -4565,16 +4686,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -14941,7 +15053,7 @@ return jQuery; })); },{}],4:[function(require,module,exports){ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -14987,7 +15099,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -15482,6 +15594,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -15930,6 +16043,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -16157,18 +16273,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -17737,20 +17888,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -17790,6 +17928,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -17906,4 +18059,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[5]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfb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0XHRcdC8vIHN1YnNjcmlwdGlvbiwgZS5nLiBKc1ZpZXdzIGludGVncmF0aW9uXG5cdFx0XHRyUGF0aDogL14oISo/KSg/Om51bGx8dHJ1ZXxmYWxzZXxcXGRbXFxkLl0qfChbXFx3JF0rfFxcLnx+KFtcXHckXSspfCModmlld3woW1xcdyRdKykpPykoW1xcdyQuXl0qPykoPzpbLlteXShbXFx3JF0rKVxcXT8pPykkL2csXG5cdFx0XHQvLyAgICAgICAgbm90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iamVjdCAgICAgaGVscGVyICAgIHZpZXcgIHZpZXdQcm9wZXJ0eSBwYXRoVG9rZW5zICAgICAgbGVhZlRva2VuXG5cblx0XHRcdHJQcm06IC8oXFwoKSg/PVxccypcXCgpfCg/OihbKFtdKVxccyopPyg/OihcXF4/KSh+P1tcXHckLl5dKyk/XFxzKigoXFwrXFwrfC0tKXxcXCt8LXx+KD8hW1xcdyRdKXwmJnxcXHxcXHx8PT09fCE9PXw9PXwhPXw8PXw+PXxbPD4lKjo/XFwvXXwoPSkpXFxzKnwoISo/KEApP1sjfl0/W1xcdyQuXl0rKShbKFtdKT8pfCgsXFxzKil8KFxcKD8pXFxcXD8oPzooJyl8KFwiKSl8KD86XFxzKigoWylcXF1dKSg/PVsuXl18XFxzKiR8W14oW10pfFspXFxdXSkoWyhbXT8pKXwoXFxzKykvZyxcblx0XHRcdC8vICAgbGZ0UHJuMCAgICAgICAgICAgbGZ0UHJuICAgICAgICAgYm91bmQgICAgIHBhdGggICAgICAgICAgICAgICBvcGVyYXRvciAgICAgZXJyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXEgICAgICBwYXRoMiBsYXRlICAgICAgICAgICAgcHJuICAgICAgY29tbWEgIGxmdFBybjIgICBhcG9zIHF1b3QgICAgICAgIHJ0UHJuICBydFBybkRvdCAgICAgICAgICAgICAgICAgIHBybjIgICAgIHNwYWNlXG5cblx0XHRcdFZpZXc6IFZp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a/test/browserify/bundles/8-bundle.js +++ b/test/browserify/bundles/8-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -2799,20 +2838,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -2852,6 +2878,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -2928,6 +2969,7 @@ if (!$.observe) { observeInnerCbKey = 1, $data = $.data, remove = {}, // flag for removeProperty + asyncBatch = [], //========================== Top-level functions ========================== @@ -3074,13 +3116,12 @@ if (!$.observe) { function filterAndObserveAll(obj, prop, unobs, nestedArray) { var newObject, newParentObs; - if (prop !== $expando && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { + if ((+prop === prop || prop !== $expando) && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { newParentObs = nextParentObs.slice(); if (nestedArray && updatedTgt && newParentObs[0] !== updatedTgt) { newParentObs.unshift(updatedTgt); // For array change events when observing an array which is not the root, need to add updated array to parentObs } observeAll(namespace, newObject, cb, filter || (nestedArray ? undefined : 0), newParentObs, newAllPath, unobs, objMap); - // If nested array, need to observe the array too - so set filter to undefined } } @@ -3172,6 +3213,19 @@ if (!$.observe) { $unobserve = function() { [].push.call(arguments, true); // Add true as additional final argument return $observe.apply(undefined, arguments); + }, + + batchTrigger = function(async) { + var event, + batch = this.slice(); + this.length = 0; + this._go = 0; + while (event = batch.shift()) { + if (!event.skip) { + event[0]._trigger(event[1], event[2], true); + } + } + this.paths = {}; }; $observe = function() { @@ -3194,7 +3248,7 @@ if (!$.observe) { } function observeOnOff(cb, object, fullPath, namespace, pathStr, isArrayBinding, off) { - var j, evData, + var j, evData, dataOb, boundObOrArr = wrapArray(object), prntObs = parentObs, allPth = allPath; @@ -3249,10 +3303,9 @@ if (!$.observe) { }; } $(boundObOrArr).on(namespace, null, evData, onDataChange); - if (cbBindings) { // Add object to cbBindings - cbBindings[$data(object).obId || $data(object, "obId", observeObjKey++)] = object; + cbBindings[(dataOb = $data(object)).obId || (dataOb.obId = observeObjKey++)] = object; } } } @@ -3260,7 +3313,7 @@ if (!$.observe) { function bindArray(cb, arr, unbind, isArray, relPath) { if (allowArray) { // allowArray is 1 if this is a call to observe that does not come from observeAndBind (tag binding), or is from a 'depends' path, - // so we allow arrayChange binding. Otherwise allowArray is zero. + // or for a tag with tag.onArrayChange = true - so we allow arrayChange binding. Otherwise allowArray is zero. var object, prevAllPath = allPath; @@ -3337,7 +3390,7 @@ if (!$.observe) { // remove previous observeAll wrapped callback, if inner callback was the same; } - var arrIndex, skip, dep, obArr, prt, + var arrIndex, skip, dep, obArr, prt, fnProp, isGet, obj = object; if (object && object._cxp) { return observeObjectPaths(object[0], [object[1]], callback, contextCb); @@ -3348,6 +3401,10 @@ if (!$.observe) { if (prop === "") { continue; } + if (prop.slice(-2) === "()") { + prop = prop.slice(0, -2); + isGet = true; + } if ((prts.length < depth + 1) && !obj.nodeType) { // Add observer for each token in path starting at depth, and on to the leaf if (!unobserve && (events = $._data(obj).events)) { @@ -3360,6 +3417,7 @@ if (!$.observe) { && data.ns === initialNs && data.cb._cId === callback._cId && data.cb._inId === callback._inId + && !data._arOk === !allowArray && (data.prop === prop || data.prop === "*" || data.prop === "**")) { if (prt = prts.join(".")) { data.paths.push(prt); // We will skip this binding, but if it is not a leaf binding, @@ -3423,7 +3481,8 @@ if (!$.observe) { } } if ($isFunction(prop)) { - if (dep = prop.depends) { + fnProp = prop; + if (dep = fnProp.depends) { // This is a computed observable. We will observe any declared dependencies. if (obj._vw && obj._ocp) { // Observable contextual parameter, so context was ocp object. Now move context to view.data for dependencies @@ -3436,7 +3495,17 @@ if (!$.observe) { } observeObjects(concat.apply([], [[obj], dependsPaths(dep, obj, callback)])); } - break; + + if (isGet) { + if (!prts[0]) { + bindArray(callback, fnProp.call(obj), unobserve); + break; + } + prop = fnProp.call(obj); + if (!prop) { + break; + } + } } obj = prop; } @@ -3548,6 +3617,8 @@ if (!$.observe) { } } +//END OF FUNCTIONS + var ns = observeStr, paths = this != 1 // Using != for IE<10 bug- see jsviews/issues/237 ? concat.apply([], arguments) // Flatten the arguments - this is a 'recursive call' with params using the 'wrapped array' @@ -3556,7 +3627,6 @@ if (!$.observe) { lastArg = paths.pop() || false, m = paths.length; -//END OF FUNCTIONS if (lastArg + "" === lastArg) { // If last arg is a string then this observe call is part of an observeAll call, allPath = lastArg; // and the last three args are the parentObs array, the filter, and the allPath string. parentObs = paths.pop(); @@ -3619,9 +3689,10 @@ if (!$.observe) { } var initialNs, - allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind - doing binding of datalink expressions. We don't bind - // arrayChange events in this scenario. Instead, {^{for}} and similar do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. - // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug- see jsviews/issues/237 + allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind (doing binding of datalink expressions), + // and tag.onArrayChange is not set to true. We don't bind arrayChange events in this scenario. Instead, {^{for}} and similar + // do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. + // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug - see jsviews/issues/237 paths = slice.call(arguments), pth = paths[0]; @@ -3632,14 +3703,42 @@ if (!$.observe) { return innerObserve.apply(1, paths); }; - $observable = function(ns, data) { - if (arguments.length === 1) { + asyncBatch.wait = function() { + var batch = this; + batch._go = 1; + setTimeout(function() { + batch.trigger(true); + batch._go = 0; + batch.paths = {}; + }); + }; + + $observable = function(ns, data, delay) { + if (ns + "" !== ns) { + delay = data; data = ns; ns = ""; } - return $isArray(data) + delay = delay === undefined ? $subSettingsAdvanced.asyncObserve : delay; + var observable = $isArray(data) ? new ArrayObservable(ns, data) : new ObjectObservable(ns, data); + if (delay) { + if (delay === true) { + observable.async = true; + delay = asyncBatch; + } + if (!delay.trigger) { + if ($isArray(delay)) { + delay.trigger = batchTrigger; + delay.paths = {}; + } else { + delay = undefined; + } + } + observable._batch = delay; + } + return observable; }; //========================== Initialize ========================== @@ -3675,10 +3774,11 @@ if (!$.observe) { setProperty: function(path, value, nonStrict) { path = path || ""; - var key, pair, parts, + var key, pair, parts, tempBatch, multi = path + "" !== path, // Hash of paths self = this, - object = self._data; + object = self._data, + batch = self._batch; if (object) { if (multi) { @@ -3692,10 +3792,18 @@ if (!$.observe) { self.setProperty(pair.name, pair.value, nonStrict === undefined || nonStrict); //If nonStrict not specified, default to true; } } else { - // Object representation where property name is path and property value is value. - for (key in path) { + if (!batch) { + self._batch = tempBatch = []; + tempBatch.trigger = batchTrigger; + tempBatch.paths = {}; + } + for (key in path) { // Object representation where property name is path and property value is value. self.setProperty(key, path[key], nonStrict); } + if (tempBatch) { + self._batch.trigger(); + self._batch = undefined; + } } } else if (path !== $expando) { // Simple single property case. @@ -3758,8 +3866,24 @@ if (!$.observe) { } }, - _trigger: function(target, eventArgs) { - $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + _trigger: function(target, eventArgs, force) { + var key, batch, previous, + self = this; + if ($.hasData(target)) { + if (!force && (batch = self._batch)) { + if (self.async && !batch._go) { + batch.wait(); + } + batch.push([self, target, eventArgs]); + key = $data(target).obId + eventArgs.path; + if (previous = batch.paths[key]) { + batch[previous-1].skip = 1; + } + batch.paths[key] = batch.length; + } else { + $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } + } } }; @@ -3909,17 +4033,28 @@ if (!$.observe) { return self; }, - _trigger: function(eventArgs, oldLength) { - var self = this, - _data = self._data, - length = _data.length, - $_data = $([_data]); - if (self._srt) { - eventArgs.refresh = true; // We are sorting during refresh - } else if (length !== oldLength) { // We have finished sort operations during refresh - $_data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + _trigger: function(eventArgs, oldLength, force) { + var length, _data, batch, + self = this; + if ($.hasData(_data = self._data)) { + if (!force && (batch = self._batch)) { + eventArgs._dly = true; // Delayed event (async or batch change) + batch.push([self, eventArgs, oldLength]); + if (self.async && !batch._go) { + batch.wait(); + } + } else { + length = _data.length; + _data = $([_data]); + + if (self._srt) { + eventArgs.refresh = true; // We are sorting during refresh + } else if (length !== oldLength) { // We have finished sort operations during refresh + _data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + } + _data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } } - $_data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only } }; @@ -4070,8 +4205,9 @@ if (!$.observe) { }; $sub.advSet = function() { // refresh advanced settings + $subSettingsAdvanced = $subSettings.advanced; $sub._gccb = this._gccb; // getContextCallback method - global._jsv = $subSettings.advanced._jsv + global._jsv = $subSettingsAdvanced._jsv ? { // create global _jsv, for accessing views, etc cbBindings: cbBindingsStore } @@ -4080,6 +4216,10 @@ if (!$.observe) { $sub._dp = dependsPaths; $sub._gck = getCbKey; $sub._obs = $observe; + $subSettingsAdvanced = $subSettings.advanced = $subSettingsAdvanced || { + useViews: false, + _jsv: false // For global access to JsViews store + }; } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsViews >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -4174,7 +4314,7 @@ $observe = $observable.observe; // Event handlers //=============== -function updateValues(sourceValues, tagElse, bindId, ev) { +function updateValues(sourceValues, tagElse, async, bindId, ev) { // Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes // Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined // Called directly as tag.updateValues(val1, val2, val3, ...) - this: tag @@ -4277,7 +4417,7 @@ function updateValues(sourceValues, tagElse, bindId, ev) { exprOb = exprOb.sb; } } - $observable(target).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object + $observable(target, async).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object } } } @@ -4640,10 +4780,10 @@ function arrayChangeHandler(ev, eventArgs) { // array change handler for 'array' self._.srt = eventArgs.refresh; // true if part of a 'sort' on refresh switch (action) { case "insert": - self.addViews(index, items); + self.addViews(index, items, eventArgs._dly); break; case "remove": - self.removeViews(index, items.length); + self.removeViews(index, items.length, undefined, eventArgs._dly); break; case "move": self.moveViews(eventArgs.oldIndex, index, items.length); @@ -4837,6 +4977,7 @@ function addBindingMarkers(value, view, tag) { function observeAndBind(linkCtx, source, target) { var binding, l, k, linkedElem, exprFnDeps, exprOb, prop, propDeps, depends, tagDepends, bindId, linkedElems, tag = linkCtx.tag, + allowArray = !tag, cvtBk = linkCtx.convertBack, handler = linkCtx._hdl; source = typeof source === "object" && source; // If not an object set to false @@ -4882,6 +5023,7 @@ function observeAndBind(linkCtx, source, target) { } } } + allowArray = tag.onArrayChange === undefined || tag.onArrayChange === true; } l = exprFnDeps.length; @@ -4894,7 +5036,7 @@ function observeAndBind(linkCtx, source, target) { } } binding = $observable._apply( - 1, // Use as 'this' pointer - arbitrary + allowArray ? 0 : 1, // 'this' pointer for observeAndBind, used to set allowArray to 1 or 0. [source], exprFnDeps, // flatten the paths - to gather all the dependencies across args and bound params depends, @@ -5145,7 +5287,7 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont } } } - if (elCnt) { + if (elCnt && !inTag) { // elContent maps tagNames which have only element content, so may not support script nodes. // We are in element-only content, can remove white space, and use data-jsv attributes on elements as markers // Example: - close marker for view 2 and open marker for view 6 @@ -5764,8 +5906,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -6570,14 +6714,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -6603,8 +6750,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -6766,7 +6914,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -6820,7 +6982,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -6831,16 +6993,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -6924,7 +7085,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -7174,6 +7335,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -7312,16 +7474,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -17756,4 +17909,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) :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vKlxuXG4gICAgIGJpbmQgICAgIHRhZ05hbWUgICAgICAgICBjdnQgICBjbG4gaHRtbCBjb2RlICAgIHBhcmFtcyAgICAgICAgICAgIHNsYXNoICAgYmluZDIgICAgICAgICBjbG9zZUJsayAgY29tbWVudFxuLyg/OnsoXFxeKT97KD86KFxcdysoPz1bXFwvXFxzfV0pKXwoXFx3Kyk/KDopfCg+KXwoXFwqKSlcXHMqKCg/OltefV18fSg/IX0pKSo/KShcXC8pP3x7KFxcXik/eyg/Oig/OlxcLyhcXHcrKSlcXHMqfCEtLVtcXHNcXFNdKj8tLSkpfX0vZ1xuXG4oPzpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogICBjbG9zZUJsb2NrXG4gICAgfFxuICAgICEtLVtcXHNcXFNdKj8tLSAgICBjb21tZW50XG4gIClcbilcbn19L2dcblxuKi9cblx0XHRpZiAoY29kZVRhZyAmJiBiaW5kIHx8IHNsYXNoICYmICF0YWdOYW1lIHx8IHBhcmFtcyAmJiBwYXJhbXMuc2xpY2UoLTEpID09PSBcIjpcIiB8fCBiaW5kMikge1xuXHRcdFx0c3ludGF4RXJyb3IoYWxsKTtcblx0XHR9XG5cblx0XHQvLyBCdWlsZC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lld3M6IHZlcnNpb25OdW1iZXIsXG5cdFx0c3ViOiB7XG5cdFx0XHQvLyBzdWJzY3JpcHRpb24sIGUuZy4gSnNWaWV3cyBpbnRlZ3JhdGlvblxuXHRcdFx0clBhdGg6IC9eKCEqPykoPzpudWxsfHRydWV8ZmFsc2V8XFxkW1xcZC5dKnwoW1xcdyRdK3xcXC58fihbXFx3JF0rKXwjKHZpZXd8KFtcXHckXSspKT8pKFtcXHckLl5dKj8pKD86Wy5bXl0oW1xcdyRdKylcXF0/KT8pJC9nLFxuXHRcdFx0Ly8gICAgICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgICAgIGhlbHBlciAgICB2aWV3ICB2aWV3UHJvcGVydHkgcGF0aFRva2VucyAgICAgIGxlYWZUb2tlblxuXG5cdFx0XHRyUHJtOiAvKFxcKCkoPz1cXHMqXFwoKXwoPzooWyhbXSlcXHMqKT8oPzooXFxePykofj9bXFx3JC5eXSspP1xccyooKFxcK1xcK3wtLSl8XFwrfC18fig/IVtcXHckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfChcXCg/KVxcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcGF0aDIgbGF0ZSAgICAgICAgICAgIHBybiAgICAgIGNvbW1hICBsZnRQcm4yICAgYXBvcyBxdW90ICAgICAgICBydFBybiAgcnRQcm5Eb3QgICAgICAgICAgICAgICAg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LXRlbXBsYXRlLmh0bWxcIiwgbWt1cClcbiAgfTsiXX0= diff --git a/test/browserify/bundles/8B-bundle.js b/test/browserify/bundles/8B-bundle.js index ed5cb6e..ca2a721 100644 --- a/test/browserify/bundles/8B-bundle.js +++ b/test/browserify/bundles/8B-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -2799,20 +2838,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -2852,6 +2878,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -2928,6 +2969,7 @@ if (!$.observe) { observeInnerCbKey = 1, $data = $.data, remove = {}, // flag for removeProperty + asyncBatch = [], //========================== Top-level functions ========================== @@ -3074,13 +3116,12 @@ if (!$.observe) { function filterAndObserveAll(obj, prop, unobs, nestedArray) { var newObject, newParentObs; - if (prop !== $expando && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { + if ((+prop === prop || prop !== $expando) && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { newParentObs = nextParentObs.slice(); if (nestedArray && updatedTgt && newParentObs[0] !== updatedTgt) { newParentObs.unshift(updatedTgt); // For array change events when observing an array which is not the root, need to add updated array to parentObs } observeAll(namespace, newObject, cb, filter || (nestedArray ? undefined : 0), newParentObs, newAllPath, unobs, objMap); - // If nested array, need to observe the array too - so set filter to undefined } } @@ -3172,6 +3213,19 @@ if (!$.observe) { $unobserve = function() { [].push.call(arguments, true); // Add true as additional final argument return $observe.apply(undefined, arguments); + }, + + batchTrigger = function(async) { + var event, + batch = this.slice(); + this.length = 0; + this._go = 0; + while (event = batch.shift()) { + if (!event.skip) { + event[0]._trigger(event[1], event[2], true); + } + } + this.paths = {}; }; $observe = function() { @@ -3194,7 +3248,7 @@ if (!$.observe) { } function observeOnOff(cb, object, fullPath, namespace, pathStr, isArrayBinding, off) { - var j, evData, + var j, evData, dataOb, boundObOrArr = wrapArray(object), prntObs = parentObs, allPth = allPath; @@ -3249,10 +3303,9 @@ if (!$.observe) { }; } $(boundObOrArr).on(namespace, null, evData, onDataChange); - if (cbBindings) { // Add object to cbBindings - cbBindings[$data(object).obId || $data(object, "obId", observeObjKey++)] = object; + cbBindings[(dataOb = $data(object)).obId || (dataOb.obId = observeObjKey++)] = object; } } } @@ -3260,7 +3313,7 @@ if (!$.observe) { function bindArray(cb, arr, unbind, isArray, relPath) { if (allowArray) { // allowArray is 1 if this is a call to observe that does not come from observeAndBind (tag binding), or is from a 'depends' path, - // so we allow arrayChange binding. Otherwise allowArray is zero. + // or for a tag with tag.onArrayChange = true - so we allow arrayChange binding. Otherwise allowArray is zero. var object, prevAllPath = allPath; @@ -3337,7 +3390,7 @@ if (!$.observe) { // remove previous observeAll wrapped callback, if inner callback was the same; } - var arrIndex, skip, dep, obArr, prt, + var arrIndex, skip, dep, obArr, prt, fnProp, isGet, obj = object; if (object && object._cxp) { return observeObjectPaths(object[0], [object[1]], callback, contextCb); @@ -3348,6 +3401,10 @@ if (!$.observe) { if (prop === "") { continue; } + if (prop.slice(-2) === "()") { + prop = prop.slice(0, -2); + isGet = true; + } if ((prts.length < depth + 1) && !obj.nodeType) { // Add observer for each token in path starting at depth, and on to the leaf if (!unobserve && (events = $._data(obj).events)) { @@ -3360,6 +3417,7 @@ if (!$.observe) { && data.ns === initialNs && data.cb._cId === callback._cId && data.cb._inId === callback._inId + && !data._arOk === !allowArray && (data.prop === prop || data.prop === "*" || data.prop === "**")) { if (prt = prts.join(".")) { data.paths.push(prt); // We will skip this binding, but if it is not a leaf binding, @@ -3423,7 +3481,8 @@ if (!$.observe) { } } if ($isFunction(prop)) { - if (dep = prop.depends) { + fnProp = prop; + if (dep = fnProp.depends) { // This is a computed observable. We will observe any declared dependencies. if (obj._vw && obj._ocp) { // Observable contextual parameter, so context was ocp object. Now move context to view.data for dependencies @@ -3436,7 +3495,17 @@ if (!$.observe) { } observeObjects(concat.apply([], [[obj], dependsPaths(dep, obj, callback)])); } - break; + + if (isGet) { + if (!prts[0]) { + bindArray(callback, fnProp.call(obj), unobserve); + break; + } + prop = fnProp.call(obj); + if (!prop) { + break; + } + } } obj = prop; } @@ -3548,6 +3617,8 @@ if (!$.observe) { } } +//END OF FUNCTIONS + var ns = observeStr, paths = this != 1 // Using != for IE<10 bug- see jsviews/issues/237 ? concat.apply([], arguments) // Flatten the arguments - this is a 'recursive call' with params using the 'wrapped array' @@ -3556,7 +3627,6 @@ if (!$.observe) { lastArg = paths.pop() || false, m = paths.length; -//END OF FUNCTIONS if (lastArg + "" === lastArg) { // If last arg is a string then this observe call is part of an observeAll call, allPath = lastArg; // and the last three args are the parentObs array, the filter, and the allPath string. parentObs = paths.pop(); @@ -3619,9 +3689,10 @@ if (!$.observe) { } var initialNs, - allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind - doing binding of datalink expressions. We don't bind - // arrayChange events in this scenario. Instead, {^{for}} and similar do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. - // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug- see jsviews/issues/237 + allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind (doing binding of datalink expressions), + // and tag.onArrayChange is not set to true. We don't bind arrayChange events in this scenario. Instead, {^{for}} and similar + // do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. + // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug - see jsviews/issues/237 paths = slice.call(arguments), pth = paths[0]; @@ -3632,14 +3703,42 @@ if (!$.observe) { return innerObserve.apply(1, paths); }; - $observable = function(ns, data) { - if (arguments.length === 1) { + asyncBatch.wait = function() { + var batch = this; + batch._go = 1; + setTimeout(function() { + batch.trigger(true); + batch._go = 0; + batch.paths = {}; + }); + }; + + $observable = function(ns, data, delay) { + if (ns + "" !== ns) { + delay = data; data = ns; ns = ""; } - return $isArray(data) + delay = delay === undefined ? $subSettingsAdvanced.asyncObserve : delay; + var observable = $isArray(data) ? new ArrayObservable(ns, data) : new ObjectObservable(ns, data); + if (delay) { + if (delay === true) { + observable.async = true; + delay = asyncBatch; + } + if (!delay.trigger) { + if ($isArray(delay)) { + delay.trigger = batchTrigger; + delay.paths = {}; + } else { + delay = undefined; + } + } + observable._batch = delay; + } + return observable; }; //========================== Initialize ========================== @@ -3675,10 +3774,11 @@ if (!$.observe) { setProperty: function(path, value, nonStrict) { path = path || ""; - var key, pair, parts, + var key, pair, parts, tempBatch, multi = path + "" !== path, // Hash of paths self = this, - object = self._data; + object = self._data, + batch = self._batch; if (object) { if (multi) { @@ -3692,10 +3792,18 @@ if (!$.observe) { self.setProperty(pair.name, pair.value, nonStrict === undefined || nonStrict); //If nonStrict not specified, default to true; } } else { - // Object representation where property name is path and property value is value. - for (key in path) { + if (!batch) { + self._batch = tempBatch = []; + tempBatch.trigger = batchTrigger; + tempBatch.paths = {}; + } + for (key in path) { // Object representation where property name is path and property value is value. self.setProperty(key, path[key], nonStrict); } + if (tempBatch) { + self._batch.trigger(); + self._batch = undefined; + } } } else if (path !== $expando) { // Simple single property case. @@ -3758,8 +3866,24 @@ if (!$.observe) { } }, - _trigger: function(target, eventArgs) { - $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + _trigger: function(target, eventArgs, force) { + var key, batch, previous, + self = this; + if ($.hasData(target)) { + if (!force && (batch = self._batch)) { + if (self.async && !batch._go) { + batch.wait(); + } + batch.push([self, target, eventArgs]); + key = $data(target).obId + eventArgs.path; + if (previous = batch.paths[key]) { + batch[previous-1].skip = 1; + } + batch.paths[key] = batch.length; + } else { + $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } + } } }; @@ -3909,17 +4033,28 @@ if (!$.observe) { return self; }, - _trigger: function(eventArgs, oldLength) { - var self = this, - _data = self._data, - length = _data.length, - $_data = $([_data]); - if (self._srt) { - eventArgs.refresh = true; // We are sorting during refresh - } else if (length !== oldLength) { // We have finished sort operations during refresh - $_data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + _trigger: function(eventArgs, oldLength, force) { + var length, _data, batch, + self = this; + if ($.hasData(_data = self._data)) { + if (!force && (batch = self._batch)) { + eventArgs._dly = true; // Delayed event (async or batch change) + batch.push([self, eventArgs, oldLength]); + if (self.async && !batch._go) { + batch.wait(); + } + } else { + length = _data.length; + _data = $([_data]); + + if (self._srt) { + eventArgs.refresh = true; // We are sorting during refresh + } else if (length !== oldLength) { // We have finished sort operations during refresh + _data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + } + _data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } } - $_data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only } }; @@ -4070,8 +4205,9 @@ if (!$.observe) { }; $sub.advSet = function() { // refresh advanced settings + $subSettingsAdvanced = $subSettings.advanced; $sub._gccb = this._gccb; // getContextCallback method - global._jsv = $subSettings.advanced._jsv + global._jsv = $subSettingsAdvanced._jsv ? { // create global _jsv, for accessing views, etc cbBindings: cbBindingsStore } @@ -4080,6 +4216,10 @@ if (!$.observe) { $sub._dp = dependsPaths; $sub._gck = getCbKey; $sub._obs = $observe; + $subSettingsAdvanced = $subSettings.advanced = $subSettingsAdvanced || { + useViews: false, + _jsv: false // For global access to JsViews store + }; } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsViews >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -4174,7 +4314,7 @@ $observe = $observable.observe; // Event handlers //=============== -function updateValues(sourceValues, tagElse, bindId, ev) { +function updateValues(sourceValues, tagElse, async, bindId, ev) { // Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes // Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined // Called directly as tag.updateValues(val1, val2, val3, ...) - this: tag @@ -4277,7 +4417,7 @@ function updateValues(sourceValues, tagElse, bindId, ev) { exprOb = exprOb.sb; } } - $observable(target).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object + $observable(target, async).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object } } } @@ -4640,10 +4780,10 @@ function arrayChangeHandler(ev, eventArgs) { // array change handler for 'array' self._.srt = eventArgs.refresh; // true if part of a 'sort' on refresh switch (action) { case "insert": - self.addViews(index, items); + self.addViews(index, items, eventArgs._dly); break; case "remove": - self.removeViews(index, items.length); + self.removeViews(index, items.length, undefined, eventArgs._dly); break; case "move": self.moveViews(eventArgs.oldIndex, index, items.length); @@ -4837,6 +4977,7 @@ function addBindingMarkers(value, view, tag) { function observeAndBind(linkCtx, source, target) { var binding, l, k, linkedElem, exprFnDeps, exprOb, prop, propDeps, depends, tagDepends, bindId, linkedElems, tag = linkCtx.tag, + allowArray = !tag, cvtBk = linkCtx.convertBack, handler = linkCtx._hdl; source = typeof source === "object" && source; // If not an object set to false @@ -4882,6 +5023,7 @@ function observeAndBind(linkCtx, source, target) { } } } + allowArray = tag.onArrayChange === undefined || tag.onArrayChange === true; } l = exprFnDeps.length; @@ -4894,7 +5036,7 @@ function observeAndBind(linkCtx, source, target) { } } binding = $observable._apply( - 1, // Use as 'this' pointer - arbitrary + allowArray ? 0 : 1, // 'this' pointer for observeAndBind, used to set allowArray to 1 or 0. [source], exprFnDeps, // flatten the paths - to gather all the dependencies across args and bound params depends, @@ -5145,7 +5287,7 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont } } } - if (elCnt) { + if (elCnt && !inTag) { // elContent maps tagNames which have only element content, so may not support script nodes. // We are in element-only content, can remove white space, and use data-jsv attributes on elements as markers // Example: - close marker for view 2 and open marker for view 6 @@ -5764,8 +5906,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -6570,14 +6714,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -6603,8 +6750,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -6766,7 +6914,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -6820,7 +6982,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -6831,16 +6993,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -6924,7 +7085,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -7174,6 +7335,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -7312,16 +7474,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -17688,7 +17841,7 @@ return jQuery; })); },{}],3:[function(require,module,exports){ -/*! JsRender v1.0.2: http://jsviews.com/#jsrender */ +/*! JsRender v1.0.3: http://jsviews.com/#jsrender */ /*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */ /* * Best-of-breed templating in browser or on Node.js. @@ -17734,7 +17887,7 @@ var setGlobals = $ === false; // Only set globals if script block in browser (no $ = $ && $.fn ? $ : global.jQuery; // $ is jQuery passed in by CommonJS loader (Browserify), or global jQuery. -var versionNumber = "v1.0.2", +var versionNumber = "v1.0.3", jsvStoreName, rTag, rTmplString, topView, $views, $expando, _ocp = "_ocp", // Observable contextual parameter @@ -18229,6 +18382,7 @@ function convertVal(converter, view, tagCtx, onError) { inline: !linkCtx, tagName: ":", convert: converter, + onArrayChange: true, flow: true, tagCtx: tagCtx, tagCtxs: [tagCtx], @@ -18677,6 +18831,9 @@ function View(context, type, parentView, data, template, key, onRender, contentT self.ctx = context || parentView.ctx; } else { self.ctx = context || {}; + if (type) { + self.root = self; // view whose parent is top view + } } } @@ -18904,18 +19061,15 @@ function getDefaultVal(defaultVal, data) { : defaultVal; } -function unmapArray(modelArr) { - var arr = [], - i = 0, - l = modelArr.length; - for (; i value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -20484,20 +20676,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -20537,6 +20716,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -20652,4 +20846,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[4]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqc3ZpZXdzLmpzIiwibm9kZV9tb2R1bGVzL2pxdWVyeS9kaXN0L2pxdWVyeS5qcyIsIm5vZGVfbW9kdWxlcy9qc3JlbmRlci9qc3JlbmRlci5qcyIsInRlc3QvYnJvd3NlcmlmeS84Qi11bml0LXRlc3RzLmpzIiwidGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQU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WV3cyBpbnRlZ3JhdGlvblxuXHRcdFx0clBhdGg6IC9eKCEqPykoPzpudWxsfHRydWV8ZmFsc2V8XFxkW1xcZC5dKnwoW1xcdyRdK3xcXC58fihbXFx3JF0rKXwjKHZpZXd8KFtcXHckXSspKT8pKFtcXHckLl5dKj8pKD86Wy5bXl0oW1xcdyRdKylcXF0/KT8pJC9nLFxuXHRcdFx0Ly8gICAgICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgICAgIGhlbHBlciAgICB2aWV3ICB2aWV3UHJvcGVydHkgcGF0aFRva2VucyAgICAgIGxlYWZUb2tlblxuXG5cdFx0XHRyUHJtOiAvKFxcKCkoPz1cXHMqXFwoKXwoPzooWyhbXSlcXHMqKT8oPzooXFxePykofj9bXFx3JC5eXSspP1xccyooKFxcK1xcK3wtLSl8XFwrfC18fig/IVtcXHckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfChcXCg/KVxcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcGF0aDIgbGF0ZSAgICAgICAgICAgIHBybiAgICAgIGNvbW1hICBsZnRQcm4yICAgYXBvcyBxdW90ICAgICAgICBydFBybiAgcnRQcm5Eb3QgICAgICAgICAgICAgICAgICBwcm4yICAgICBzcGFjZVxuXG5cdFx0XHRWaWV3OiBWaWV3LFxuXHRcdFx0RXJyOiBKc1ZpZXdzRXJyb3IsXG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zpcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kXG4gICg/OlxuICAgIChcXHcrICAgICAgICAgICAgIHRhZ05hbWVcbiAgICAgICg/PVtcXC9cXHN9XSlcbiAgICApXG4gICAgfFxuICAgIChcXHcrKT8oOikgICAgICAgIGNvbnZlcnRlciBjb2xvblxuICAgIHxcbiAgICAoPikgICAgICAgICAgICAgIGh0bWxcbiAgICB8XG4gICAgKFxcKikgICAgICAgICAgICAgY29kZVRhZ1xuICApXG4gIFxccypcbiAgKCAgICAgICAgICAgICAgICAgIHBhcmFtc1xuICAgICg/OltefV18fSg/IX0pKSo/XG4gIClcbiAgKFxcLyk/ICAgICAgICAgICAgICBzbGFzaFxuICB8XG4gIHsoXFxeKT97ICAgICAgICAgICAgYmluZDJcbiAgKD86XG4gICAgKD86XFwvKFxcdyspKVxccyogICBjbG9zZUJsb2NrXG4gICAgfFxuICAgICEtLVtcXHNcXFNdKj8tLSAgICBjb21tZW50XG4gIClcbilcbn19L2dcblxuKi9cblx0XHRpZiAoY29kZVRhZyAmJiBiaW5kIHx8IHNsYXNoICYmICF0YWdOYW1lIHx8IHBhcmFtcyAmJiBwYXJhbXMuc2xpY2UoLTEpID09PSBcIjpcIiB8fCBiaW5kMikge1xuXHRcdFx0c3ludGF4RXJyb3IoYWxsKTtcblx0XHR9XG5cblx0XHQvLyBCdWlsZCBhYnN0cmFjdCBzeW50YXggdHJlZSAoQVNUKTogW3RhZ05hbWUsIGNvbnZlcnRlciwgcGFyYW1zLCBjb250ZW50LCBoYXNoLCBiaW5kaW5ncywgY29udGVudE1hcmt1cF1cblx0XHRpZiAoaHRtbCkge1xuXHRcdFx0Y29sb24gPSBcIjpcIjtcblx0XHRcdGNvbnZlcnRlciA9IEhUTUw7XG5cdFx0fVxuXHRcdHNsYXNoID0gc2xhc2ggfHwgaXNMaW5rRXhwciAmJiAhaGFzRWxzZTtcblxuXHRcdHZhciBsYXRlLCBvcGVuVGFnTmFtZSwgaXNMYXRlT2IsXG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dGlvbiwgZS5nLiBKc1ZpZXdzIGludGVncmF0aW9uXG5cdFx0XHRyUGF0aDogL14oISo/KSg/Om51bGx8dHJ1ZXxmYWxzZXxcXGRbXFxkLl0qfChbXFx3JF0rfFxcLnx+KFtcXHckXSspfCModmlld3woW1xcdyRdKykpPykoW1xcdyQuXl0qPykoPzpbLlteXShbXFx3JF0rKVxcXT8pPykkL2csXG5cdFx0XHQvLyAgICAgICAgbm90ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9iamVjdCAgICAgaGVscGVyICAgIHZpZXcgIHZpZXdQcm9wZXJ0eSBwYXRoVG9rZW5zICAgICAgbGVhZlRva2VuXG5cblx0XHRcdHJQcm06IC8oXFwoKSg/PVxccypcXCgpfCg/OihbKFtdKVxccyopPyg/OihcXF4/KSh+P1tcXHckLl5dKyk/XFxzKigoXFwrXFwrfC0tKXxcXCt8LXx+KD8hW1xcdyRdKXwmJnxcXHxcXHx8PT09fCE9PXw9PXwhPXw8PXw+PXxbPD4lKjo/XFwvXXwoPSkpXFxzKnwoISo/KEApP1sjfl0/W1xcdyQuXl0rKShbKFtdKT8pfCgsXFxzKil8KFxcKD8pXFxcXD8oPzooJyl8KFwiKSl8KD86XFxzKigoWylcXF1dKSg/PVsuXl18XFxzKiR8W14oW10pfFspXFxdXSkoWyhbXT8pKXwoXFxzKykvZyxcblx0XHRcdC8vICAgbGZ0UHJuMCAgICAgICAgICAgbGZ0UHJuICAgICAgICAgYm91bmQgICAgIHBhdGggICAgICAgICAgICAgICBvcGVyYXRvciAgICAgZXJyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXEgICAgICBwYXRoMiBsYXRlICAgICAgICAgICAgcHJuICAgICAgY29tbWEgIGxmdFBybjIgICBhcG9zIHF1b3QgICAgICAgIHJ0UHJuICBydFBybkRvdCAgICAgICAgICAgICAgICAgIHBybjIgICAgIHNwYWNlXG5cblx0XHRcdFZpZXc6IFZpZXcsXG5cdFx0XHRFcnI6I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ZXIsXG5cdFx0c3ViOiB7XG5cdFx0XHQvLyBzdWJzY3JpcHRpb24sIGUuZy4gSnNWaWV3cyBpbnRlZ3JhdGlvblxuXHRcdFx0clBhdGg6IC9eKCEqPykoPzpudWxsfHRydWV8ZmFsc2V8XFxkW1xcZC5dKnwoW1xcdyRdK3xcXC58fihbXFx3JF0rKXwjKHZpZXd8KFtcXHckXSspKT8pKFtcXHckLl5dKj8pKD86Wy5bXl0oW1xcdyRdKylcXF0/KT8pJC9nLFxuXHRcdFx0Ly8gICAgICAgIG5vdCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvYmplY3QgICAgIGhlbHBlciAgICB2aWV3ICB2aWV3UHJvcGVydHkgcGF0aFRva2VucyAgICAgIGxlYWZUb2tlblxuXG5cdFx0XHRyUHJtOiAvKFxcKCkoPz1cXHMqXFwoKXwoPzooWyhbXSlcXHMqKT8oPzooXFxePykofj9bXFx3JC5eXSspP1xccyooKFxcK1xcK3wtLSl8XFwrfC18fig/IVtcXHckXSl8JiZ8XFx8XFx8fD09PXwhPT18PT18IT18PD18Pj18Wzw+JSo6P1xcL118KD0pKVxccyp8KCEqPyhAKT9bI35dP1tcXHckLl5dKykoWyhbXSk/KXwoLFxccyopfChcXCg/KVxcXFw/KD86KCcpfChcIikpfCg/OlxccyooKFspXFxdXSkoPz1bLl5dfFxccyokfFteKFtdKXxbKVxcXV0pKFsoW10/KSl8KFxccyspL2csXG5cdFx0XHQvLyAgIGxmdFBybjAgICAgICAgICAgIGxmdFBybiAgICAgICAgIGJvdW5kICAgICBwYXRoICAgICAgICAgICAgICAgb3BlcmF0b3IgICAgIGVyciAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVxICAgICAgcGF0aDIgbGF0ZSAgICAgICAgICAgIHBybiAgICAgIGNvbW1hICBsZnRQcm4yICAgYXBvcyBxdW90ICAgICAgICBydFBybiAgcnRQcm5Eb3QgICAgICAgICAgICAgICAgICBwcm4yICAgICBzcGFjZVx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AvLyBSZXBsYWNlIFFVbml0IGdsb2JhbCBqUXVlcnlcblx0Z2xvYmFsLmpzcmVuZGVyID0ganNyOyAvLyBSZXBsYWNlIGFueSBwcmV2aW91cyBnbG9iYWwganNyZW5kZXJcbn0pO1xufVxufSkoKTtcbiIsInZhciB0bXBsUmVmcyA9IFtdLFxuICBta3VwID0gJ05hbWU6IHt7Om5hbWV9fSAobmFtZS10ZW1wbGF0ZS5odG1sKScsXG4gICQgPSBnbG9iYWwuanNyZW5kZXIgfHwgZ2xvYmFsLmpRdWVyeTtcblxubW9kdWxlLmV4cG9ydHMgPSAkID8gJC50ZW1wbGF0ZXMoXCIuL3Rlc3QvdGVtcGxhdGVzL25hbWUtdGVtcGxhdGUuaHRtbFwiLCBta3VwKSA6XG4gIGZ1bmN0aW9uKCQpIHtcbiAgICBpZiAoISQgfHwgISQudmlld3MpIHt0aHJvdyBcIlJlcXVpcmVzIGpzcmVuZGVyL2pRdWVyeVwiO31cbiAgICB3aGlsZSAodG1wbFJlZnMubGVuZ3RoKSB7XG4gICAgICB0bXBsUmVmcy5wb3AoKSgkKTsgLy8gY29tcGlsZSBuZXN0ZWQgdGVtcGxhdGVcbiAgICB9XG5cbiAgICByZXR1cm4gJC50ZW1wbGF0ZXMoXCIuL3Rlc3QvdGVtcGxhdGVzL25hbWUtdGVtcGxhdGUuaHRtbFwiLCBta3VwKVxuICB9OyJdfQ== diff --git a/test/browserify/bundles/9-bundle.js b/test/browserify/bundles/9-bundle.js index c0f52d1..c635257 100644 --- a/test/browserify/bundles/9-bundle.js +++ b/test/browserify/bundles/9-bundle.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o value.length ? value.length : +end; -// end = end === undefined ? value.length : +end; value = value.slice(start, end); } if (step > 1) { @@ -2799,20 +2838,7 @@ if (!(jsr || $ && $.render)) { "for": { sortDataMap: dataMap(getTargetSorted), init: function(val, cloned) { - var l, tagCtx, paramsProps, sort, - self = this, - tagCtxs = self.tagCtxs; - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - paramsProps = tagCtx.params.props; - tagCtx.argDefault = tagCtx.props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - - if (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (paramsProps.sort !== undefined || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse)) { - tagCtx.props.dataMap = self.sortDataMap; - } - } + this.setDataMap(this.tagCtxs); }, render: function(val) { // This function is called once for {{for}} and once for each {{else}}. @@ -2852,6 +2878,21 @@ if (!(jsr || $ && $.render)) { } return result; }, + setDataMap: function(tagCtxs) { + var tagCtx, props, paramsProps, + self = this, + l = tagCtxs.length; + while (l--) { + tagCtx = tagCtxs[l]; + props = tagCtx.props; + paramsProps = tagCtx.params.props; + tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} + props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) && + (paramsProps.sort || paramsProps.start || paramsProps.end || paramsProps.step || paramsProps.filter || paramsProps.reverse + || props.sort || props.start || props.end || props.step || props.filter || props.reverse)) + && self.sortDataMap; + } + }, flow: true }, props: { @@ -2928,6 +2969,7 @@ if (!$.observe) { observeInnerCbKey = 1, $data = $.data, remove = {}, // flag for removeProperty + asyncBatch = [], //========================== Top-level functions ========================== @@ -3074,13 +3116,12 @@ if (!$.observe) { function filterAndObserveAll(obj, prop, unobs, nestedArray) { var newObject, newParentObs; - if (prop !== $expando && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { + if ((+prop === prop || prop !== $expando) && (newObject = $observable._fltr(newAllPath, obj[prop], nextParentObs, filter))) { newParentObs = nextParentObs.slice(); if (nestedArray && updatedTgt && newParentObs[0] !== updatedTgt) { newParentObs.unshift(updatedTgt); // For array change events when observing an array which is not the root, need to add updated array to parentObs } observeAll(namespace, newObject, cb, filter || (nestedArray ? undefined : 0), newParentObs, newAllPath, unobs, objMap); - // If nested array, need to observe the array too - so set filter to undefined } } @@ -3172,6 +3213,19 @@ if (!$.observe) { $unobserve = function() { [].push.call(arguments, true); // Add true as additional final argument return $observe.apply(undefined, arguments); + }, + + batchTrigger = function(async) { + var event, + batch = this.slice(); + this.length = 0; + this._go = 0; + while (event = batch.shift()) { + if (!event.skip) { + event[0]._trigger(event[1], event[2], true); + } + } + this.paths = {}; }; $observe = function() { @@ -3194,7 +3248,7 @@ if (!$.observe) { } function observeOnOff(cb, object, fullPath, namespace, pathStr, isArrayBinding, off) { - var j, evData, + var j, evData, dataOb, boundObOrArr = wrapArray(object), prntObs = parentObs, allPth = allPath; @@ -3249,10 +3303,9 @@ if (!$.observe) { }; } $(boundObOrArr).on(namespace, null, evData, onDataChange); - if (cbBindings) { // Add object to cbBindings - cbBindings[$data(object).obId || $data(object, "obId", observeObjKey++)] = object; + cbBindings[(dataOb = $data(object)).obId || (dataOb.obId = observeObjKey++)] = object; } } } @@ -3260,7 +3313,7 @@ if (!$.observe) { function bindArray(cb, arr, unbind, isArray, relPath) { if (allowArray) { // allowArray is 1 if this is a call to observe that does not come from observeAndBind (tag binding), or is from a 'depends' path, - // so we allow arrayChange binding. Otherwise allowArray is zero. + // or for a tag with tag.onArrayChange = true - so we allow arrayChange binding. Otherwise allowArray is zero. var object, prevAllPath = allPath; @@ -3337,7 +3390,7 @@ if (!$.observe) { // remove previous observeAll wrapped callback, if inner callback was the same; } - var arrIndex, skip, dep, obArr, prt, + var arrIndex, skip, dep, obArr, prt, fnProp, isGet, obj = object; if (object && object._cxp) { return observeObjectPaths(object[0], [object[1]], callback, contextCb); @@ -3348,6 +3401,10 @@ if (!$.observe) { if (prop === "") { continue; } + if (prop.slice(-2) === "()") { + prop = prop.slice(0, -2); + isGet = true; + } if ((prts.length < depth + 1) && !obj.nodeType) { // Add observer for each token in path starting at depth, and on to the leaf if (!unobserve && (events = $._data(obj).events)) { @@ -3360,6 +3417,7 @@ if (!$.observe) { && data.ns === initialNs && data.cb._cId === callback._cId && data.cb._inId === callback._inId + && !data._arOk === !allowArray && (data.prop === prop || data.prop === "*" || data.prop === "**")) { if (prt = prts.join(".")) { data.paths.push(prt); // We will skip this binding, but if it is not a leaf binding, @@ -3423,7 +3481,8 @@ if (!$.observe) { } } if ($isFunction(prop)) { - if (dep = prop.depends) { + fnProp = prop; + if (dep = fnProp.depends) { // This is a computed observable. We will observe any declared dependencies. if (obj._vw && obj._ocp) { // Observable contextual parameter, so context was ocp object. Now move context to view.data for dependencies @@ -3436,7 +3495,17 @@ if (!$.observe) { } observeObjects(concat.apply([], [[obj], dependsPaths(dep, obj, callback)])); } - break; + + if (isGet) { + if (!prts[0]) { + bindArray(callback, fnProp.call(obj), unobserve); + break; + } + prop = fnProp.call(obj); + if (!prop) { + break; + } + } } obj = prop; } @@ -3548,6 +3617,8 @@ if (!$.observe) { } } +//END OF FUNCTIONS + var ns = observeStr, paths = this != 1 // Using != for IE<10 bug- see jsviews/issues/237 ? concat.apply([], arguments) // Flatten the arguments - this is a 'recursive call' with params using the 'wrapped array' @@ -3556,7 +3627,6 @@ if (!$.observe) { lastArg = paths.pop() || false, m = paths.length; -//END OF FUNCTIONS if (lastArg + "" === lastArg) { // If last arg is a string then this observe call is part of an observeAll call, allPath = lastArg; // and the last three args are the parentObs array, the filter, and the allPath string. parentObs = paths.pop(); @@ -3619,9 +3689,10 @@ if (!$.observe) { } var initialNs, - allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind - doing binding of datalink expressions. We don't bind - // arrayChange events in this scenario. Instead, {^{for}} and similar do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. - // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug- see jsviews/issues/237 + allowArray = this == 1 ? 0 : 1, // If this == 1, this is a call from observeAndBind (doing binding of datalink expressions), + // and tag.onArrayChange is not set to true. We don't bind arrayChange events in this scenario. Instead, {^{for}} and similar + // do specific arrayChange binding to the tagCtx.args[0] value, in onAfterLink. + // Note deliberately using this == 1, rather than this === 1 because of IE<10 bug - see jsviews/issues/237 paths = slice.call(arguments), pth = paths[0]; @@ -3632,14 +3703,42 @@ if (!$.observe) { return innerObserve.apply(1, paths); }; - $observable = function(ns, data) { - if (arguments.length === 1) { + asyncBatch.wait = function() { + var batch = this; + batch._go = 1; + setTimeout(function() { + batch.trigger(true); + batch._go = 0; + batch.paths = {}; + }); + }; + + $observable = function(ns, data, delay) { + if (ns + "" !== ns) { + delay = data; data = ns; ns = ""; } - return $isArray(data) + delay = delay === undefined ? $subSettingsAdvanced.asyncObserve : delay; + var observable = $isArray(data) ? new ArrayObservable(ns, data) : new ObjectObservable(ns, data); + if (delay) { + if (delay === true) { + observable.async = true; + delay = asyncBatch; + } + if (!delay.trigger) { + if ($isArray(delay)) { + delay.trigger = batchTrigger; + delay.paths = {}; + } else { + delay = undefined; + } + } + observable._batch = delay; + } + return observable; }; //========================== Initialize ========================== @@ -3675,10 +3774,11 @@ if (!$.observe) { setProperty: function(path, value, nonStrict) { path = path || ""; - var key, pair, parts, + var key, pair, parts, tempBatch, multi = path + "" !== path, // Hash of paths self = this, - object = self._data; + object = self._data, + batch = self._batch; if (object) { if (multi) { @@ -3692,10 +3792,18 @@ if (!$.observe) { self.setProperty(pair.name, pair.value, nonStrict === undefined || nonStrict); //If nonStrict not specified, default to true; } } else { - // Object representation where property name is path and property value is value. - for (key in path) { + if (!batch) { + self._batch = tempBatch = []; + tempBatch.trigger = batchTrigger; + tempBatch.paths = {}; + } + for (key in path) { // Object representation where property name is path and property value is value. self.setProperty(key, path[key], nonStrict); } + if (tempBatch) { + self._batch.trigger(); + self._batch = undefined; + } } } else if (path !== $expando) { // Simple single property case. @@ -3758,8 +3866,24 @@ if (!$.observe) { } }, - _trigger: function(target, eventArgs) { - $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + _trigger: function(target, eventArgs, force) { + var key, batch, previous, + self = this; + if ($.hasData(target)) { + if (!force && (batch = self._batch)) { + if (self.async && !batch._go) { + batch.wait(); + } + batch.push([self, target, eventArgs]); + key = $data(target).obId + eventArgs.path; + if (previous = batch.paths[key]) { + batch[previous-1].skip = 1; + } + batch.paths[key] = batch.length; + } else { + $(target).triggerHandler(propertyChangeStr + (this._ns ? "." + /^\S+/.exec(this._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } + } } }; @@ -3909,17 +4033,28 @@ if (!$.observe) { return self; }, - _trigger: function(eventArgs, oldLength) { - var self = this, - _data = self._data, - length = _data.length, - $_data = $([_data]); - if (self._srt) { - eventArgs.refresh = true; // We are sorting during refresh - } else if (length !== oldLength) { // We have finished sort operations during refresh - $_data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + _trigger: function(eventArgs, oldLength, force) { + var length, _data, batch, + self = this; + if ($.hasData(_data = self._data)) { + if (!force && (batch = self._batch)) { + eventArgs._dly = true; // Delayed event (async or batch change) + batch.push([self, eventArgs, oldLength]); + if (self.async && !batch._go) { + batch.wait(); + } + } else { + length = _data.length; + _data = $([_data]); + + if (self._srt) { + eventArgs.refresh = true; // We are sorting during refresh + } else if (length !== oldLength) { // We have finished sort operations during refresh + _data.triggerHandler(propertyChangeStr, {change: "set", path: "length", value: length, oldValue: oldLength}); + } + _data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only + } } - $_data.triggerHandler(arrayChangeStr + (self._ns ? "." + /^\S+/.exec(self._ns)[0] : ""), eventArgs); // If white-space separated namespaces, use first one only } }; @@ -4070,8 +4205,9 @@ if (!$.observe) { }; $sub.advSet = function() { // refresh advanced settings + $subSettingsAdvanced = $subSettings.advanced; $sub._gccb = this._gccb; // getContextCallback method - global._jsv = $subSettings.advanced._jsv + global._jsv = $subSettingsAdvanced._jsv ? { // create global _jsv, for accessing views, etc cbBindings: cbBindingsStore } @@ -4080,6 +4216,10 @@ if (!$.observe) { $sub._dp = dependsPaths; $sub._gck = getCbKey; $sub._obs = $observe; + $subSettingsAdvanced = $subSettings.advanced = $subSettingsAdvanced || { + useViews: false, + _jsv: false // For global access to JsViews store + }; } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JsViews >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@ -4174,7 +4314,7 @@ $observe = $observable.observe; // Event handlers //=============== -function updateValues(sourceValues, tagElse, bindId, ev) { +function updateValues(sourceValues, tagElse, async, bindId, ev) { // Observably update a data value targeted by the binding.to binding of a 2way data-link binding. Called when elem changes // Called when linkedElem of a tag control changes: as updateValue(val, index, tagElse, bindId, ev) - this: undefined // Called directly as tag.updateValues(val1, val2, val3, ...) - this: tag @@ -4277,7 +4417,7 @@ function updateValues(sourceValues, tagElse, bindId, ev) { exprOb = exprOb.sb; } } - $observable(target).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object + $observable(target, async).setProperty(to[1], sourceValue); // 2way binding change event - observably updating bound object } } } @@ -4640,10 +4780,10 @@ function arrayChangeHandler(ev, eventArgs) { // array change handler for 'array' self._.srt = eventArgs.refresh; // true if part of a 'sort' on refresh switch (action) { case "insert": - self.addViews(index, items); + self.addViews(index, items, eventArgs._dly); break; case "remove": - self.removeViews(index, items.length); + self.removeViews(index, items.length, undefined, eventArgs._dly); break; case "move": self.moveViews(eventArgs.oldIndex, index, items.length); @@ -4837,6 +4977,7 @@ function addBindingMarkers(value, view, tag) { function observeAndBind(linkCtx, source, target) { var binding, l, k, linkedElem, exprFnDeps, exprOb, prop, propDeps, depends, tagDepends, bindId, linkedElems, tag = linkCtx.tag, + allowArray = !tag, cvtBk = linkCtx.convertBack, handler = linkCtx._hdl; source = typeof source === "object" && source; // If not an object set to false @@ -4882,6 +5023,7 @@ function observeAndBind(linkCtx, source, target) { } } } + allowArray = tag.onArrayChange === undefined || tag.onArrayChange === true; } l = exprFnDeps.length; @@ -4894,7 +5036,7 @@ function observeAndBind(linkCtx, source, target) { } } binding = $observable._apply( - 1, // Use as 'this' pointer - arbitrary + allowArray ? 0 : 1, // 'this' pointer for observeAndBind, used to set allowArray to 1 or 0. [source], exprFnDeps, // flatten the paths - to gather all the dependencies across args and bound params depends, @@ -5145,7 +5287,7 @@ function viewLink(outerData, parentNode, prevNode, nextNode, html, refresh, cont } } } - if (elCnt) { + if (elCnt && !inTag) { // elContent maps tagNames which have only element content, so may not support script nodes. // We are in element-only content, can remove white space, and use data-jsv attributes on elements as markers // Example: - close marker for view 2 and open marker for view 6 @@ -5764,8 +5906,10 @@ function addDataBinding(late, linkMarkup, node, currentView, boundTagId, isLink, function bindDataLinkTarget(linkCtx, late) { // Add data link bindings for a link expression in data-link attribute markup function handler(ev, eventArgs) { - onDataLinkedTagChange.call(linkCtx, ev, eventArgs); // If the link expression uses a custom tag, the onDataLinkedTagChange call will call renderTag, which will set tagCtx on linkCtx + if (!eventArgs || !eventArgs.refresh) { + onDataLinkedTagChange.call(linkCtx, ev, eventArgs); + } } var view, linkCtxType = linkCtx.type; @@ -6570,14 +6714,17 @@ function updateValue(val, index, tagElse, async, bindId, ev) { if (self && self._tgId) { bindId = self; } - values[index||0] = val; - if (async) { - setTimeout(function() { - updateValues(values, tagElse, bindId, ev); - }); - } else { - updateValues(values, tagElse, bindId, ev); + if (arguments.length < 4) { + if (+index !== index) { + async = index; + tagElse = index = 0; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } } + values[index||0] = val; + updateValues(values, tagElse, async, bindId, ev); return self; } @@ -6603,8 +6750,9 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta var filtered, nodes = $(this.nodes()); if (nodes[0]) { + select = deep ? select || "*" : select; filtered = select ? nodes.filter(select) : nodes; - nodes = deep && select ? filtered.add(nodes.find(select)) : filtered; + nodes = deep ? filtered.add(nodes.find(select)) : filtered; } return nodes; }; @@ -6766,7 +6914,21 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theTag.updateValue = updateValue; theTag.updateValues = function() { - return updateValues(arguments, undefined, this); + var tagElse, async, + tag = this, + bindToLength = tag.bindTo ? tag.bindTo.length : 1, + extra = arguments.length - bindToLength; + + if (extra) { + tagElse = arguments[bindToLength]; + if (extra > 1) { + async = extra > 1 ? arguments[bindToLength + 1] : undefined; + } else if (+tagElse !== tagElse) { + async = tagElse; + tagElse = 0; + } + } + return updateValues(arguments, tagElse, async, this); }; theTag.setValues = function() { @@ -6820,7 +6982,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta theView = tagOrView; // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - theView.addViews = function(index, dataItems) { + theView.addViews = function(index, dataItems, delayed) { // if view is not an array view, do nothing var i, viewsCount, view = this, @@ -6831,16 +6993,15 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta // view is of type "array" viewsCount = views.length + itemsCount; - if (viewsCount === view.data.length // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) - && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false) { - if (!view._.srt) { // Not part of a 'sort' on refresh - view.fixIndex(index + itemsCount); - } + if ((delayed || viewsCount === view.data.length) // If delayed or if views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && renderAndLink(view, index, view.tmpl, views, dataItems, view.ctx) !== false + && !view._.srt) { // Not part of a 'sort' on refresh + view.fixIndex(index + itemsCount); } } }; - theView.removeViews = function(index, itemsCount, keepNodes, isMove) { + theView.removeViews = function(index, itemsCount, keepNodes, delayed) { // view.removeViews() removes all the child views // view.removeViews(index) removes the child view with specified index or key // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index @@ -6924,7 +7085,7 @@ function addLinkMethods(tagOrView) { // tagOrView is View prototype or tag insta } } if (isArray && itemsCount - && (isMove || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) + && (delayed || viewsCount - itemsCount === view.data.length)) { // If views not already synced to array (e.g. triggered by array.length propertyChange - jsviews/issues/301) current = index + itemsCount; // Remove indexed items (parentView is data array view); while (current-- > index) { @@ -7174,6 +7335,7 @@ $tags({ } }, onUpdate: false, + onArrayChange: false, onUnbind: function() { var self = this, oldIsCleanCall = isCleanCall; @@ -7312,16 +7474,7 @@ $extend($tags["for"], { ev.done = true; }, onUpdate: function(ev, eventArgs, tagCtxs) { - var tagCtx, props, - tag = this, - l = tagCtxs.length; - while (l--) { - tagCtx = tagCtxs[l]; - props = tagCtx.props; - tagCtx.argDefault = props.end === undefined || tagCtx.args.length > 0; // Default to #data except for auto-create range scenario {{for start=xxx end=yyy step=zzz}} - props.dataMap = (tagCtx.argDefault !== false && $isArray(tagCtx.args[0]) - && (props.sort !== undefined || tagCtx.params.props.start || tagCtx.params.props.end || props.step !== undefined || props.filter || props.reverse)) && tag.sortDataMap; - } + this.setDataMap(tagCtxs); }, onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var data, @@ -17755,4 +17908,4 @@ module.exports = $ ? $.templates("./test/templates/name-template.html", mkup) : }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[3]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJqc3ZpZXdzLmpzIiwibm9kZV9tb2R1bGVzL2pxdWVyeS9kaXN0L2pxdWVyeS5qcyIs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GFyYW1zICAgICAgICAgICAgc2xhc2ggICBiaW5kMiAgICAgICAgIGNsb3NlQmxrICBjb21tZW50XG4vKD86eyhcXF4pP3soPzooXFx3Kyg/PVtcXC9cXHN9XSkpfChcXHcrKT8oOil8KD4pfChcXCopKVxccyooKD86W159XXx9KD8hfSkpKj8pKFxcLyk/fHsoXFxeKT97KD86KD86XFwvKFxcdyspKVxccyp8IS0tW1xcc1xcU10qPy0tKSl9fS9nXG5cbig/OlxuICB7KFxcXik/eyAgICAgICAgICAgIGJpbmRcbiAgKD86XG4gICAgKFxcdysgICAgICAgICAgICAgdGFnTmFtZVxuICAgICAgKD89W1xcL1xcc31dKVxuICAgIClcbiAgICB8XG4gICAgKFxcdyspPyg6KSAgICAgICAgY29udmVydGVyIGNvbG9uXG4gICAgfFxuICAgICg+KSAgICAgICAgICAgICAgaHRtbFxuICAgIHxcbiAgICAoXFwqKSAgICAgICAgICAgICBjb2RlVGFnXG4gIClcbiAgXFxzKlxuICAoICAgICAgICAgICAgICAgICAgcGFyYW1zXG4gICAgKD86W159XXx9KD8hfSkpKj9cbiAgKVxuICAoXFwvKT8gICAgICAgICAgICAgIHNsYXNoXG4gIHxcbiAgeyhcXF4pP3sgICAgICAgICAgICBiaW5kMlxuICAoPzpcbiAgICAoPzpcXC8oXFx3KykpXFxzKiAgIGNsb3NlQmxvY2tcbiAgICB8XG4gICAgIS0tW1xcc1xcU10qPy0tICAgIGNvbW1lbnRcbiAgKVxuKVxufX0vZ1xuXG4qL1xuXHRcdGlmIChjb2RlVGFnICYmIGJpbmQgfHwgc2xhc2ggJiYgIXRhZ05hbWUgfHwgcGFyYW1zICYmIHBhcmFtcy5zbGljZSgtMSkgPT09IFwiOlwiIHx8IGJpbmQyKSB7XG5cdFx0XHRzeW50YXhFcnJvcihhbGwpO1xuXHRcdH1cblxuXHRcdC8vIEJ1aWxkIGFic3RyYWN0IHN5bnRheCB0cmVlIChBU1QpOiBbdGFnTmFtZSwgY29udmVydGVyLCBwYXJhb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JhbC5qUXVlcnkgPSBqUXVlcnk7IC8vIFJlcGxhY2UgUVVuaXQgZ2xvYmFsIGpRdWVyeVxufSk7XG59XG59KSgpO1xuIiwidmFyIHRtcGxSZWZzID0gW10sXG4gIG1rdXAgPSAnTmFtZToge3s6bmFtZX19IChuYW1lLXRlbXBsYXRlLmh0bWwpJyxcbiAgJCA9IGdsb2JhbC5qc3JlbmRlciB8fCBnbG9iYWwualF1ZXJ5O1xuXG5tb2R1bGUuZXhwb3J0cyA9ICQgPyAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sXCIsIG1rdXApIDpcbiAgZnVuY3Rpb24oJCkge1xuICAgIGlmICghJCB8fCAhJC52aWV3cykge3Rocm93IFwiUmVxdWlyZXMganNyZW5kZXIvalF1ZXJ5XCI7fVxuICAgIHdoaWxlICh0bXBsUmVmcy5sZW5ndGgpIHtcbiAgICAgIHRtcGxSZWZzLnBvcCgpKCQpOyAvLyBjb21waWxlIG5lc3RlZCB0ZW1wbGF0ZVxuICAgIH1cblxuICAgIHJldHVybiAkLnRlbXBsYXRlcyhcIi4vdGVzdC90ZW1wbGF0ZXMvbmFtZS10ZW1wbGF0ZS5odG1sXCIsIG1rdXApXG4gIH07Il19 diff --git a/test/unit-tests/tests-jsobservable-withIE.js b/test/unit-tests/tests-jsobservable-withIE.js new file mode 100644 index 0000000..f3b2b86 --- /dev/null +++ b/test/unit-tests/tests-jsobservable-withIE.js @@ -0,0 +1,5077 @@ +/* test, equal, module, ok*/ +(function($, undefined) { +"use strict"; + +// =============== INIT APP =============== + +var isIE8 = window.attachEvent && !window.addEventListener, + viewContent, before, after, lastEvData, lastEventArgs, listeners, result1, handlersCount, elems, + result = "", + calls = 0; + +function reset() { + result = ""; + calls = 0; +} + +function myListener(ev, eventArgs) { + calls++; + lastEventArgs = eventArgs; + lastEvData = ev.data; + + switch (eventArgs.change) { + case "set": + var oldValue = eventArgs.oldValue, + value = eventArgs.value; + + oldValue = (typeof oldValue === "function") + ? (oldValue = "" + oldValue, oldValue.slice(0, oldValue.indexOf("{"))) + : "" + oldValue === oldValue + ? oldValue + : JSON.stringify(oldValue); + value = (typeof value === "function") + ? (value = "" + value, value.slice(0, value.indexOf("{"))) + : "" + value === value + ? value + : JSON.stringify(value); + result += "calls: " + calls + + ", ev.data: prop: " + ev.data.prop + (ev.data.paths.length ? ", path: " + ev.data.paths.join(", ") : "") + + ", eventArgs: oldValue: " + oldValue + " value: " + value + ", eventArgs.path: " + eventArgs.path + "|"; + break; + case "insert": + case "remove": + case "move": + case "refresh": + result += "regularCallbackCalls: " + calls + + ", eventArgs: change: " + eventArgs.change + "|"; + break; + default: + throw "Error"; + } +} + +// =============== Model =============== +function fullName(reverse, upper) { + var name = reverse ? (this.lastName + " " + this.firstName()) : this.firstName() + " " + this.lastName; + return upper ? name.toUpperCase() : name; +} + +fullName.depends = function(object) { // object is also the this pointer, so we could write function(this) below + return [ + "firstName", + function(object) { + return "lastName"; + } + ]; +}; + +fullName.set = function(val) { + val = val.split(" "); + $.observable(this).setProperty({ + lastName: val.pop(), + firstName: val.join(" ") + }); +}; + +var Person = function(first, last, home) { + this._firstName = first; + this.lastName = last; + this.home = home; +}, + + personProto = { + firstName: function() { + return settings.title + " " + this._firstName; + }, + fullName: fullName + }; + +personProto.firstName.set = function(val) { + this._firstName = val; +}; + +Person.prototype = personProto; + +function updown(val, lower) { + lower = this.tagCtx.props.lower !== undefined ? this.tagCtx.props.lower : lower; + val = person1.firstName() + (val || ""); + return (lower === true ? val.toLowerCase() : val.toUpperCase()) + settings.width + this.tagCtx.props.added; +} + +function sort(array) { + var ret = ""; + if (this.tagCtx.props.reverse) { + // Render in reverse order + if (arguments.length > 1) { + for (i = arguments.length; i; i--) { + ret += sort.call(this, arguments[i - 1]); + } + } else for (var i = array.length; i; i--) { + ret += this.tagCtx.render(array[i - 1]); + } + } else { + // Render in original order + ret += this.tagCtx.render(array); + } + return ret; +} + +// =============== DATA =============== + +function onFoo1() {return; } + +var address1 = {street: "StreetOne", ZIP: "111"}, + address2 = {street: "StreetTwo", ZIP: "222"}, + home1 = {address: address1}, + home2 = {address: address2}, + homeOfOwner = {address: {street: "OwnerStreet"}}, + person1 = new Person("Jo", "One", home1), + person2 = new Person("Xavier", "Two", home2), + + settings = { + owner: new Person("Mr", "Owner", homeOfOwner), + width: 30, + reverse: true, + upper: updown, + title: "Mr", + onFoo: onFoo1 + }, + + model = { + person1: person1, + person2: person2, + things: [] + }, + + people = [person1, person2]; + +personProto.firstName.depends = [settings, "title"]; + +updown.depends = function() { + return [this, "firstName", "~settings.width"]; +}; + +// =============== Callbacks for observeAll =============== +function observeAllCb1(ev, eventArgs) { + if (!eventArgs.refresh) { + result += "ObserveAll Path: " + ev.data.observeAll.path() + " eventArgs: "; + for (var key in eventArgs) { + result += key + ": " + JSON.stringify(eventArgs[key]) + "|"; + } + } +} + +function observeAllCb2(ev, eventArgs) { + if (!eventArgs.refresh) { + result += "ObserveAll Path: " + ev.data.observeAll.path() + " eventArgs: "; + for (var key in eventArgs) { + result += key + ": " + eventArgs[key] + "|"; + } + } +} + +function observeAllCb3(ev, eventArgs) {} + +QUnit.module("API - PropertyChange"); + +QUnit.test("PropertyChange: setProperty()", function(assert) { + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + + // =============================== Arrange =============================== + reset(); + $.observable(undefined).setProperty("street", "abc"); + + // ............................... Assert ................................. + assert.equal(result, "", + "$.observable(undefined).setProperty(...) does nothing"); + + // =============================== Arrange =============================== + reset(); + $.observe(person1.home.address, "street", myListener); + + // ................................ Act .................................. + $.observable(person1.home.address).setProperty("street", "newValue"); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: street, eventArgs: oldValue: StreetOne value: newValue, eventArgs.path: street|", + "setProperty triggers 'observable.observe() callbacks with ev and eventArgs correctly populated"); + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + result1 = result; + reset(); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.observable(person1.home).setProperty("address.street", "newValue"); + + // ............................... Assert ................................. + assert.equal(result, result1, + "setProperty on deep path is equivalent to setProperty on last object before leaf"); + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + reset(); + + // =============================== Teardown =============================== + + $.unobserve(); + $.unobserve(person1.home.address, "street", myListener); + + // =============================== Arrange =============================== + var person = {dob: "10/24/1990"}; + + $.observe(person, "dob", myListener); + + // ................................ Act .................................. + $.observable(person).setProperty("dob", "10/24/1991"); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: dob, eventArgs: oldValue: 10/24/1990 value: 10/24/1991, eventArgs.path: dob|", + "setProperty to date as string"); + + // ................................ Reset ................................ + reset(); + + // ................................ Act .................................. + var dt = new Date("10/24/1980"); + + $.observable(person).setProperty("dob", dt); + + // ............................... Assert ................................. + assert.equal(result, isIE8 ? 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: 10/24/1991 value: \"1980-10-24T07:00:00Z\", eventArgs.path: dob|' + : 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: 10/24/1991 value: "1980-10-24T07:00:00.000Z", eventArgs.path: dob|', + "setProperty to Date object"); + + // ................................ Reset ................................ + reset(); + + // ................................ Act .................................. + var dt2 = new Date(dt); + dt2.setDate(dt2.getDate() + 2); + + $.observable(person).setProperty("dob", dt2); + + // ............................... Assert ................................. + assert.equal(result, isIE8 ? 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: \"1980-10-24T07:00:00Z\" value: \"1980-10-26T07:00:00Z\", eventArgs.path: dob|' + : 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: "1980-10-24T07:00:00.000Z" value: "1980-10-26T07:00:00.000Z", eventArgs.path: dob|', + "setProperty to another Date object"); + + // ................................ Reset ................................ + reset(); + + // ................................ Act .................................. + $.observable(person).setProperty("dob", "1/24/2002"); + + // ............................... Assert ................................. + assert.equal(result, isIE8 ? 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: \"1980-10-26T07:00:00Z\" value: 1/24/2002, eventArgs.path: dob|' + : 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: "1980-10-26T07:00:00.000Z" value: 1/24/2002, eventArgs.path: dob|', + "setProperty to date as string"); + + // ................................ Reset ................................ + reset(); + $.unobserve(person, "dob", myListener); + +}); + +QUnit.module("API - ArrayChange"); + +QUnit.test("JsObservable: insert()", function(assert) { + + // =============================== Arrange =============================== + var things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(0, "a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "a 1 2", + 'insert(0, "a") inserts at 0'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(1, "a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 a 2", + 'insert(1, "a") inserts at 1'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(2, "a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 a", + 'insert(2, "a") inserts at 2'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert("a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 a", + 'insert("a") appends'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(1, ["a", "b"]); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 a b 2", + 'insert(1, ["a", "b"]) inserts multiple elements at 1'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(["a", "b", "c"]); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 a b c", + 'insert(["a", "b", "c"]) appends multiple elements'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert("1", "b"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 b 2", + 'insert("1", "b") treats first param as index and inserts at 1'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert("0", "b"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "b 1 2", + 'insert("0", "b") treats first param as index and inserts at 0'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert("a", "b"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'insert("a", "b") does nothing - since parseInt("a") is NaN'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert("1a", "b"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 b 2", + 'insert("1a", "b") inserts "b" at 1 - since parseInt("1a") is 1'); + + // =============================== Arrange =============================== + things = []; + + // ................................ Act .................................. + $.observable(things).insert("a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "a", + 'insert("a") still appends "a", correctly if array is empty at first'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(1); + + // ............................... Assert ................................. + assert.equal(things.join(" ") + (things[2] === 1), "1 2 1true", + 'insert(1) appends 1'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(0); + + // ............................... Assert ................................. + assert.equal(things.join(" ") + (things[2] === 0), "1 2 0true", + 'insert(0) appends 0'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(undefined); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 ", + 'insert(undefined) appends undefined'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(1, undefined); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'insert(1, undefined) inserts undefined'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(0, undefined); + + // ............................... Assert ................................. + assert.equal(things.join(" "), " 1 2", + 'insert(0, undefined) inserts undefined'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert([undefined, null, 0, 1, "2"]); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 0 1 2", + 'insert(1, [undefined, null, 0, 1, "2"]) inserts correctly'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert("a", "b"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'insert("a", "b") does nothing - since parseInt("a") is NaN'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(-1, "a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'insert(-1, "a") does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).insert(10, "a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 a", + 'insert(10, "a") (out of range) appends'); +}); + +QUnit.test("JsObservable: remove()", function(assert) { + + // =============================== Arrange =============================== + var things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove(0); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "2", + 'remove(0) removes 1 item at 0'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove(1); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1", + 'remove(1) removes 1 item at 1'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove(2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'remove(2) does nothing (out of range'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove(); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1", + 'remove() removes from end'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).remove(1, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 4", + 'remove(1, 2) removes multiple items at 1'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).remove(1, 10); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1", + 'remove(1, 10) removes all relevant items'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).remove("1c", "2.001 euros"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 4", + 'remove("1c", "2.001 euros") does parseInt and removes 2 items at 1'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove("a"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'remove("a") does nothing - since parseInt("a") is NaN'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove("a", "b"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'remove(1, "b") does nothing - since parseInt("b") is NaN'); + + // =============================== Arrange =============================== + things = []; + + // ................................ Act .................................. + $.observable(things).remove(); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "", + 'remove() does nothing if array is empty at first'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove(-1); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'remove(-1) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove(10); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'remove(10, "a") (out of range) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2"]; + + // ................................ Act .................................. + $.observable(things).remove(10); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2", + 'remove(10) (out of range) does nothing'); +}); + +QUnit.test("JsObservable: move()", function(assert) { + + // =============================== Arrange =============================== + var things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 3 2 4", + 'move(1, 2) moves 1 item from 1 to 2 - so swaps them'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(2, 1); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 3 2 4", + 'move(1, 2) moves 1 item from 2 to 1 - so swaps them'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 3); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 3 4 2", + 'move(1, 2) moves 1 item at from 1 to 3'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 2, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 4 2 3", + 'move(1, 2, 2) moves 2 items at from 1 to 2'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 3, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 4 2 3", + 'move(1, 3, 2) moves 2 items from 1 to 2 - same as if moving to 2, since hits the end of the array'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 2, 3); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(1, 2, 3) moves 3 items from 1 to 2 - which does nothing since hits the end of the array'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 6, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 4 2 3", + 'move(1, 6, 2) moves 2 items from 1 to 6 - same as if moving to 2, since hits the end of the array'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 1); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(1, 1) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 1, 3); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(1, 1, 3) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(1) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move() does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(10, 0); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(10, 0) does nothing (out of range)'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(0, 10); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "2 3 4 1", + 'move(0, 10) moves item 0 to the end (out of range)'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(3, 0, 6); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "4 1 2 3", + 'move(3, 0, 6) moves any items that are not out of range'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(-1, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(-1, 2) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(-1, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(-1, 2) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, -1); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(1, -1) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move(1, 2, -1); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move(1, 2, -1) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("a", 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move("a", 2) does nothing'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("1c", "2.001 euros", "2px"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 4 2 3", + 'move("1c", "2.001 euros, "2px") does parseInt and moves 2 items from 1 to 2'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("c", "2.001 euros", "2px"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move("c", "2.001 euros, "2px") does nothing since parseInt("c") is NaN'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("1c", "euros", "2px"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move("1c", "euros, "2px") does nothing since parseInt("euros") is NaN'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("1c", "2.001 euros", "px"); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move("1c", "2.001 euros, "px") does nothing since parseInt("px") is NaN'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("1c", "2.001 euros", undefined); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 3 2 4", + 'move("1c", "2.001 euros, undefined) moves 1'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("1c", "2.001 euros", null); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 3 2 4", + 'move("1c", "2.001 euros, null) moves 1'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("1c", undefined); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move("1c", undefined) does does nothing since parseInt(undefined) is NaN'); + + // =============================== Arrange =============================== + things = ["1", "2", "3", "4"]; + + // ................................ Act .................................. + $.observable(things).move("1c", null); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "1 2 3 4", + 'move("1c", null) does does nothing since parseInt(null) is NaN'); + + // =============================== Arrange =============================== + things = []; + + // ................................ Act .................................. + $.observable(things).move(1, 2); + + // ............................... Assert ................................. + assert.equal(things.join(" "), "", + 'move(1, 2) does nothing if array is empty'); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.module("API - $.observe() (jso)"); + +QUnit.test("depends, for computed observables", function(assert) { + + // =============================== Arrange =============================== + var added = "NO", cbs = []; + + function trigger() { + var l = cbs.length; + while (l--) { + cbs[l](); + } + } + + function callback1(ev, eventArgs) { + out1 = app.person.fullName(); + } + + function callback2(ev, eventArgs) { + out2 = app.person.fullName(); + } + + function fullName(val) { + return this._first + this._last + this.more + added; + } + + fullName.depends = function(person, callback) { + cbs.push(callback); + return callback === callback1 + ? ["_first", "_last", "more"] + : ["_first", "_last"]; + }; + + var out1 = "", + out2 = "", + app = {}; + + // ................................ Act .................................. + $.observe(app, "person^fullName", "more", callback1); + + $.observe(app, "person^fullName", callback2); + + result = out1 + out2 + cbs.length + "|"; + + $.observable(app).setProperty("person", { + fullName: fullName, + _first: "Jo", + _last: "Blow", + more: "" + }); + + result += out1 + " " + out2 + " " + cbs.length; + + // ............................... Assert ................................. + assert.equal(result, "0|JoBlowNO JoBlowNO 2", + 'Depends for computed observable is called once during each new handler binding of observable object (before calling handler)'); + + // ................................ Act .................................. + $.observable(app).setProperty("person.more", "SomeMore"); + + result = out1 + " " + out2; + + // ............................... Assert ................................. + assert.equal(result, "JoBlowSomeMoreNO JoBlowNO", + 'Can set different depends for different binding of same computed observable (here, only first depends expression has "more")'); + + // ................................ Act .................................. + $.observable(app).setProperty("person._first", "Pete"); + + result = out1 + " " + out2; + + // ............................... Assert ................................. + assert.equal(result, "PeteBlowSomeMoreNO PeteBlowSomeMoreNO", + 'Both handlers fire, since "_first" and "_last" are in both depends expressions'); + + // ................................ Act .................................. + added = "YES"; + + trigger(); + + result = out1 + " " + out2; + + // ............................... Assert ................................. + assert.equal(result, "PeteBlowSomeMoreYES PeteBlowSomeMoreYES", + 'Can manually trigger handlers copied from depends function call, for later updates from non-observable changes'); + + // =============================== Teardown =============================== + $.unobserve(); // Unobserve everything + // $.unobserve(app, app.person); // Or could do this... + + reset(); +}); + +QUnit.test("Array", function(assert) { + + $.views.settings.advanced({_jsv: true}); // For using _jsv + + // =============================== Arrange =============================== + // Using the same event handler for arrayChange and propertyChange + + var myArray = [1, 2]; + + // ................................ Act .................................. + $.observe(myArray, myListener); + + $.observable(myArray).insert(10); + + // ............................... Assert ................................. + assert.equal(result + $._data(myArray).events.arrayChange.length + " " + !$._data(myArray).events.propertyChange, + "regularCallbackCalls: 1, eventArgs: change: insert|1 true", + "$.observe(myArray, myListener) listens just to array change on the array"); + + // ................................ Act .................................. + reset(); + $.unobserve(myArray, myListener); + + $.observable(myArray).insert(11); + + // ............................... Assert ................................. + assert.equal(result + !$._data(myArray).events, "true", + "$.unobserve(myArray, myListener) removes the arraychange handler"); + + // ................................ Act .................................. + reset(); + $.observe(myArray, "length", myListener); + + $.observable(myArray).insert(14); + + // ............................... Assert ................................. + assert.equal(result + !$._data(myArray).events.arrayChange + " " + $._data(myArray).events.propertyChange.length, + "calls: 1, ev.data: prop: length, eventArgs: oldValue: 4 value: 5, eventArgs.path: length|true 1", + '$.observe(myArray, "length", myListener) listens to length propertyChange on the array, but not to array change on the array'); + + reset(); + + $.unobserve(myArray, "length", myListener); + + // ............................... Assert ................................. + assert.equal(result + !$._data(myArray).events, "true", + '$.unobserve(myArray, "length", myListener) removes the propertychange handler'); + + // ................................ Act .................................. + $.observe(myArray, myArray, "length", myListener); + + $.observable(myArray).insert(15); + + // ............................... Assert ................................. + assert.equal(result + !$._data(myArray).events.arrayChange + " " + $._data(myArray).events.propertyChange.length, + "calls: 1, ev.data: prop: length, eventArgs: oldValue: 5 value: 6, eventArgs.path: length|regularCallbackCalls: 2, eventArgs: change: insert|false 1", + '$.observe(myArray, myArray, "length", myListener) listens to length propertyChange on the array, and to array change on the array'); + + // ................................ Reset .................................. + reset(); + $.unobserve(myArray, myListener); + + // ................................ Act .................................. + $.observe(myArray, myListener); + $.observe(myArray, "length", myListener); + $.unobserve(myArray, myArray, "length", myListener); + + $.observable(myArray).insert(15); + + // ............................... Assert ................................. + assert.equal(result + !$._data(myArray).events, "true", + '$.unobserve(myArray, myArray, "length", myListener) removes the propertychange handler and the array handler'); + + // ................................ Reset .................................. + reset(); + $.unobserve(myArray, myListener); + + // =============================== Arrange =============================== + reset(); + + myArray = [1, 2, 3]; + + var done = false; + function listenAndChangeAgain(ev, eventArgs) { + myListener(ev, eventArgs); + if (!done && eventArgs.change === "remove") { + done = true; + $.observable(myArray).remove(); + } + } + + $.observe(myArray, listenAndChangeAgain); + $.observe(myArray, "length", listenAndChangeAgain); + + $.observable(myArray).remove(1); + + // ............................... Assert ................................. + assert.equal(result + $._data(myArray).events.arrayChange.length + " " + !$._data(myArray).events.propertyChange, + "calls: 1, ev.data: prop: length, eventArgs: oldValue: 3 value: 2, eventArgs.path: length|" + + "regularCallbackCalls: 2, eventArgs: change: remove|" + + "calls: 3, ev.data: prop: length, eventArgs: oldValue: 2 value: 1, eventArgs.path: length|" + + "regularCallbackCalls: 4, eventArgs: change: remove|1 false", + '$.observe(myArray, "length", listenAndChangeAgain) with cascading changes preserves expected order on callbacks for array and array.length change'); + + // ................................ Reset .................................. + $.unobserve(myArray, listenAndChangeAgain); + + // =============================== Arrange =============================== + reset(); + + var initialArray = [1, 2], + altArray = [4, 3, 2, 1], + obj = {name: {first: "n", arr: initialArray}}; + + $.observe(obj, "name.arr", myListener); + + // ................................ Act .................................. + $.observable(initialArray).insert(10); + + // ............................... Assert ................................. + assert.equal(result + $._data(initialArray).events.arrayChange.length + " " + $._data(obj.name).events.propertyChange.length + " " + !$._data(initialArray).events.propertyChange, + "regularCallbackCalls: 1, eventArgs: change: insert|1 1 true", + '$.observe(object, "a.b.myArray", myListener) listens to array change on the array, and to property change for setting the array'); + + // ................................ Act .................................. + reset(); + $.observable(obj).setProperty("name.arr", altArray); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: arr, eventArgs: oldValue: [1,2,10] value: [4,3,2,1], eventArgs.path: arr|", + '$.observe(object, "a.b.myArray", myListener) listens to property change for swapping the array property'); + + // ............................... Assert ................................. + reset(); + assert.equal(!$._data(initialArray).events + " " + $._data(altArray).events.arrayChange.length, "true 1", + '$.observable(obj).setProperty("name.arr", newArray) removes the arrayChange handler on previous array, and adds arrayChange to new array'); + + // ................................ Act .................................. + $.observable(obj.name.arr).insert(11); + + // ............................... Assert ................................. + assert.equal(result, "regularCallbackCalls: 1, eventArgs: change: insert|", + '$.observe(object, "a.b.myArray", myListener) listens to array changes on leaf array property (regular callback)'); + + // ................................ Act .................................. + handlersCount = $._data(obj.name).events.propertyChange.length + $._data(obj.name.arr).events.arrayChange.length; + $.unobserve(obj, "name.arr", myListener); + + // ............................... Assert ................................. + assert.ok(handlersCount === 2 && !$._data(obj.name).events && !$._data(obj.name.arr).events, + '$.unobserve(object, "a.b.myArray") removes both arrayChange and propertyChange event handlers'); + reset(); + + $.observe(obj, "name.arr", "name.arr.length", myListener); + + $.observable(obj.name.arr).insert(16); + + // ............................... Assert ................................. + assert.equal(result + $._data(obj.name.arr).events.arrayChange.length + " " + $._data(obj.name.arr).events.propertyChange.length + " " + $._data(obj.name).events.propertyChange.length, + "calls: 1, ev.data: prop: length, eventArgs: oldValue: 5 value: 6, eventArgs.path: length|" + + "regularCallbackCalls: 2, eventArgs: change: insert|1 1 1", + '$.observe(object, "a.b.array", "a.b.array.length", myListener) listens to array change on the array, to setting the array, and to length propertyChange on the array'); + + // ................................ Act .................................. + reset(); + $.unobserve(obj, "name.arr", "name.arr.length", myListener); + + $.observable(obj.name.arr).insert(17); + + // ............................... Assert ................................. + assert.equal(result + !$._data(obj.name.arr).events + " " + !$._data(obj.name).events, "true true", + '$.unobserve(object, "a.b.array", "a.b.array.length", myListener) removes the arraychange handler and the propertychange handlers'); + + // ................................ Act .................................. + $.observe(obj, "name.arr^length", myListener); + + $.observable(obj.name.arr).insert(16); + + // ............................... Assert ................................. + assert.equal(result + !$._data(obj.name.arr).events.arrayChange + " " + $._data(obj.name.arr).events.propertyChange.length + " " + $._data(obj.name).events.propertyChange.length, + "calls: 1, ev.data: prop: length, eventArgs: oldValue: 7 value: 8, eventArgs.path: length|true 1 1", + '$.observe(object, "a.b.array^length", myListener) listens to setting array and changing array length, but not to arrayChange on the array'); + + // ................................ Act .................................. + reset(); + $.unobserve(obj, "name.arr^length", myListener); + + // ............................... Assert ................................. + assert.equal(result + !$._data(obj.name.arr).events + " " + !$._data(obj.name).events, "true true", + '$.unobserve(object, "a.b.array^length", myListener) removes the arraychange handler and the propertychange handler'); + + // ................................ Act .................................. + $.observe(obj, "name.*", myListener); + + $.observable(obj.name.arr).insert(18); + + $.observable(obj.name).setProperty({ + first: "1st", + notThereBefore: "2nd", + arr: initialArray + }); + $.observable(obj.name.arr).insert(19); + + // ............................... Assert ................................. + assert.equal(result + $._data(obj.name.arr).events.arrayChange.length + " " + $._data(obj.name).events.propertyChange.length + " " + !$._data(altArray).events, + "regularCallbackCalls: 1, eventArgs: change: insert|" + + "calls: 2, ev.data: prop: *, eventArgs: oldValue: n value: 1st, eventArgs.path: first|" + + "calls: 3, ev.data: prop: *, eventArgs: oldValue: undefined value: 2nd, eventArgs.path: notThereBefore|" + + "calls: 4, ev.data: prop: *, eventArgs: oldValue: [4,3,2,1,11,16,17,16,18] value: [1,2,10], eventArgs.path: arr|" + + "regularCallbackCalls: 5, eventArgs: change: insert|1 1 true", + '$.observe(object, "a.b.*", myListener) listens to all propertyChange events on object.a.b and to array change on any array properties of object.a.b'); + + // ................................ Act .................................. + reset(); + $.unobserve(obj, "name.*", myListener); + + $.observable(obj.name.arr).insert(17); + + // ............................... Assert ................................. + assert.equal(result + !$._data(obj.name.arr).events, "true", + '$.unobserve(object, "a.b.*", myListener) removes the propertychange handler and any arraychange handlers'); + + // =============================== Arrange =============================== + obj = {name: {first: "n", arr: initialArray}}; + var newArray1 = [1, 1], + newArray2 = [2, 2], + newArray3 = [3, 3]; + + reset(); + $.observe(obj, "name.*", myListener); + + $.observable(obj.name.arr).insert(18); + + $.observable(obj.name).setProperty({ + first: newArray1, + arrayNotThereBefore: newArray2, + arr: newArray3 + }); + $.observable(obj.name.first).insert(10); + $.observable(obj.name.arrayNotThereBefore).insert(11); + $.observable(obj.name.arr).insert(12); + + // ............................... Assert ................................. + assert.equal(result + !$._data(initialArray).events + " " + $._data(obj.name).events.propertyChange.length + " " + + $._data(newArray1).events.arrayChange.length + " " + $._data(newArray2).events.arrayChange.length + " " + $._data(newArray3).events.arrayChange.length, + "regularCallbackCalls: 1, eventArgs: change: insert|" + + "calls: 2, ev.data: prop: *, eventArgs: oldValue: n value: [1,1], eventArgs.path: first|" + + "calls: 3, ev.data: prop: *, eventArgs: oldValue: undefined value: [2,2], eventArgs.path: arrayNotThereBefore|" + + "calls: 4, ev.data: prop: *, eventArgs: oldValue: [1,2,10,19,17,18] value: [3,3], eventArgs.path: arr|" + + "regularCallbackCalls: 5, eventArgs: change: insert|" + + "regularCallbackCalls: 6, eventArgs: change: insert|" + + "regularCallbackCalls: 7, eventArgs: change: insert|" + + "true 1 1 1 1", + '$.observe(object, "a.b.*", myListener) listens to array change on any array properties of object.a.b whether intially present, or added subsequently'); + + // ................................ Act .................................. + reset(); + $.unobserve(obj, "name.*", myListener); + + $.observable(obj.name.arr).insert(17); + + // ............................... Assert ................................. + assert.equal(result + !$._data(obj.name.arr).events + " " + !$._data(newArray1).events + " " + !$._data(newArray1).events + " " + !$._data(newArray1).events, "true true true true", + '$.unobserve(object, "a.b.*", myListener) removes the propertychange handler and any arraychange handlers'); + + // =============================== Arrange =============================== + // Using an array event handler + obj = {name: {first: "n", arr: [1, 2]}}; + + myListener.array = function(ev, eventArgs) { + result += "arrayListenerCalls: " + calls + + ", eventArgs: change: " + eventArgs.change + "|"; + }; + + $.observe(obj, "name.arr", myListener); + + // ................................ Act .................................. + reset(); + $.observable(obj).setProperty("name.arr", [4, 3, 2, 1]); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: arr, eventArgs: oldValue: [1,2] value: [4,3,2,1], eventArgs.path: arr|", + '$.observe(object, "a.b.myArray", cbWithArrayCallback) listens to property change for swapping the array property'); + + // ................................ Act .................................. + reset(); + $.observable(obj.name.arr).insert(12); + + // ............................... Assert ................................. + assert.equal(result, "arrayListenerCalls: 0, eventArgs: change: insert|", + '$.observe(object, "a.b.myArray", cbWithArrayCallback) listens also to array changes on leaf array property (array callback handler)'); + + // ................................ Act .................................. + handlersCount = $._data(obj.name.arr).events.arrayChange.length + " " + $._data(obj.name).events.propertyChange.length; + $.unobserve(obj, "name.arr", myListener); + + // ............................... Assert ................................. + assert.ok(handlersCount === "1 1" && !$._data(obj.name.arr).events && !$._data(obj.name).events, + '$.unobserve(object, "a.b.myArray") removes arrayChange and propertyChange event handlers'); + + // =============================== Arrange =============================== + $.observe(obj.name.arr, myListener); + + // ................................ Act .................................. + reset(); + $.observable(obj.name.arr).insert(13); + + // ............................... Assert ................................. + assert.equal(result, "arrayListenerCalls: 0, eventArgs: change: insert|", + '$.observe(myArray, cbWithArrayCallback) listens to array changes (array callback handler)'); + // ................................ Act .................................. + handlersCount = $._data(obj.name.arr).events.arrayChange.length; + $.unobserve(obj.name.arr, myListener); + + // ............................... Assert ................................. + assert.ok(handlersCount === 1 && !$._data(obj.name.arr).events, + '$.unobserve(myArray) removes arrayChange event handler'); + // ----------------------------------------------------------------------- + + // =============================== Arrange =============================== + var people = [1, 2]; + function onch() {} + function onch2() {} + + // ................................ Act .................................. + $.observe(people, "length", onch); + $.observe(people, "length", onch2); + $.observe(people, "length2", onch); + $.observe(people, "length2", onch2); + $.unobserve(people, "length2", onch); + $.unobserve(people, "length2", onch2); + $.unobserve(people, "length", onch); + $.unobserve(people, "length", onch2); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(people).events]), "[{},null]", + "observe/unobserve array - API calls in different orders: all bindings removed when unobserve called"); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("observe/unobserve alternative signatures", function(assert) { + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + person1.home.address.ZIP = "111"; // reset Prop + $.views.settings.advanced({_jsv: true}); // For using _jsv + reset(); + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(person1.home.address, "street", myListener); + $.observable(person1.home.address).setProperty("street", "newValue"); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: street, eventArgs: oldValue: StreetOne value: newValue, eventArgs.path: street|", + "$.observe(object, path, myListener)"); + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + reset(); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.unobserve(person1.home.address, "street", myListener); + $.observable(person1.home.address).setProperty("street", "newValue"); + + // ............................... Assert ................................. + assert.equal(result, "", + "$.unobserve(object, path, myListener)"); + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + reset(); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.observe(person1.home.address, "street", "ZIP", myListener); + $.observable(person1.home.address).setProperty({street: "newValue", ZIP: "newZip"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: street, eventArgs: oldValue: StreetOne value: newValue, eventArgs.path: street|" + + "calls: 2, ev.data: prop: ZIP, eventArgs: oldValue: 111 value: newZip, eventArgs.path: ZIP|", + "$.observe(object, path1, path2, myListener)"); + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + person1.home.address.ZIP = "111"; // reset Prop + reset(); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.unobserve(person1.home.address, "street", "ZIP", myListener); + $.observable(person1.home.address).setProperty({street: "newValue", ZIP: "newZip"}); + + // ............................... Assert ................................. + assert.equal(result, "", + "$.unobserve(object, path1, path2, myListener) removes previous handlers"); + + // ................................ Reset ................................ + person1.home.address.street = "StreetOne"; // reset Prop + person1.home.address.ZIP = "111"; // reset Prop + reset(); + + // =============================== Arrange =============================== + var person = {last: " L"}; + function onch(ev, eventArgs) {} + function onch2(ev, eventArgs) {} + + // ................................ Act .................................. + $.observe(person, "last", onch); + $.observe(person, "last", onch2); + $.unobserve(person, "last", onch); + $.unobserve(person, "last", onch2); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "observe/unobserve API calls in different orders: all bindings removed when unobserve called"); + + // =============================== Arrange =============================== + person = {first: "F", last: " L"}; + + // ................................ Act .................................. + $.observe(person, "last", onch); + $.observe(person, "last", onch2); + $.observe(person, "first", onch); + $.observe(person, "first", onch2); + $.unobserve(person, "last", onch); + $.unobserve(person, "last", onch2); + $.unobserve(person, "first", onch); + $.unobserve(person, "first", onch2); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "observe/unobserve API calls in different orders (version 2): all bindings removed when unobserve called"); + + // =============================== Arrange =============================== + person = { + name: "Pete", + address: { + street: "1st Ave" + }, + phones: [{number: "111 111 1111"}, {number: "222 222 2222"}] + }; + + // ................................ Act .................................. + $.observe(person, "name", myListener); + $.unobserve(person, "name", myListener); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve with path and handler works"); + + // ................................ Act .................................. + $.observe(person, "name", myListener); + $.unobserve(person, myListener); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve without path works"); + + // ................................ Act .................................. + $.observe(person, "name", myListener); + $.unobserve(person, "name"); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve without handler works"); + + // ................................ Act .................................. + $.observe(person, "name", myListener); + $.unobserve(person); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve without path and handler works"); + + // ................................ Act .................................. + $.observe(person, "name", myListener); + $.unobserve(myListener); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve with handler only works"); + + // ................................ Act .................................. + $.observe(person, "name", myListener); + $.unobserve(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve() (unobserves all) works"); + + // ................................ Act .................................. + $.observe(person, "name", "address^street", "phones", myListener); + $.unobserve(person, "name", "address^street", "phones", myListener); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events, $._data(person.address).events, $._data(person.phones).events]), "[{},null,null,null]", + "unobserve with multiple paths and handler works"); + + // ................................ Act .................................. + $.observe(person, "name", "address^street", "phones", myListener); + $.unobserve(person, "*", person.address, "*"); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events, $._data(person.address).events, $._data(person.phones).events]), "[{},null,null,null]", + "unobserve with deep paths using '*' works"); + + // ................................ Act .................................. + $.observe(person, "name", "address^street", "phones", myListener); + + $.unobserve(person, person.address, person.phones); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events, $._data(person.address).events, $._data(person.phones).events]), "[{},null,null,null]", + "unobserve(object1, object2) removes handlers from each object"); + + // ................................ Act .................................. + $.unobserve(person); + $.unobserve(person.address); + $.unobserve(person.phones); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events, $._data(person.address).events, $._data(person.phones).events]), "[{},null,null,null]", + "unobserve(object1) works"); + + // ................................ Act .................................. + $.observe(person, "phones", myListener); + $.unobserve(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events, $._data(person.address).events, $._data(person.phones).events]), "[{},null,null,null]", + "unobserve() removes handlers from all objects"); + + // ................................ Act .................................. + $.observe(person.phones, myListener); + $.unobserve(person.phones); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person.phones).events]), "[{},null]", + "unobserve for array works"); + + // ................................ Act .................................. + function notBound() {} + + $.observe(person, "name", "address^street", "phones", myListener); + $.unobserve(person, person.address, person.phones, notBound); + + // ............................... Assert ................................. + assert.equal("" + $._data(person).events.propertyChange.length + $._data(person.address).events.propertyChange.length + $._data(person.phones).events.arrayChange.length, + "311", + "unobserve(object1, object2, unboundHandler) with another (unused) handler does nothing"); + + // ................................ Act .................................. + $.unobserve(notBound); + + // ............................... Assert ................................. + assert.equal("" + $._data(person).events.propertyChange.length + $._data(person.address).events.propertyChange.length + $._data(person.phones).events.arrayChange.length, + "311", + "unobserve(unboundHandler) with another (unused) handler does nothing"); + + // ................................ Act .................................. + $.unobserve(myListener); + $.observe(person.phones, myListener); + $.unobserve(person.phones, notBound); + + // ............................... Assert ................................. + assert.equal("" + $._data(person.phones).events.arrayChange.length, "1", + "unobserve(array, unboundHandler), with another (unused) handler does nothing"); + + $.unobserve(myListener); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("observe/unobserve using namespaces", function(assert) { + function myListener2(ev, eventArgs) { + calls++; + result += "Listener2 change: " + eventArgs.change + " Handler ns: '" + ev.data.ns + "' Caller ns: '" + ev.namespace + "' calls: " + calls + "|"; + } + + function myListener3(ev, eventArgs) { + calls++; + result += "Listener3 change: " + eventArgs.change + " Handler ns: '" + ev.data.ns + "' Caller ns: '" + ev.namespace + "' calls: " + calls + "|"; + } + + $.views.settings.advanced({_jsv: true}); // For using _jsv + var thing = {val: "initVal"}; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe("my.nmspace", thing, "val", myListener); + reset(); + $.observable(thing).setProperty("val", "newVal"); + + // ............................... Assert ................................. + assert.equal(result + $._data(thing).events.propertyChange.length, + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|1", + "$.observe(namespace, object, path, cb)"); + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.unobserve("my.nmspace", thing); + reset(); + $.observable(thing).setProperty("val", "newVal"); + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(thing).events]), + "[{},null]", + "$.observe(namespace, object, path, cb); $.unobserve(namespace, object); removes all events added with the same namespace"); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace", thing, "val", myListener); + $.unobserve(thing); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(thing).events]), + "[{},null]", + "$.observe(namespace, object, path, cb); $.unobserve(object); removes all events even if added with the namespace"); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace", thing, "val", myListener); + $.unobserve("my2.nmspace", thing); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + + // ............................... Assert ................................. + assert.equal(result + $._data(thing).events.propertyChange.length, + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|1", + "$.observe(namespace, object, path, cb); $.unobserve(otherNamespace, object); does not remove events if added with a different namespace"); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace", thing, "val", myListener); + $.observe("your.nmspace", thing, "val", myListener); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + $.unobserve("my.nmspace", thing); + $.observable(thing).setProperty("val", "newVal2"); + + // ............................... Assert ................................. + assert.equal(result + $._data(thing).events.propertyChange.length, + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 2, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 3, ev.data: prop: val, eventArgs: oldValue: newVal value: newVal2, eventArgs.path: val|1", + "$.observe(namespace1, object, path, cb); $.observe(namespace2, object, path, cb); $.unobserve(namespace1, object); Add two events with different namespaces, then remove one of the namespaces - leaves the other handlers"); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace your.nmspace", thing, "val", myListener); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + $.unobserve("my.nmspace", thing); + $.observable(thing).setProperty("val", "newVal2"); + + // ............................... Assert ................................. + assert.equal(result + $._data(thing).events.propertyChange.length, + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 2, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 3, ev.data: prop: val, eventArgs: oldValue: newVal value: newVal2, eventArgs.path: val|1", + '$.observe("my.nmspace your.nmspace", object, path, cb); $.unobserve(my.nmspace, object); Whitepace separated namespaces adds events for each namespace, then remove one of the namespaces - leaves the other handlers - as in previous test'); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace", thing, "val", myListener); + $.observe("your.nmspace", thing, "val", myListener); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + $.unobserve("my.nmspace your.nmspace", thing); + $.observable(thing).setProperty("val", "newVal2"); + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(thing).events]), + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 2, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "[{},null]", + '$.unobserve("my.nmspace your.nmspace", object); $.unobserve with whitepace separated namespaces removes handler for each namespace'); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace", thing, "val", myListener); + $.observe("your.nmspace", thing, "val", myListener); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + $.unobserve("my your", thing); + $.observable(thing).setProperty("val", "newVal2"); + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(thing).events]), + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 2, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "[{},null]", + '$.unobserve("my your", object); $.unobserve with whitepace separated namespaces removes handler for each namespace'); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace", thing, "val", myListener); + $.observe("your.nmspace", thing, "val", myListener); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + $.unobserve("nmspace", thing); + $.observable(thing).setProperty("val", "newVal2"); + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(thing).events]), + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 2, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "[{},null]", + '$.observe("my.nmspace", object, path, cb); $.observe("your.nmspace", object, path, cb); $.unobserve("nmspace", object); removes all handlers for "nmspace" no matter what other namespaces were used ("my", "your", for example'); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + + // =============================== Arrange =============================== + $.observe("my.nmspace", thing, "val", myListener); + $.observe("your.nmspace", thing, "val", myListener); + + // ................................ Act .................................. + reset(); + $.observable(thing).setProperty("val", "newVal"); + $.unobserve("p_foo", thing); // does nothing - removes handlers that listened to changes of "foo" property - but there were none... + $.observable(thing).setProperty("val", "newVal2"); + $.unobserve("p_val", thing); // removes handlers that listened to changes of "val" property + $.observable(thing).setProperty("val", "newVal3"); + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(thing).events]), + "calls: 1, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 2, ev.data: prop: val, eventArgs: oldValue: initVal value: newVal, eventArgs.path: val|" + + "calls: 3, ev.data: prop: val, eventArgs: oldValue: newVal value: newVal2, eventArgs.path: val|" + + "calls: 4, ev.data: prop: val, eventArgs: oldValue: newVal value: newVal2, eventArgs.path: val|" + + "[{},null]", + 'Using the unobserve with namespace "p_val" will remove handlers that listened to changes of the "val" property'); + + // ................................ Reset ................................ + thing.val = "initVal"; // reset Prop + reset(); + + // =============================== Arrange =============================== + var person = { + name: "Pete", + address: { + street: "1st Ave" + }, + phones: [{number: "111 111 1111"}, {number: "222 222 2222"}] + }; + + // ................................ Act .................................. + $.observe("ns", person, "name", myListener); + $.unobserve("ns", person, "name", myListener); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve using namespaces, with path and handler works"); + + // ................................ Act .................................. + $.observe("ns", person, "name", myListener); + $.unobserve("ns", person); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve using namespaces, without path and handler works"); + + // ................................ Act .................................. + $.observe("ns", person, "name", "address^street", "phones", myListener); + $.unobserve("ns", person, "name", "address^street", "phones", myListener); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events, $._data(person.address).events, $._data(person.phones).events]), "[{},null,null,null]", + "unobserve using namespaces, with multiple paths and handler works"); + + // ................................ Act .................................. + $.observe("ns", person.phones, myListener); + $.unobserve("ns", person.phones); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person.phones).events]), "[{},null]", + "unobserve using namespaces, for array works"); + + // ................................ Act .................................. + $.observe("ns", person, "name", "address^street", "phones", myListener); + $.unobserve("ns", person, "*", person.address, "*"); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve using namespaces, with deep paths using '*' works"); + + // ................................ Act .................................. + $.observe("ns.a.b", person, "name", "address^street", "phones", myListener); + $.observe("ns.a.b", person, "name", myListener2); + $.unobserve("ns.b", myListener); // Removes handlers that include all namespace tokens, any object, for this handler + $.observable(person).setProperty("name", "newVal"); + + // ............................... Assert ................................. + assert.equal(result + $._data(person).events.propertyChange.length, "Listener2 change: set Handler ns: 'ns.a.b' Caller ns: '' calls: 1|1", + "unobserve using just namespaces and handler works"); + reset(); + $.unobserve(); + + // ................................ Act .................................. + $.observe("ns.a.b", person, "name", "address^street", "phones", myListener); + $.observe("ns.a.b", person, "phones", myListener2); + $.unobserve("ns.b"); // Removes handlers that include all namespace tokens, any object, any handler + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(person).events]), "[{},null]", + "unobserve using namespaces and no object, paths or handler works"); + + // ................................ Act .................................. + $.observe("ns.a.b", person, "name", "address^street", "phones", myListener3); + $.observe("ns.a.b", person, "name", myListener2); + $.observe("ns.a.c", person, "name", myListener2); + $.observe("b.c.ns", person, "name", myListener2); + $.observable("ns.b", person).setProperty("name", "newVal2"); + $.observable("ns.b", person).removeProperty("name"); + $.unobserve("ns"); // Removes handlers that include 'ns' namespace token, any object, any handler + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(person).events]), + "Listener3 change: set Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 1|" + + "Listener2 change: set Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 2|" + + "Listener2 change: set Handler ns: 'b.c.ns' Caller ns: 'b.ns' calls: 3|" + + "Listener3 change: set Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 4|" + + "Listener2 change: set Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 5|" + + "Listener2 change: set Handler ns: 'b.c.ns' Caller ns: 'b.ns' calls: 6|" + + "[{},null]", + '$.observable("ns.b", object).setProperty triggers only observe handlers that include those namespace tokens'); + reset(); + $.unobserve(); + + // ................................ Act .................................. + $.observe("ns.a.b", person.phones, myListener3); + $.observe("ns.a.b", person.phones, myListener2); + $.observe("ns.a.c", person.phones, myListener2); + $.observe("b.c.ns", person.phones, myListener2); + $.observable("ns.b", person.phones).insert({number: "999"}); + $.observable("ns.b", person.phones).remove(); + $.unobserve("ns"); // Removes handlers that include 'ns' namespace token, any object, any handler + + + $.observe("ns", person.phones, myListener); + $.unobserve("ns"); // Removes handlers that include 'ns' namespace token, any object, any handler + + // ............................... Assert ................................. + assert.equal(result + JSON.stringify([_jsv.cbBindings, $._data(person.phones).events]), + "Listener3 change: insert Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 1|" + + "Listener2 change: insert Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 2|" + + "Listener2 change: insert Handler ns: 'b.c.ns' Caller ns: 'b.ns' calls: 3|" + + "Listener3 change: remove Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 4|" + + "Listener2 change: remove Handler ns: 'ns.a.b' Caller ns: 'b.ns' calls: 5|" + + "Listener2 change: remove Handler ns: 'b.c.ns' Caller ns: 'b.ns' calls: 6|" + + "[{},null]", + '$.observable("ns.b", object).insert (array) triggers only observe handlers that include those namespace tokens'); + + reset(); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("Paths", function(assert) { + + // ................................ Reset ................................ + person1.home = home1; + address1.street = "StreetOne"; // reset Prop + address1.ZIP = "111"; // reset Prop + address2.street = "StreetTwo"; // reset Prop + address2.ZIP = "222"; // reset Prop + home2 = {address: address2}; + + // =============================== Arrange =============================== + var originalAddress = person1.home.address; + + // ................................ Act .................................. + $.observe(person1, "home^address.street", person1.home.address, "ZIP", myListener); + $.observable(person1.home.address).setProperty({street: "newValue", ZIP: "newZip"}); + + // ............................... Assert ................................. + assert.ok(result === "calls: 1, ev.data: prop: street, eventArgs: oldValue: StreetOne value: newValue, eventArgs.path: street|" + + "calls: 2, ev.data: prop: ZIP, eventArgs: oldValue: 111 value: newZip, eventArgs.path: ZIP|", + "$.observe(object, some.deep.path, object2, path, cb) is listening to leaf"); + + // ................................ Reset ................................ + reset(); + + // ................................ Act .................................. + $.observable(person1).setProperty({home: home2}); // Swap object higher in path + + // ............................... Assert ................................. + assert.equal("" + (lastEventArgs.oldValue === home1) + (lastEventArgs.value === home2) + result, "truetruecalls: 1, ev.data: prop: home, path: address^street," + + " eventArgs: oldValue: {\"address\":{\"street\":\"newValue\",\"ZIP\":\"newZip\"}} value: {\"address\":{\"street\":\"StreetTwo\",\"ZIP\":\"222\"}}, eventArgs.path: home|", + "$.observe(object, some.deep.path, object2, path, cb) is listening to root"); + + // ................................ Reset ................................ + reset(); + + // ................................ Act .................................. + $.observable(address1).setProperty({street: "newValue2", ZIP: "newZip2"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: ZIP, eventArgs: oldValue: newZip value: newZip2, eventArgs.path: ZIP|", + "$.observe(object, 'home.address.street', object2, 'ZIP', cb) after swapping higher up on deep path, is no longer listening to original leaf on that path - 'i.e. 'street', but is listening to other paths as before - 'i.e. 'ZIP'"); + + // ................................ Reset ................................ + $.observable(address1).setProperty({street: "Street1", ZIP: "111"}); // reset Prop + reset(); + + // ................................ Act .................................. + $.observable(address2).setProperty({street: "newValue2", ZIP: "newZip2"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: street, eventArgs: oldValue: StreetTwo value: newValue2, eventArgs.path: street|", + "$.observe(object, 'home.address.street', object2, 'ZIP', cb) after swapping higher up on deep path, is now listening to leaf on new descendant objects - 'i.e. 'street' on 'address2'"); + + // ................................ Act .................................. + $.observable(person1).setProperty("home", null); // Set object higher up on path to null + $.observable(person1).setProperty("home", home1); // Set object higher up to different object + reset(); + + $.observable(address2).setProperty({street: "newValue2", ZIP: "newZip2"}); + $.observable(address1).setProperty({street: "newValue3", ZIP: "newZip3"}); + + // ............................... Assert ................................. + + assert.equal(result, "calls: 1, ev.data: prop: street, eventArgs: oldValue: Street1 value: newValue3, eventArgs.path: street|" + + "calls: 2, ev.data: prop: ZIP, eventArgs: oldValue: 111 value: newZip3, eventArgs.path: ZIP|", + "$.observe(object, 'home.address.street', object2, 'ZIP', cb) after setting object to null, higher up on deep path, then setting to new object, is no longer listening to that path on original descendant objects but is now listening to the path on new descendant objects"); + + // ................................ Reset ................................ + reset(); + + // ................................ Act .................................. + $.observable(person1).setProperty("home", home2); // Set object higher up to different object + $.observable(home1).setProperty("address", {street: "ignoreThisStreet", ZIP: "ignoreZip"}); + $.observable(home2).setProperty("address", {street: "address3Street", ZIP: "address3Zip"}); + + // ............................... Assert ................................. + assert.equal(result, + "calls: 1, ev.data: prop: home, path: address^street, eventArgs: oldValue: {\"address\":{\"street\":\"newValue3\",\"ZIP\":\"newZip3\"}} value: {\"address\":{\"street\":\"newValue2\",\"ZIP\":\"newZip2\"}}, eventArgs.path: home|" + + "calls: 2, ev.data: prop: address, path: street, eventArgs: oldValue: {\"street\":\"newValue2\",\"ZIP\":\"newZip2\"} value: {\"street\":\"address3Street\",\"ZIP\":\"address3Zip\"}, eventArgs.path: address|", + "$.observe(object, 'home.address.street', object2, 'ZIP', cb) after swapping higher up on deep path, is listening to intermediate paths on new object - 'i.e. 'address'"); + + // ................................ Reset ................................ + reset(); + + // ................................ Act .................................. + $.unobserve(person1, "home^address.street", originalAddress, "ZIP", myListener); + + // ............................... Assert ................................. + assert.ok(!$._data(person1).events && !$._data(person1.home.address).events, + "$.unobserve(object, 'home.address.street', object2, 'ZIP', cb) removes the current listeners from that path"); + + // ................................ Reset ................................ + reset(); + + $.observe(person1, "home^address.street", person1.home.address, "ZIP", "ZIP", "foo", myListener); + $.observe(person1.home.address, "street", function() {}); + + // ............................... Assert ................................. + assert.equal("" + $._data(person1.home.address).events.propertyChange.length + " " + + $._data(person1.home).events.propertyChange.length + " " + + $._data(person1).events.propertyChange.length, "4 1 1", + "Avoid duplicate handlers"); + + // ................................ Act .................................. + $.unobserve(person1, "home^address.ZIP"); + + // ............................... Assert ................................. + assert.equal("" + $._data(person1.home.address).events.propertyChange.length + " " + + !$._data(person1.home).events + " " + + !$._data(person1).events, "3 true true", + "unobserve(object, paths) - with no callback specified: Remove handlers only for selected properties"); + + // ................................ Act .................................. + $.unobserve(person1.home.address, "*", myListener); + + // ............................... Assert ................................. + assert.equal("" + $._data(person1.home.address).events.propertyChange.length, "1", + 'unobserve(object, "*", myListener) removes all handlers on this object for any props, for this callback'); + + // ................................ Act .................................. + $.unobserve(person1.home.address, "*"); + + // ............................... Assert ................................. + assert.ok(!$._data(person1.home.address).events, + 'unobserve(object, "*") removes all handlers on this object for any props, for any callback'); + + // ................................ Reset ................................ + reset(); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.observe(person1.home.address, "*", "ZIP", myListener); + + // ............................... Assert ................................. + assert.equal("" + $._data(person1.home.address).events.propertyChange.length, "1", + 'Add a listener for "*" - avoids duplicates'); + + // ................................ Act .................................. + $.observable(person1.home.address).setProperty({street: "newValue4", ZIP: "newZip4"}); + + // ............................... Assert ................................. + + assert.equal(result, "calls: 1, ev.data: prop: *, eventArgs: oldValue: address3Street value: newValue4, eventArgs.path: street|" + + "calls: 2, ev.data: prop: *, eventArgs: oldValue: address3Zip value: newZip4, eventArgs.path: ZIP|", + 'listen to both "*" and specific prop. Note: Eliminates duplicates for specific props when there is also a "*"'); + + // ................................ Reset ................................ + $.unobserve(person1.home.address, "*"); + address1.street = "StreetOne"; // reset Prop + address1.ZIP = "111"; // reset Prop + address2.street = "StreetTwo"; // reset Prop + home1 = {address: address1}; + home2 = {address: address2}; + person1.home = home1; + reset(); + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(person1, "work^address.street", myListener); + $.observable(person1).setProperty({work: home2}); + $.observable(address2).setProperty({street: "newAddress2"}); + + // ............................... Assert ................................. + assert.equal(result, + "calls: 1, ev.data: prop: work, path: address^street, eventArgs: oldValue: undefined value: {\"address\":{\"street\":\"StreetTwo\",\"ZIP\":\"newZip2\"}}, eventArgs.path: work|" + + "calls: 2, ev.data: prop: street, eventArgs: oldValue: StreetTwo value: newAddress2, eventArgs.path: street|", + 'observing a deep path into missing properties, followed by $.observable(...).setProperty calls which supply the missing object property then modify subobjects deeper down the path lead to the correct callback events'); + + // ................................ Reset ................................ + $.unobserve(person1, "work^address.street"); + address2.street = "StreetTwo"; // reset Prop + delete person1.work; // reset Prop + reset(); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.unobserve(person1.home.address, "*"); + + // ............................... Assert ................................. + assert.ok(!$._data(person1.home.address).events, + 'unobserve(object, "*") removes all handlers on this object for any props, both "*" and specific props, for any callback'); + + // ................................ Act .................................. + $.observe(person1, "fullName", myListener); + + // ............................... Assert ................................. + assert.equal("" + $._data(person1).events.propertyChange.length, "3", + 'Add a listener for computed property'); + + // ................................ Act .................................. + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: firstName, eventArgs: oldValue: Mr Jo value: Mr newFirst, eventArgs.path: firstName|" + + "calls: 2, ev.data: prop: lastName, eventArgs: oldValue: One value: newLast, eventArgs.path: lastName|" + + "calls: 3, ev.data: prop: title, eventArgs: oldValue: Mr value: Sir, eventArgs.path: title|", + 'listen to changes in dependent props for a computed'); + + // ................................ Reset ................................ + person1._firstName = "Jo"; + person1.lastName = "One"; + settings.title = "Sir"; + reset(); + + // =============================== Arrange =============================== + listeners = "Before: " + + $._data(model.person1).events.propertyChange.length; + + // ................................ Act .................................. + $.unobserve(person1, "fullName", myListener); + + // ............................... Assert ................................. + assert.equal(listeners + ". After: " + + !$._data(model.person1).events, "Before: 3. After: true", + 'unobserve(object, "computed", cb) removes handlers'); + + // ................................ Act .................................. + $.observe(model, "person1^fullName", myListener); + + // ............................... Assert ................................. + assert.equal("" + $._data(person1).events.propertyChange.length, "3", + 'Add a listener for computed property on a deep path'); + + // ................................ Act .................................. + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + + // ............................... Assert ................................. + + assert.equal(result, "calls: 1, ev.data: prop: firstName, eventArgs: oldValue: Sir Jo value: Sir newFirst, eventArgs.path: firstName|" + + "calls: 2, ev.data: prop: lastName, eventArgs: oldValue: One value: newLast, eventArgs.path: lastName|", + 'listen to changes in dependent props for a computed'); + + // ................................ Reset ................................ + person1._firstName = "Jo"; + person1.lastName = "One"; + reset(); + + // =============================== Arrange =============================== + listeners = "Before: " + + $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length; + + // ................................ Act .................................. + $.unobserve(model, "person1^fullName", myListener); + + // ............................... Assert ................................. + assert.equal(listeners + ". After: " + + !$._data(model).events + " " + + !$._data(model.person1).events, "Before: 1 3. After: true true", + 'unobserve(object, "computed", cb) removes handlers'); + + // ................................ Act .................................. + $.observe(model, "person1^fullName", "person1^firstName", "person1^lastName", "person1^firstName", myListener); + + // ............................... Assert ................................. + assert.equal("" + $._data(person1).events.propertyChange.length, "3", + 'Add a listener for computed property on deep path plus redundant computed dependency plus redundant computed prop.'); + + // ................................ Act .................................. + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: firstName, eventArgs: oldValue: Sir Jo value: Sir newFirst, eventArgs.path: firstName|" + + "calls: 2, ev.data: prop: lastName, eventArgs: oldValue: One value: newLast, eventArgs.path: lastName|", + 'listen to changes in dependent props for a computed. (Note: We avoid duplicate handlers)'); + + // ................................ Reset ................................ + person1._firstName = "Jo"; + person1.lastName = "One"; + reset(); + + // =============================== Arrange =============================== + listeners = "Before: " + + $._data(settings).events.propertyChange.length + " " + + $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length; + + // ................................ Act .................................. + $.unobserve(model, "person1^fullName", myListener); + + // ............................... Assert ................................. + assert.equal(listeners + ". After: " + + !$._data(settings).events + " " + + !$._data(model).events + " " + + !$._data(model.person1).events, "Before: 1 1 3. After: true true true", + 'unobserve(object, "computed", cb) removes handlers'); + + // =============================== Arrange =============================== + $.observe(model, "person1", "person2", "person1.*", "person1.home.address^street", "person1^home.address.ZIP", "person1.home^address.*", myListener); + + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length; + + assert.equal(listeners, "2 1 1 1", 'No duplicate handlers for $.observe(model, "person1", "person2", "person1.*", "person1.home.address^street", "person1^home.address.ZIP", "person1.home^address.*", cb)'); + + // ................................ Act .................................. + $.unobserve(model, "person1", "person2", "person1.*", "person1.home.address^street", "person1^home.address.ZIP", "person1.home^address.*", myListener); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events, "true true true true", + '$.unobserve(model, "person1", "person2", "person1.*", "person1.home.address^street", "person1^home.address.ZIP", "person1.home^address.*", cb) removes all handlers'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.observe(model, "person1^fullName", "person1.home.address.*", myListener); + + $.unobserve(model); + + handlersCount = !$._data(model).events + " " + $._data(model.person1).events.propertyChange.length + " " + $._data(model.person1.home.address).events.propertyChange.length; + + $.unobserve(person1); + + // ............................... Assert ................................. + assert.equal(handlersCount + "|" + !$._data(model).events + " " + !$._data(model.person1).events + " " + $._data(model.person1.home.address).events.propertyChange.length, + "true 3 1|true true 1", + 'unobserve(object) removes all observe handlers from object, but does not remove handlers on paths on descendant objects'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.observe(model, "person1^fullName", "person1.address.*", myListener); + $.observe(model, "person1^fullName", "person1.home.address.street", "person1.home.address.*", myListener); + + handlersCount = $._data(model).events.propertyChange.length + " " + $._data(model.person1).events.propertyChange.length + " " + $._data(model.person1.home.address).events.propertyChange.length; + + $.observe(model, "person1^fullName", function() {}); + + handlersCount += "|" + $._data(model).events.propertyChange.length + " " + $._data(model.person1).events.propertyChange.length + " " + $._data(model.person1.home.address).events.propertyChange.length; + + $.unobserve(model, myListener); + + handlersCount += "|" + $._data(model).events.propertyChange.length + " " + $._data(model.person1).events.propertyChange.length + " " + $._data(model.person1.home.address).events.propertyChange.length; + + $.unobserve(person1, myListener); + + handlersCount += "|" + $._data(model).events.propertyChange.length + " " + $._data(model.person1).events.propertyChange.length + " " + $._data(model.person1.home.address).events.propertyChange.length; + + $.unobserve(model, "*", person1, "*"); + $.unobserve(model.person1.home.address); + $.unobserve(model.person1.home); + $.unobserve(settings); + + // ............................... Assert ................................. + assert.equal("" + handlersCount + " " + !$._data(model).events + " " + !$._data(model.person1).events + " " + !$._data(model.person1.home.address).events, "1 4 1|2 7 1|1 7 1|1 3 1 true true true", + 'unobserve(object) removes all observe handlers from object, but does not remove handlers on paths on descendant objects'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.observe(person1, "fullName", myListener); + $.observe(settings, "*", myListener); + handlersCount = $._data(person1).events.propertyChange.length + $._data(settings).events.propertyChange.length; + + $.unobserve(person1, "*", settings, "*"); + + // ............................... Assert ................................. + assert.equal("" + handlersCount + " " + !$._data(person1).events + " " + !$._data(settings).events, "4 true true", + 'unobserve(object1, "*", object2, "*") removes all observe handlers from objects'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.observe(settings, "onFoo", myListener); + $.observable(settings).setProperty("onFoo", function onfoonew() {return; }); + $.unobserve(settings); + + // ............................... Assert ................................. + assert.equal(!$._data(settings).events && result, "calls: 1, ev.data: prop: onFoo, eventArgs: oldValue: function onFoo1() value: function onfoonew() , eventArgs.path: onFoo|", + 'Can observe properties of type function'); + + // ................................ Reset ................................ + settings.onFoo = "Jo"; + person1.lastName = "One"; + reset(); + result = ""; + +}); + +QUnit.test("observe context helper", function(assert) { + + // =============================== Arrange =============================== + var str = "aa", + main = { + title: "foo" + }, + obj = { + name: "One" + }; + + function observeCtxHelper(val, currentRoot) { + if (val) { + if (val.charAt(0) === "%") { + return [obj, val.slice(1)]; + } + } + } + + // ................................ Act .................................. + $.observe(main, "title", "%name", myListener, observeCtxHelper); + $.observable(main).setProperty({title: "newTitle"}); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: title, eventArgs: oldValue: foo value: newTitle, eventArgs.path: title|" + + "calls: 2, ev.data: prop: name, eventArgs: oldValue: One value: newName, eventArgs.path: name|", + "$.observe(object, path, cb, observeCtxHelper) uses observeCtxHelper correctly to substitute objects and paths"); + + // ................................ Act .................................. + handlersCount = $._data(obj).events.propertyChange.length; + $.unobserve({}, "%name", myListener, observeCtxHelper); + + // ................................ Reset ................................ + obj.name = "One"; + + // ............................... Assert ................................. + assert.ok(handlersCount === 1 && !$._data(obj).events, + "$.unobserve(object, path, cb, observeCtxHelper) uses observeCtxHelper correctly to substitute objects and paths and unobserve from mapped "); + reset(); + + $.unobserve(main, "title", "%name", myListener, observeCtxHelper); + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(str, myListener); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "", + "$.observe(path, cb): Observe with no root object and no observeCtxHelper does nothing"); + + // ................................ Reset ................................ + obj.name = "One"; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(str, myListener, observeCtxHelper); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "", + "$.observe(path, cb): Observe with no root object and with observeCtxHelper does nothing"); + + // ................................ Reset ................................ + obj.name = "One"; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(null, "%name", myListener, observeCtxHelper); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: name, eventArgs: oldValue: One value: newName, eventArgs.path: name|", + "$.observe(null, path, cb, observeCtxHelper) observe with null as root object can use observeCtxHelper to substitute objects and paths. Correctly observes object(s) mapped by observeCtxHelper"); + + // ................................ Act .................................. + handlersCount = $._data(obj).events.propertyChange.length; + $.unobserve(null, "%name", myListener, observeCtxHelper); + + // ............................... Assert ................................. + assert.ok(handlersCount === 1 && !$._data(obj).events, + "$.unobserve(null, path, cb, observeCtxHelper) uses observeCtxHelper correctly to substitute objects and paths and unobserve from mapped "); + reset(); + + // ................................ Reset ................................ + obj.name = "One"; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(undefined, "%name", myListener, observeCtxHelper); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: name, eventArgs: oldValue: One value: newName, eventArgs.path: name|", + "$.observe(undefined, path, cb, observeCtxHelper) observe with undefined root object can use observeCtxHelper to substitute objects and paths. Correctly observes object(s) mapped by observeCtxHelper"); + + // ................................ Act .................................. + handlersCount = $._data(obj).events.propertyChange.length; + $.unobserve(undefined, "%name", myListener, observeCtxHelper); + + // ............................... Assert ................................. + assert.ok(handlersCount === 1 && !$._data(obj).events, + "$.unobserve(undefined, path, cb, observeCtxHelper) uses observeCtxHelper correctly to substitute objects and paths and unobserve from mapped "); + reset(); + + // ................................ Reset ................................ + obj.name = "One"; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(undefined, str, myListener, observeCtxHelper); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "", + "$.observe(path, cb, observeCtxHelper) observe with no root object can use observeCtxHelper to substitute objects and paths. If no object is mapped by observeCtxHelper, does nothing"); + + // ................................ Reset ................................ + obj.name = "One"; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(null, myListener, observeCtxHelper); + $.observe(0, myListener, observeCtxHelper); + $.observe(false, myListener, observeCtxHelper); + $.observe(true, myListener, observeCtxHelper); + $.observe(2, myListener, observeCtxHelper); + + $.observe(null, str, myListener, observeCtxHelper); + $.observe(0, str, myListener, observeCtxHelper); + $.observe(false, str, myListener, observeCtxHelper); + $.observe(true, str, myListener, observeCtxHelper); + $.observe(2, str, myListener, observeCtxHelper); + + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "", + "$.observe(foo, path, ...): When first parameter foo is not a string or object, it is skipped"); + + // ................................ Reset ................................ + obj.name = "One"; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(true, "%name", myListener, observeCtxHelper); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: name, eventArgs: oldValue: One value: newName, eventArgs.path: name|", + "$.observe(foo, path, ...): When first parameter foo is not a string or object, it is skipped"); + + // ................................ Act .................................. + handlersCount = $._data(obj).events.propertyChange.length; + $.unobserve(true, "%name", myListener, observeCtxHelper); + + // ............................... Assert ................................. + assert.ok(handlersCount === 1 && !$._data(obj).events, + "$.unobserve(foo, path, ...): When first parameter foo is not a string or object, it is skipped"); + reset(); + + // ................................ Reset ................................ + obj.name = "One"; + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.observe(false, "%name", myListener, observeCtxHelper); + $.observable(obj).setProperty({name: "newName"}); + + // ............................... Assert ................................. + assert.equal(result, "calls: 1, ev.data: prop: name, eventArgs: oldValue: One value: newName, eventArgs.path: name|", + "$.observe(foo, path, ...): When first parameter foo is not a string or object, it is skipped"); + + // ................................ Act .................................. + handlersCount = $._data(obj).events.propertyChange.length; + $.unobserve(false, "%name", myListener, observeCtxHelper); + + // ............................... Assert ................................. + assert.ok(handlersCount === 1 && !$._data(obj).events, + "$.unobserve(foo, path, ...): When first parameter foo is not a string or object, it is skipped"); + reset(); + + // ................................ Reset ................................ + obj.name = "One"; + + //TODO test case for observe(domElement, "a.b.c", callback) should not bind at all +}); + +QUnit.test("dataMap", function(assert) { + // =============================== Arrange =============================== + var sortMap = $.views.map(function(rows, options) { + rows = rows.slice(); // Copy rows, then sort if sortby is provided in options + if (options && options.sortby) { + rows = rows.slice().sort(function(a, b) { + return a[options.sortby].toLowerCase().localeCompare(b[options.sortby].toLowerCase()); + }); + } + return rows; // return copied sorted rows. + }); + + var data = { + options: { + sortby: "name", + page: 1, + pageLength: 1 + }, + cols: [ + { + field: "id", + label: "Id", + show: true + }, + { + field: "name", + label: "Name", + show: true + }, + { + field: "role", + label: "Role", + show: false + } + ], + newRow: { + name: "", + role: "" + }, + rows: [ + { + id: "id1", + name: "Jeff", + role: "Goalie" + }, + { + id: "id2", + name: "Ariel", + role: "Consultant" + }, + { + id: "id3", + name: "Pete", + role: "Assistant" + } + ] + }; + + function getConcatenatedFields(array, field) { + return $.map(array, function(item) { + return item[field]; + }).join(","); + } + + function viewSrcTgt(map, field) { + return getConcatenatedFields(map.src, field) + "|" + getConcatenatedFields(map.tgt, field).toUpperCase(); + } + + // ................................ Act .................................. + var map1 = sortMap.map(data.rows, {sortby: "name"}); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "name"), "Jeff,Ariel,Pete|ARIEL,JEFF,PETE", + 'map = sortMap.map(data.rows, {sortby: "name"}) creates a map with sorted target'); + + // ............................... Assert ................................. + assert.equal(map1.options.sortby, "name", + 'map.options is the initial options passed to .map(source, options)'); + + // ............................... Assert ................................. + assert.ok(map1.src === data.rows, + 'map.src is the source'); + + // ................................ Act .................................. + map1.update({sortby: "role"}); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role"), "Goalie,Consultant,Assistant|ASSISTANT,CONSULTANT,GOALIE", + 'map.update({sortby: "role"}) re-sorts target'); + + // ............................... Assert ................................. + assert.equal(map1.options.sortby, "role", + 'map.options is the current options - as passed to .update(options)'); + + // ................................ Act .................................. + $.observable(data.rows).insert({ + id: "new", + name: "Mary", + role: "Broker" + }); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role"), "Goalie,Consultant,Assistant,Broker|ASSISTANT,CONSULTANT,GOALIE", + 'If map has no obsSrc method, target does not update observably'); + + // ................................ Act .................................. + map1.update({sortby: "role"}); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role"), "Goalie,Consultant,Assistant,Broker|ASSISTANT,BROKER,CONSULTANT,GOALIE", + 'map.update({sortby: "role"}) re-sorts target based on current source'); + + // ................................ Act .................................. + var myTarget = [1,2,3], + map2 = sortMap.map(data.rows, {sortby: "name"}, myTarget); + + // ............................... Assert ................................. + assert.ok(map2.tgt===myTarget, + 'sortMap.map(data.rows, {sortby: "name"}, myTarget) - can provide existing target array to a new map'); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map2, "name"), "Jeff,Ariel,Pete,Mary|ARIEL,JEFF,MARY,PETE", + 'sortMap.map(data.rows, {sortby: "name"}, myTarget) replaces contents of myTarget array with sorted copy of source array'); + + // ................................ Act .................................. + $.observable(data.rows).remove(); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role") + "/" + viewSrcTgt(map2, "name"), + "Goalie,Consultant,Assistant|ASSISTANT,BROKER,CONSULTANT,GOALIE/Jeff,Ariel,Pete|ARIEL,JEFF,MARY,PETE", + 'If map has no obsSrc method, target does not update observably'); + + map1.update(); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role") + "/" + viewSrcTgt(map2, "name"), + "Goalie,Consultant,Assistant|ASSISTANT,CONSULTANT,GOALIE/Jeff,Ariel,Pete|ARIEL,JEFF,MARY,PETE", + 'map.update() will update target to current source using current options (sortby is now "role")'); + + // ............................... Assert ................................. + assert.equal(map1.options.sortby, "role", + 'map.options is still the current options - as passed previously to .map(source, options) or .update(options)'); + + var tgt = map1.tgt; + + // ................................ Act .................................. + map1.unmap(); + + // ............................... Assert ................................. + assert.ok(map1.src === undefined, 'map.unmap() removes src'); + + // ................................ Act .................................. + map1.map(data.rows, {sortby: "id"}, tgt); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "id"), "id1,id2,id3|ID1,ID2,ID3", + 'map.map(source, options, target) will remap to chosen source, options, and target'); + + // ................................ Act .................................. + map1.map(data.rows, {sortby: "name"}); + + after = (map1.tgt === tgt); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "name") + " " + after, "Jeff,Ariel,Pete|ARIEL,JEFF,PETE true", + 'map.map(source, options) will remap to chosen source and options, and keep target'); + + // ................................ Act .................................. + var otherRows = [ + { + id: "idOther1", + name: "OtherGuy", + role: "OtherRole" + }, + { + id: "idOther2", + name: "Abel", + role: "Actor" + } + ]; + + tgt = map1.tgt; + + map1.map(otherRows); + + after = (tgt === map1.tgt); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "name") + " " + after, "OtherGuy,Abel|ABEL,OTHERGUY true", + 'map.map(newSource) will remap new source, using current options and target'); + + // ................................ Act .................................. + map1.unmap(); + map2.unmap(); + + // =============================== Arrange =============================== + + var observableSortMap = $.views.map({ + baseMap: sortMap, + obsSrc: function(map, ev, eventArgs) { + var i, l, item, items, + target = map.tgt; + switch (eventArgs.change) { + case "remove": + items = eventArgs.items; + for (i=0, l=items.length; i -1) { + $.observable(target).remove(index); // Remove corresponding target. No need to resort + } + } + break; + case "insert": + map.update(); // Need not only to insert in target, but to sort result - so simply call update + } + } + }); + + // ................................ Act .................................. + var map1 = observableSortMap.map(data.rows, {sortby: "name"}); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "name"), "Jeff,Ariel,Pete|ARIEL,JEFF,PETE", + 'map = observableSortMap.map(data.rows, {sortby: "name"}) creates a map with sorted target'); + + // ............................... Assert ................................. + assert.equal(map1.options.sortby, "name", + 'map.options is the initial options passed to .map(source, options)'); + + // ............................... Assert ................................. + assert.ok(map1.src === data.rows, + 'map.src is the source'); + + // ................................ Act .................................. + map1.update({sortby: "role"}); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role"), "Goalie,Consultant,Assistant|ASSISTANT,CONSULTANT,GOALIE", + 'map.update({sortby: "role"}) re-sorts target'); + + // ............................... Assert ................................. + assert.equal(map1.options.sortby, "role", + 'map.options is the current options - as passed to .update(options)'); + + // ................................ Act .................................. + $.observable(data.rows).insert({ + id: "new", + name: "Mary", + role: "Broker" + }); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role"), "Goalie,Consultant,Assistant,Broker|ASSISTANT,BROKER,CONSULTANT,GOALIE", + 'If map has an obsSrc method, observable changes to source trigger observable target updates too'); + + // ................................ Act .................................. + map1.update({sortby: "role"}); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role"), "Goalie,Consultant,Assistant,Broker|ASSISTANT,BROKER,CONSULTANT,GOALIE", + 'map.update({sortby: "role"}) re-sorts target based on current source'); + + // ................................ Act .................................. + myTarget = [1,2,3]; + map2 = observableSortMap.map(data.rows, {sortby: "name"}, myTarget); + + // ............................... Assert ................................. + assert.ok(map2.tgt===myTarget, + 'observableSortMap.map(data.rows, {sortby: "name"}, myTarget) - can provide existing target array to a new map'); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map2, "name"), "Jeff,Ariel,Pete,Mary|ARIEL,JEFF,MARY,PETE", + 'observableSortMap.map(data.rows, {sortby: "name"}, myTarget) replaces contents of myTarget array with sorted copy of source array'); + + // ................................ Act .................................. + $.observable(data.rows).remove(2, 2); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role") + "/" + viewSrcTgt(map2, "name"), + "Goalie,Consultant|CONSULTANT,GOALIE/Jeff,Ariel|ARIEL,JEFF", + 'If map has an obsSrc method, observable changes to source trigger observable target updates too'); + + // ................................ Act .................................. + data.rows.splice(1, 0, { + id: "inserted", + name: "Amadeus", + role: "Musician" + }); + map1.update(); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "role"), + "Goalie,Musician,Consultant|CONSULTANT,GOALIE,MUSICIAN", + 'map.update() will update target to current source using current options (sortby is now "role")'); + + // ................................ Act .................................. + var before = viewSrcTgt(map2, "name"); + + map2.update(); + + // ............................... Assert ................................. + assert.equal(before + "/" + viewSrcTgt(map2, "name"), + "Jeff,Amadeus,Ariel|ARIEL,JEFF/Jeff,Amadeus,Ariel|AMADEUS,ARIEL,JEFF", + 'map2.update() will update target to current source using current options (sortby is now "name")'); + + // ............................... Assert ................................. + assert.equal(map1.options.sortby, "role", + 'map.options is still the current options - as passed previously to .map(source, options) or .update(options)'); + + tgt = map1.tgt; + before = $._data(data.rows).events.arrayChange.length + "-" + ($._data(map1.tgt).events === undefined); + + // ................................ Act .................................. + map1.unmap(); + + after = $._data(data.rows).events.arrayChange.length + "-" + ($._data(map1.tgt).events === undefined); + + // ............................... Assert ................................. + assert.ok(map1.src === undefined, + 'map.unmap() removes src'); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "2-true|1-true", + 'map.unmap() removes dataMap observe bindings from src. (Note: map.tgt has no bindings since obsTgt not defined for this dataMap)'); + + // ................................ Act .................................. + map1.map(data.rows, {sortby: "id"}, tgt); + + after = $._data(data.rows).events.arrayChange.length; + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "id") + " events: " + after, "id1,inserted,id2|ID1,ID2,INSERTED events: 2", + 'map.map(source, options, target) will remap to chosen source, options, and target'); + + // ................................ Act .................................. + + map1.map(data.rows, {sortby: "name"}); + + after = $._data(data.rows).events.arrayChange.length + "-" + (map1.tgt === tgt); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "name") + " events: " + after, "Jeff,Amadeus,Ariel|AMADEUS,ARIEL,JEFF events: 2-true", + 'map.map(source, options) will remap to chosen source and options, keep target - and remove previous bindings'); + + // ................................ Act .................................. + otherRows = [ + { + id: "idOther1", + name: "OtherGuy", + role: "OtherRole" + }, + { + id: "idOther2", + name: "Abel", + role: "Actor" + } + ]; + + tgt = map1.tgt; + + map1.map(otherRows); + + $.observable(otherRows).insert(1, [ + { + id: "idOther3", + name: "Isabel", + role: "Director" + }, + { + id: "idOther4", + name: "Xavier", + role: "Cook" + } + ]); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "name") + " " + after, "OtherGuy,Isabel,Xavier,Abel|ABEL,ISABEL,OTHERGUY,XAVIER 2-true", + 'map.map(newSource) will remap new source, using current options and target'); + + // ................................ Act .................................. + map1.unmap(); + map2.unmap(); + + // =============================== Arrange =============================== + + var observableSortMap2 = $.views.map({ + baseMap: observableSortMap, + obsTgt: function(map, ev, eventArgs) { + var i, l, item, items, + source = map.src; + switch (eventArgs.change) { + case "remove": + items = eventArgs.items; + for (i=0, l=items.length; i -1) { + $.observable(source).remove(index); // Remove corresponding source. No need to resort + } + } + break; + case "insert": + $.observable(source).insert(eventArgs.items); // Insert into source + map.update(); // Re-sort target - by calling update + } + } + }); + + // ................................ Act .................................. + map1 = observableSortMap2.map(data.rows, {sortby: "name"}); + + // ............................... Assert ................................. + assert.equal(viewSrcTgt(map1, "name"), "Jeff,Amadeus,Ariel|AMADEUS,ARIEL,JEFF", + 'map = observableSortMap2.map(data.rows, {sortby: "name"}) with obsTgt creates a map with sorted target'); + + $.observable(map1.tgt).insert(1, [ + { + id: "new", + name: "Mary", + role: "Broker" + }, + { + id: "new2", + name: "Jane", + role: "Fixer" + } + ]); + + assert.equal(viewSrcTgt(map1, "name"), "Jeff,Amadeus,Ariel,Mary,Jane|AMADEUS,ARIEL,JANE,JEFF,MARY", + 'If map has an obsTgt method, observable changes to target trigger observable source updates too'); + + $.observable(map1.tgt).remove(1, 2); + + assert.equal(viewSrcTgt(map1, "name"), "Jeff,Amadeus,Mary|AMADEUS,JEFF,MARY", + 'If map has an obsTgt method, observable changes to target trigger observable source updates too'); + + map1.unmap(); +}); + +QUnit.test("observeAll", function(assert) { + reset(); + + // =============================== Arrange =============================== + var inc = 0, + data = { + person: { + name: "Pete", + address: { + street: "1st Ave" + }, + phones: [{number: "111 111 1111"}, {number:"222 222 2222"}] + } + }; + + $.observable(data).observeAll(observeAllCb1); + + // ................................ Act .................................. + $.observable(data.person).setProperty({ + name: "Hermione", + "address.street": "Main St" + }); + + $.observable(data.person).setProperty({ + address: {street: "New Street"}, + phones: [{number:"123 123 1234"}] + }); + + $.observable(data.person.phones[0]).setProperty("foo", 34); + + $.observable(data.person.phones).insert({ + number:"456 456 AAAA" + }); + + $.observable(data.person.phones[1]).setProperty("number", data.person.phones[1].number + inc++); + + $.observable(data.person.phones).remove(0); + + $.observable(data.person.phones[0]).setProperty("number", data.person.phones[0].number + inc++); + + $.observable(data.person.phones).insert({ + number:"456 456 BBBB" + }); + + $.observable(data.person.phones[1]).setProperty("subnum", {a: 11, b: 22}); + + $.observable(data.person.phones[1]).setProperty("subnum.a", "a" + inc++); + + $.observable(data.person.phones[1]).removeProperty("subnum.b"); + + $.observable(data.person.phones).insert(1, [{number:"456 456 CCCC"}, {number:"456 456 DDDD"}]); + + $.observable(data.person.phones[2]).setProperty("number", data.person.phones[2].number + inc++); + + $.observable(data.person.phones).refresh([{number:"456 456 EEEE"}, {number:"456 456 FFFF"}]); + + $.observable(data.person.phones[1]).setProperty("number", data.person.phones[1].number + inc++); + + $.observable(data.person.phones).remove(0); + + $.observable(data.person.phones[0]).setProperty("number", data.person.phones[0].number + inc++); + +// ............................... Assert ................................. + result += "DATA: " + JSON.stringify(data); + + assert.equal(result, +'ObserveAll Path: root.person' ++ ' eventArgs: change: "set"|path: "name"|value: "Hermione"|oldValue: "Pete"|remove: false' + ++ '|ObserveAll Path: root.person.address' ++ ' eventArgs: change: "set"|path: "street"|value: "Main St"|oldValue: "1st Ave"|remove: false' + ++ '|ObserveAll Path: root.person' ++ ' eventArgs: change: "set"|path: "address"|value: {"street":"New Street"}|oldValue: {"street":"Main St"}|remove: false' + ++ '|ObserveAll Path: root.person' ++ ' eventArgs: change: "set"|path: "phones"|value: [{"number":"123 123 1234"}]|oldValue: [{"number":"111 111 1111"},{"number":"222 222 2222"}]|remove: false' + ++ '|ObserveAll Path: root.person.phones[0]' ++ ' eventArgs: change: "set"|path: "foo"|value: 34|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 AAAA"}]' + ++ '|ObserveAll Path: root.person.phones[1]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 AAAA0"|oldValue: "456 456 AAAA"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "remove"|index: 0|items: [{"number":"123 123 1234","foo":34}]' + ++ '|ObserveAll Path: root.person.phones[0]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 AAAA01"|oldValue: "456 456 AAAA0"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 BBBB"}]' + ++ '|ObserveAll Path: root.person.phones[1]' ++ ' eventArgs: change: "set"|path: "subnum"|value: {"a":11,"b":22}|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: root.person.phones[1].subnum' ++ ' eventArgs: change: "set"|path: "a"|value: "a2"|oldValue: 11|remove: false' + ++ '|ObserveAll Path: root.person.phones[1].subnum' ++ ' eventArgs: change: "set"|path: "b"|value: undefined|oldValue: 22|remove: true' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 CCCC"},{"number":"456 456 DDDD"}]' + ++ '|ObserveAll Path: root.person.phones[2]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 DDDD3"|oldValue: "456 456 DDDD"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "refresh"|oldItems: [{"number":"456 456 AAAA01"},{"number":"456 456 CCCC"},{"number":"456 456 DDDD3"},{"number":"456 456 BBBB","subnum":{"a":"a2"}}]' + ++ '|ObserveAll Path: root.person.phones[1]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 FFFF4"|oldValue: "456 456 FFFF"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "remove"|index: 0|items: [{"number":"456 456 EEEE"}]' + ++ '|ObserveAll Path: root.person.phones[0]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 FFFF45"|oldValue: "456 456 FFFF4"|remove: false' + ++ '|DATA: {"person":{"name":"Hermione","address":{"street":"New Street"},"phones":[{"number":"456 456 FFFF45"}]}}', + + 'observeAll scenarios, with observeAll.path() etc.'); + + $.observable(data).unobserveAll(); + + reset(); + + // =============================== Arrange =============================== + $.observable(model).observeAll(observeAllCb1); + + // ................................ Act .................................. + $.observable(model).setProperty({ + "person1.home.address": { + street: "1st", + ZIP: "00000" + }, + "person1.home.address.street": "upper St", + "person1.home.address.ZIP": "33333", + things: [{thing: "tree"}] + }); + $.observable(model.things).insert({thing: "bush"}); + $.observable(model.things).refresh([model.things[1], model.things[0], model.things[1]]); + $.observable(model.things[2]).setProperty("thing", model.things[2].thing + "+"); + + // ............................... Assert ................................. + assert.equal(result, +'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"1st","ZIP":"00000"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|' ++ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "street"|value: "upper St"|oldValue: "1st"|remove: false|' ++ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "ZIP"|value: "33333"|oldValue: "00000"|remove: false|' ++ 'ObserveAll Path: root eventArgs: change: "set"|path: "things"|value: [{"thing":"tree"}]|oldValue: []|remove: false|' ++ 'ObserveAll Path: root.things eventArgs: change: "insert"|index: 1|items: [{"thing":"bush"}]|' ++ 'ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush"}]|' ++ 'ObserveAll Path: root.things[0] eventArgs: change: "set"|path: "thing"|value: "bush+"|oldValue: "bush"|remove: false|', + "observeAll raises correct change events"); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'observeAll maintains a single event handler binding on every object in the graph, regardless of structural observable changes made'); + + // ................................ Act .................................. + $.observable(model).observeAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'Calling observeAll more than once does not add extra event bindings'); + + // ................................ Act .................................. + $.observable(model).observeAll(observeAllCb3); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 2 2 2", 'Calling observeAll with a different callback adds one binding for the new callback on each object or array'); + + // ................................ Act .................................. + $.observable(model).unobserveAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'Calling unobserveAll(myCallback) removes just my callback bindings'); + + // ................................ Act .................................. + $.observable(model).observeAll(observeAllCb1); + + $.observable(model.things).unobserveAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 1 1 1", 'Calling $.observable(objectOrArrayInTree).unobserveAll(myCallback) removes just my callback bindings in the subtree only'); + + // ................................ Act .................................. + $.observable(model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "true true true true true true true", + 'unobserveAll() with no callback removes all bindings from the tree'); + + // ................................ Act .................................. + $.observable(model.things).observeAll(observeAllCb2); + + // ............................... Assert ................................. + listeners = $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1", '$.observable(someArray).observeAll(observeAllCb2) works correctly'); + + // ................................ Act .................................. + reset(); + $.observable(model.things).insert({thing: "bush"}); + $.observable(model.things).refresh([model.things[1], model.things[0], model.things[1]]); + $.observable(model.things[2]).setProperty("thing", model.things[2].thing + "+"); + $.observable(model.things[1]).setProperty("thing", model.things[1].thing + "+"); + $.observable(model.things).remove(2); + + // ............................... Assert ................................. + assert.equal(result, +'ObserveAll Path: root eventArgs: change: insert|index: 3|items: [object Object]|' ++ 'ObserveAll Path: root eventArgs: change: refresh|oldItems: [object Object],[object Object],[object Object],[object Object]|' ++ 'ObserveAll Path: root[0] eventArgs: change: set|path: thing|value: tree+|oldValue: tree|remove: false|' ++ 'ObserveAll Path: root[1] eventArgs: change: set|path: thing|value: bush++|oldValue: bush+|remove: false|' ++ 'ObserveAll Path: root eventArgs: change: remove|index: 2|items: [object Object]|', + + '$.observable(someArray).observeAll(observeAllCb2) raises the correct array change events'); + + $.observable(model.things).unobserveAll(observeAllCb2); + + // ............................... Assert ................................. + listeners = "" + !!$._data(model.things).events + " " + + !!$._data(model.things[0]).events + " " + + !!$._data(model.things[1]).events; + + assert.equal(listeners, "false false false", '$.unobserve(data, "arrayProp.**", observeAllCb2) removes listeners correctly'); + + // ................................ Reset .................................. + model = { + person1: person1, + person2: person2, + things: [] + }; + person1.home.address.street = "StreetOne"; + person1.home.address.ZIP = "111"; +}); + +QUnit.test('observe(... "**" ...)', function(assert) { + reset(); + + // =============================== Arrange =============================== + var inc = 0, + data = { + person: { + name: "Pete", + address: { + street: "1st Ave" + }, + phones: [{number: "111 111 1111"}, {number:"222 222 2222"}] + } + }; + + $.observe(data, "**", observeAllCb1); + + // ................................ Act .................................. + $.observable(data.person).setProperty({ + name: "Hermione", + "address.street": "Main St" + }); + + $.observable(data.person).setProperty({ + address: {street: "New Street"}, + phones: [{number:"123 123 1234"}] + }); + + $.observable(data.person.phones[0]).setProperty("foo", 34); + + $.observable(data.person.phones).insert({ + number:"456 456 AAAA" + }); + + $.observable(data.person.phones[1]).setProperty("number", data.person.phones[1].number + inc++); + + $.observable(data.person.phones).remove(0); + + $.observable(data.person.phones[0]).setProperty("number", data.person.phones[0].number + inc++); + + $.observable(data.person.phones).insert({ + number:"456 456 BBBB" + }); + + $.observable(data.person.phones[1]).setProperty("subnum", {a: 11, b: 22}); + + $.observable(data.person.phones[1]).setProperty("subnum.a", "a" + inc++); + + $.observable(data.person.phones[1]).removeProperty("subnum.b"); + + $.observable(data.person.phones).insert(1, [{number:"456 456 CCCC"}, {number:"456 456 DDDD"}]); + + $.observable(data.person.phones[2]).setProperty("number", data.person.phones[2].number + inc++); + + $.observable(data.person.phones).refresh([{number:"456 456 EEEE"}, {number:"456 456 FFFF"}]); + + $.observable(data.person.phones[1]).setProperty("number", data.person.phones[1].number + inc++); + + $.observable(data.person.phones).remove(0); + + $.observable(data.person.phones[0]).setProperty("number", data.person.phones[0].number + inc++); + +// ............................... Assert ................................. + result += "DATA: " + JSON.stringify(data); + + assert.equal(result, +'ObserveAll Path: root.person' ++ ' eventArgs: change: "set"|path: "name"|value: "Hermione"|oldValue: "Pete"|remove: false' + ++ '|ObserveAll Path: root.person.address' ++ ' eventArgs: change: "set"|path: "street"|value: "Main St"|oldValue: "1st Ave"|remove: false' + ++ '|ObserveAll Path: root.person' ++ ' eventArgs: change: "set"|path: "address"|value: {"street":"New Street"}|oldValue: {"street":"Main St"}|remove: false' + ++ '|ObserveAll Path: root.person' ++ ' eventArgs: change: "set"|path: "phones"|value: [{"number":"123 123 1234"}]|oldValue: [{"number":"111 111 1111"},{"number":"222 222 2222"}]|remove: false' + ++ '|ObserveAll Path: root.person.phones[0]' ++ ' eventArgs: change: "set"|path: "foo"|value: 34|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 AAAA"}]' + ++ '|ObserveAll Path: root.person.phones[1]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 AAAA0"|oldValue: "456 456 AAAA"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "remove"|index: 0|items: [{"number":"123 123 1234","foo":34}]' + ++ '|ObserveAll Path: root.person.phones[0]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 AAAA01"|oldValue: "456 456 AAAA0"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 BBBB"}]' + ++ '|ObserveAll Path: root.person.phones[1]' ++ ' eventArgs: change: "set"|path: "subnum"|value: {"a":11,"b":22}|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: root.person.phones[1].subnum' ++ ' eventArgs: change: "set"|path: "a"|value: "a2"|oldValue: 11|remove: false' + ++ '|ObserveAll Path: root.person.phones[1].subnum' ++ ' eventArgs: change: "set"|path: "b"|value: undefined|oldValue: 22|remove: true' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 CCCC"},{"number":"456 456 DDDD"}]' + ++ '|ObserveAll Path: root.person.phones[2]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 DDDD3"|oldValue: "456 456 DDDD"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "refresh"|oldItems: [{"number":"456 456 AAAA01"},{"number":"456 456 CCCC"},{"number":"456 456 DDDD3"},{"number":"456 456 BBBB","subnum":{"a":"a2"}}]' + ++ '|ObserveAll Path: root.person.phones[1]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 FFFF4"|oldValue: "456 456 FFFF"|remove: false' + ++ '|ObserveAll Path: root.person.phones' ++ ' eventArgs: change: "remove"|index: 0|items: [{"number":"456 456 EEEE"}]' + ++ '|ObserveAll Path: root.person.phones[0]' ++ ' eventArgs: change: "set"|path: "number"|value: "456 456 FFFF45"|oldValue: "456 456 FFFF4"|remove: false' + ++ '|DATA: {"person":{"name":"Hermione","address":{"street":"New Street"},"phones":[{"number":"456 456 FFFF45"}]}}', + + 'observeAll scenarios using "**", with observeAll.path() etc.'); + + $.unobserve(data, "**"); + + reset(); + + // =============================== Arrange =============================== + $.observe(model, "**", observeAllCb1); + + // ................................ Act .................................. + $.observable(model).setProperty({ + "person1.home.address": { + street: "1st", + ZIP: "00000" + }, + "person1.home.address.street": "upper St", + "person1.home.address.ZIP": "33333", + things: [{thing: "tree"}] + }); + $.observable(model.things).insert({thing: "bush"}); + $.observable(model.things).refresh([model.things[1], model.things[0], model.things[1]]); + $.observable(model.things[2]).setProperty("thing", model.things[2].thing + "+"); + + // ............................... Assert ................................. + assert.equal(result, +'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"1st","ZIP":"00000"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|' ++ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "street"|value: "upper St"|oldValue: "1st"|remove: false|' ++ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "ZIP"|value: "33333"|oldValue: "00000"|remove: false|' ++ 'ObserveAll Path: root eventArgs: change: "set"|path: "things"|value: [{"thing":"tree"}]|oldValue: []|remove: false|' ++ 'ObserveAll Path: root.things eventArgs: change: "insert"|index: 1|items: [{"thing":"bush"}]|' ++ 'ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush"}]|' ++ 'ObserveAll Path: root.things[0] eventArgs: change: "set"|path: "thing"|value: "bush+"|oldValue: "bush"|remove: false|', + '$.observe(data, "**", ...) works as observeAll and raises correct change events'); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", '$.observe(data, "**", ...) works as observeAll and maintains a single event handler binding on every object in the graph, regardless of structural observable changes made'); + + // ................................ Act .................................. + $.observe(model, "**", observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'Calling $.observe(data, "**", ...) more than once does not add extra event bindings'); + + // ................................ Act .................................. + $.observe(model, "**", observeAllCb3); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 2 2 2", 'Calling $.observe(data, "**", ...) with a different callback adds one binding for the new callback on each object or array'); + + // ................................ Act .................................. + $.unobserve(model, "**", observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'Calling $.unobserve(data, "**", myCallback) removes just my callback bindings'); + + // ................................ Act .................................. + $.observe(model, "**", observeAllCb1); + + $.unobserve(model.things, "**", observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 1 1 1", 'Calling $.unobserve(objectOrArrayInTree, "**", myCallback) removes just my callback bindings in the subtree only'); + + // ................................ Act .................................. + $.unobserve(model, "**"); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "true true true true true true true", + 'unobserveAll() with no callback removes all bindings from the tree'); + + // ................................ Act .................................. + $.observe(model.things, "**", observeAllCb2); + + // ............................... Assert ................................. + listeners = $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1", '$.observe(someArray, "**", observeAllCb2) works correctly'); + + $.unobserve(model.things, "**", observeAllCb2); + + listeners = "" + !!$._data(model.things).events + " " + + !!$._data(model.things[0]).events + " " + + !!$._data(model.things[1]).events; + + assert.equal(listeners, "false false false", '$.unobserve(someArray, "**", observeAllCb2) removes listeners correctly'); + + // ................................ Act .................................. + $.observe(model, "things.**", observeAllCb2); + + // ............................... Assert ................................. + listeners = $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1", '$.observe(data, "arrayProp.**", observeAllCb2) works correctly'); + + // ................................ Act .................................. + reset(); + $.observable(model.things).insert({thing: "bush"}); + $.observable(model.things).refresh([model.things[1], model.things[0], model.things[1]]); + $.observable(model.things[2]).setProperty("thing", model.things[2].thing + "+"); + $.observable(model.things[1]).setProperty("thing", model.things[1].thing + "+"); + $.observable(model.things).remove(2); + + // ............................... Assert ................................. + assert.equal(result, +'ObserveAll Path: root eventArgs: change: insert|index: 3|items: [object Object]|' ++ 'ObserveAll Path: root eventArgs: change: refresh|oldItems: [object Object],[object Object],[object Object],[object Object]|' ++ 'ObserveAll Path: root[0] eventArgs: change: set|path: thing|value: tree+|oldValue: tree|remove: false|' ++ 'ObserveAll Path: root[1] eventArgs: change: set|path: thing|value: bush++|oldValue: bush+|remove: false|' ++ 'ObserveAll Path: root eventArgs: change: remove|index: 2|items: [object Object]|', + '$.observe(data, "arrayProp.**", ...) works as observeAll and raises correct change events'); + + // ................................ Act .................................. + $.unobserve(model, "things.**", observeAllCb2); + + // ............................... Assert ................................. + listeners = "" + !!$._data(model.things).events + " " + + !!$._data(model.things[0]).events + " " + + !!$._data(model.things[1]).events; + + assert.equal(listeners, "false false false", '$.unobserve(data, "arrayProp.**", observeAllCb2) removes listeners correctly'); + + reset(); + + // ................................ Reset .................................. + inc = 0; + data = {}; + + // =============================== Arrange =============================== + + model = {}; + + function observeAllCb4(ev, eventArgs) { + if (!eventArgs.refresh) { + result += "ObserveAll Path: " + (ev.data.observeAll && ev.data.observeAll.path()) + " eventArgs: "; + for (var key in eventArgs) { + result += key + ": " + JSON.stringify(eventArgs[key]) + "|"; + } + } + } + + $.observe(model, "owner", "person^address.street", "person.**", "person^**", "person^name", observeAllCb4); + + $.observable(model).setProperty({ + owner: "Jeff", + person: { + name: "Pete", + address: { + street: "1st Ave" + }, + phones: [{number: "111 111 1111"}, {number:"222 222 2222"}] + } + }); + + // ................................ Act .................................. + $.observable(model.person).setProperty({ + name: "Hermione", + "address.street": "Main St" + }); + + $.observable(model.person).setProperty({ + address: {street: "New Street"}, + phones: [{number:"123 123 1234"}] + }); + + $.observable(model).setProperty({ + "person.name": "John", + "person.address.street": "Last St" + }); + + $.observable(model.person.phones[0]).setProperty("foo", 34); + + $.observable(model.person.phones).insert({ + number:"456 456 AAAA" + }); + + $.observable(model.person.phones[1]).setProperty("number", model.person.phones[1].number + inc++); + + $.observable(model.person.phones).remove(0); + + $.observable(model.person.phones[0]).setProperty("number", model.person.phones[0].number + inc++); + + $.observable(model.person.phones).insert({ + number:"456 456 BBBB" + }); + + $.observable(model.person.phones[1]).setProperty("subnum", {a: 11, b: 22}); + + $.observable(model.person.phones[1]).setProperty("subnum.a", "a" + inc++); + + $.observable(model.person.phones[1]).removeProperty("subnum.b"); + + $.observable(model.person.phones).insert(1, [{number:"456 456 CCCC"}, {number:"456 456 DDDD"}]); + + $.observable(model.person.phones[2]).setProperty("number", model.person.phones[2].number + inc++); + + $.observable(model.person.phones).refresh([{number:"456 456 EEEE"}, {number:"456 456 FFFF"}]); + + $.observable(model.person.phones[1]).setProperty("number", model.person.phones[1].number + inc++); + + $.observable(model.person.phones).remove(0); + + $.observable(model.person.phones[0]).setProperty("number", model.person.phones[0].number + inc++); + + // ............................... Assert ................................. + + result += "DATA: " + JSON.stringify(model); + + assert.equal(result, +'ObserveAll Path: undefined eventArgs: change: "set"|path: "owner"|value: "Jeff"|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: undefined eventArgs: change: "set"|path: "person"|value: {"name":"Pete","address":{"street":"1st Ave"},"phones":[{"number":"111 111 1111"},{"number":"222 222 2222"}]}|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: root eventArgs: change: "set"|path: "name"|value: "Hermione"|oldValue: "Pete"|remove: false' + ++ '|ObserveAll Path: root.address eventArgs: change: "set"|path: "street"|value: "Main St"|oldValue: "1st Ave"|remove: false' + ++ '|ObserveAll Path: root eventArgs: change: "set"|path: "address"|value: {"street":"New Street"}|oldValue: {"street":"Main St"}|remove: false' + ++ '|ObserveAll Path: root eventArgs: change: "set"|path: "phones"|value: [{"number":"123 123 1234"}]|oldValue: [{"number":"111 111 1111"},{"number":"222 222 2222"}]|remove: false' + ++ '|ObserveAll Path: root eventArgs: change: "set"|path: "name"|value: "John"|oldValue: "Hermione"|remove: false' + ++ '|ObserveAll Path: root.address eventArgs: change: "set"|path: "street"|value: "Last St"|oldValue: "New Street"|remove: false' + ++ '|ObserveAll Path: root.phones[0] eventArgs: change: "set"|path: "foo"|value: 34|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: root.phones eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 AAAA"}]' + ++ '|ObserveAll Path: root.phones[1] eventArgs: change: "set"|path: "number"|value: "456 456 AAAA0"|oldValue: "456 456 AAAA"|remove: false' + ++ '|ObserveAll Path: root.phones eventArgs: change: "remove"|index: 0|items: [{"number":"123 123 1234","foo":34}]' + ++ '|ObserveAll Path: root.phones[0] eventArgs: change: "set"|path: "number"|value: "456 456 AAAA01"|oldValue: "456 456 AAAA0"|remove: false' + ++ '|ObserveAll Path: root.phones eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 BBBB"}]' + ++ '|ObserveAll Path: root.phones[1] eventArgs: change: "set"|path: "subnum"|value: {"a":11,"b":22}|oldValue: undefined|remove: false' + ++ '|ObserveAll Path: root.phones[1].subnum eventArgs: change: "set"|path: "a"|value: "a2"|oldValue: 11|remove: false' + ++ '|ObserveAll Path: root.phones[1].subnum eventArgs: change: "set"|path: "b"|value: undefined|oldValue: 22|remove: true' + ++ '|ObserveAll Path: root.phones eventArgs: change: "insert"|index: 1|items: [{"number":"456 456 CCCC"},{"number":"456 456 DDDD"}]' + ++ '|ObserveAll Path: root.phones[2] eventArgs: change: "set"|path: "number"|value: "456 456 DDDD3"|oldValue: "456 456 DDDD"|remove: false' + ++ '|ObserveAll Path: root.phones eventArgs: change: "refresh"|oldItems: [{"number":"456 456 AAAA01"},{"number":"456 456 CCCC"},{"number":"456 456 DDDD3"},{"number":"456 456 BBBB","subnum":{"a":"a2"}}]' + ++ '|ObserveAll Path: root.phones[1] eventArgs: change: "set"|path: "number"|value: "456 456 FFFF4"|oldValue: "456 456 FFFF"|remove: false' + ++ '|ObserveAll Path: root.phones eventArgs: change: "remove"|index: 0|items: [{"number":"456 456 EEEE"}]' + ++ '|ObserveAll Path: root.phones[0] eventArgs: change: "set"|path: "number"|value: "456 456 FFFF45"|oldValue: "456 456 FFFF4"|remove: false' + ++ '|DATA: {"owner":"Jeff","person":{"name":"John","address":{"street":"Last St"},"phones":[{"number":"456 456 FFFF45"}]}}', + + 'observeAll scenarios using multiple paths, with or without "**", raise correct events, with observeAll.path() etc.'); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person).events.propertyChange.length + " " + + $._data(model.person.address).events.propertyChange.length + " " + + $._data(model.person.phones).events.arrayChange.length + " " + + $._data(model.person.phones[0]).events.propertyChange.length; + + assert.equal(listeners, "2 1 1 1 1", 'observeAll scenarios using multiple paths, with or without "**", duplicate listeners are avoided'); + + // ................................ Reset .................................. + $.unobserve(model, "**"); + + reset(); + + model = { + person1: person1, + person2: person2, + things: [] + }; + person1.home.address.street = "StreetOne"; + person1.home.address.ZIP = "111"; + +}); + +QUnit.test('observe(... "[]" ...)', function(assert) { + $.views.settings.advanced({_jsv: true}); + + // =============================== Arrange =============================== + var cb = function cb(ev, eventArgs) { + var val = eventArgs.value; + result += eventArgs.path + ": " + ($.isArray(val) ? val.length : val) + ", "; + }, + + reset = function() { + result = "", + data = { + list: [ + {a: "0a", b: "0b"}, + {a: "1a", b: "1b"} + ] + }; + }, + + observablyChange = function(list) { + result += "|Set01| "; + $.observable(list[0]).setProperty({a: "0a2", b: "0b2"}); + $.observable(list[1]).setProperty({a: "1a2", b: "1b2"}); + result += "|Insert23| "; + $.observable(list).insert([{a: "2a", b: "2b"}, {a: "3a", b: "3b"}]); + result += "|Set0123| "; + $.observable(list[0]).setProperty({a: "0a3", b: "0b3"}); + $.observable(list[1]).setProperty({a: "1a3", b: "1b3"}); + $.observable(list[2]).setProperty({a: "2a3", b: "2b3"}); + $.observable(list[3]).setProperty({a: "3a3", b: "3b3"}); + }, + + result = "", + data; + + // ................................ Act .................................. + reset(); + $.observe(data, 'list.[].*', cb); + + observablyChange(data.list); + result += !!$._data(data.list).events; + + $.unobserve(data, 'list.[].*', cb); + + result += JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, b: 0b2, a: 1a2, b: 1b2, |Insert23| |Set0123| a: 0a3, b: 0b3, a: 1a3, b: 1b3, false{}", + "observe '[].*' unobserve '[].*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data, 'list.[]^*', cb); + + observablyChange(data.list); + result += $._data(data.list).events.arrayChange.length; + + $.unobserve(data, 'list.[]^*', cb); + + result += !!$._data(data.list).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, b: 0b2, a: 1a2, b: 1b2, |Insert23| |Set0123| a: 0a3, b: 0b3, a: 1a3, b: 1b3, a: 2a3, b: 2b3, a: 3a3, b: 3b3, 1false{}", + "observe '[]^*' unobserve '[]^*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data, 'list.[]^a', cb); + + observablyChange(data.list); + result += $._data(data.list).events.arrayChange.length; + + $.unobserve(data, 'list.[]^*', cb); + + result += !!$._data(data.list).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 1false{}", + "observe '[]^a' unobserve '[]^*' works correctly"); + + // ................................ Act .................................. + reset(); + $.observe(data, 'list.[].a', cb); + + observablyChange(data.list); + result += !!$._data(data.list).events; + + $.unobserve(data, 'list.[]^*', cb); + + result += JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, false{}", + "observe '[].a' unobserve '[]^*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data, 'list.[]^a', cb); + + observablyChange(data.list); + result += $._data(data.list).events.arrayChange.length; + + $.unobserve(data, 'list.[].*', cb); + + result += $._data(data.list).events.arrayChange.length; + + $.unobserve(data, 'list.[]', cb); + + result += !!$._data(data.list).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 11false{}", + "observe '[]^a' unobserve '[].*' unobserve '[]' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data, 'list^[].a', cb); + + result += "|setList| "; + + $.observable(data).setProperty({list: [{a: "2a4", b: "2b4"}, {a: "3a4", b: "3b4"}]}); + observablyChange(data.list); + result += $._data(data.list).events.arrayChange.length + $._data(data).events.propertyChange.length; + + $.unobserve(data, 'list^[].*', cb); + + result += !!$._data(data.list).events + "" + !!$._data(data).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|setList| list: 2, |Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 2falsefalse{}", + "observe 'list^[].a' unobserve 'list^[].*' works correctly"); + + // =============================== Arrange =============================== + reset = function() { + result = "", + data = { + deeplist: [ + {sublist:[ + {a: "0a", b: "0b"}, + {a: "1a", b: "1b"} + ]} + ] + }; + }; + + observablyChange = function(list) { + result += "|Set01| "; + $.observable(list[0]).setProperty({a: "0a2", b: "0b2"}); + $.observable(list[1]).setProperty({a: "1a2", b: "1b2"}); + result += "|Insert23| "; + $.observable(list).insert([{a: "2a", b: "2b"}, {a: "3a", b: "3b"}]); + result += "|Set0123| "; + $.observable(list[0]).setProperty({a: "0a3", b: "0b3"}); + $.observable(list[1]).setProperty({a: "1a3", b: "1b3"}); + $.observable(list[2]).setProperty({a: "2a3", b: "2b3"}); + $.observable(list[3]).setProperty({a: "3a3", b: "3b3"}); + }; + + // ................................ Act .................................. + reset(); + $.observe(data.deeplist, '[].sublist.[].*', cb); + + observablyChange(data.deeplist[0].sublist); + result += !!$._data(data.deeplist[0].sublist).events; + + $.unobserve(data.deeplist, '[].sublist.[].*', cb); + + result += JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, b: 0b2, a: 1a2, b: 1b2, |Insert23| |Set0123| a: 0a3, b: 0b3, a: 1a3, b: 1b3, false{}", + "observe '[].sublist.[].*' unobserve '[].sublist.[].*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data.deeplist, '[].sublist.[]^*', cb); + + observablyChange(data.deeplist[0].sublist); + result += $._data(data.deeplist[0].sublist).events.arrayChange.length; + + $.unobserve(data.deeplist, '[].sublist.[]^*', cb); + + result += !!$._data(data.deeplist[0].sublist).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, b: 0b2, a: 1a2, b: 1b2, |Insert23| |Set0123| a: 0a3, b: 0b3, a: 1a3, b: 1b3, a: 2a3, b: 2b3, a: 3a3, b: 3b3, 1false{}", + "observe '[].sublist.[]^*' unobserve '[].sublist.[]^*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data, 'deeplist.[].sublist.[]^a', cb); + + observablyChange(data.deeplist[0].sublist); + result += $._data(data.deeplist[0].sublist).events.arrayChange.length; + + $.unobserve(data, 'deeplist.[].sublist.[]^*', cb); + + result += !!$._data(data.deeplist[0].sublist).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 1false{}", + "observe '[].sublist.[].a' unobserve '[].sublist.[]^*' works correctly"); + + // ................................ Act .................................. + reset(); + $.observe(data.deeplist, '[].sublist.[].a', cb); + + observablyChange(data.deeplist[0].sublist); + result += !!$._data(data.deeplist[0].sublist).events; + + $.unobserve(data.deeplist, '[].sublist.[]^*', cb); + + result += JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, false{}", + "observe '[].sublist.[].a' unobserve '[].sublist.[]^*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data.deeplist, '[].sublist.[]^a', cb); + + observablyChange(data.deeplist[0].sublist); + result += $._data(data.deeplist[0].sublist).events.arrayChange.length; + + $.unobserve(data.deeplist, '[].sublist.[].*', cb); + + result += $._data(data.deeplist[0].sublist).events.arrayChange.length; + + $.unobserve(data.deeplist, '[].sublist.[]', cb); + + result += !!$._data(data.deeplist[0].sublist).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 11false{}", + "observe '[].sublist.[]^a' unobserve '[].sublist.[].*' unobserve '[].sublist.[]' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data.deeplist, '[].sublist^[].a', cb); + + result += "|setList| "; + + $.observable(data.deeplist[0]).setProperty({sublist: [{a: "2a4", b: "2b4"}, {a: "3a4", b: "3b4"}]}); + observablyChange(data.deeplist[0].sublist); + result += $._data(data.deeplist[0].sublist).events.arrayChange.length + $._data(data.deeplist[0]).events.propertyChange.length; + + $.unobserve(data.deeplist, '[].sublist^[].*', cb); + + result += !!$._data(data.deeplist[0].sublist).events + "" + !!$._data(data.deeplist[0]).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|setList| sublist: 2, |Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 2falsefalse{}", + "observe '[].sublist^[].a' unobserve '[].sublist^[].*' works correctly"); + + // ................................ Act .................................. + + reset(); + $.observe(data.deeplist, '[]^sublist.[].a', cb); + + result += "|insertDeepList| "; + + $.observable(data.deeplist).insert(0, {sublist: [{a: "00a", b: "00b"}, {a: "01a", b: "01b"}]}); + observablyChange(data.deeplist[0].sublist); + observablyChange(data.deeplist[1].sublist); + result += $._data(data.deeplist).events.arrayChange.length + $._data(data.deeplist[0].sublist).events.arrayChange.length + $._data(data.deeplist[0]).events.propertyChange.length; + + $.unobserve(data.deeplist, '[]^sublist.[].a', cb); + + result += !!$._data(data.deeplist).events + "" + !!$._data(data.deeplist[0]).events + "" + !!$._data(data.deeplist[0].sublist).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|insertDeepList| |Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, |Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 3falsefalsefalse{}", + "observe '[]^sublist.[].a'' unobserve '[]^sublist.[].a'' works correctly"); + + // =============================== Arrange =============================== + + reset = function() { + result = "", + data = { + listoflist: [ + [ + {a: "0a", b: "0b"}, + {a: "1a", b: "1b"} + ] + ] + }; + }; + + observablyChange = function(list) { + result += "|Set01| "; + $.observable(list[0]).setProperty({a: "0a2", b: "0b2"}); + $.observable(list[1]).setProperty({a: "1a2", b: "1b2"}); + result += "|Insert23| "; + $.observable(list).insert([{a: "2a", b: "2b"}, {a: "3a", b: "3b"}]); + result += "|Set0123| "; + $.observable(list[0]).setProperty({a: "0a3", b: "0b3"}); + $.observable(list[1]).setProperty({a: "1a3", b: "1b3"}); + $.observable(list[2]).setProperty({a: "2a3", b: "2b3"}); + $.observable(list[3]).setProperty({a: "3a3", b: "3b3"}); + }; + + // ................................ Act .................................. + reset(); + $.observe(data.listoflist, '[].[].*', cb); + + observablyChange(data.listoflist[0]); + result += !!$._data(data.listoflist[0]).events; + + $.unobserve(data.listoflist, '[].[].*', cb); + + result += JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, b: 0b2, a: 1a2, b: 1b2, |Insert23| |Set0123| a: 0a3, b: 0b3, a: 1a3, b: 1b3, false{}", + "observe '[].[].*' unobserve '[].[].*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data.listoflist, '[].[]^*', cb); + + observablyChange(data.listoflist[0]); + result += $._data(data.listoflist[0]).events.arrayChange.length; + + $.unobserve(data.listoflist, '[].[]^*', cb); + + result += !!$._data(data.listoflist[0]).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, b: 0b2, a: 1a2, b: 1b2, |Insert23| |Set0123| a: 0a3, b: 0b3, a: 1a3, b: 1b3, a: 2a3, b: 2b3, a: 3a3, b: 3b3, 1false{}", + "observe '[].[]^*' unobserve '[].[]^*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data, 'listoflist.[].[]^a', cb); + + observablyChange(data.listoflist[0]); + result += $._data(data.listoflist[0]).events.arrayChange.length; + + $.unobserve(data, 'listoflist.[].[]^*', cb); + + result += !!$._data(data.listoflist[0]).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 1false{}", + "observe '[].[].a' unobserve '[].[].*' works correctly"); + + // ................................ Act .................................. + reset(); + $.observe(data.listoflist, '[].[].a', cb); + + observablyChange(data.listoflist[0]); + result += !!$._data(data.listoflist[0]).events; + + $.unobserve(data.listoflist, '[].[]^*', cb); + + result += JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, false{}", + "observe '[].[].a' unobserve '[].[].*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data.listoflist, '[].[]^a', cb); + + observablyChange(data.listoflist[0]); + result += $._data(data.listoflist[0]).events.arrayChange.length; + + $.unobserve(data.listoflist, '[].[].*', cb); + + result += $._data(data.listoflist[0]).events.arrayChange.length; + + $.unobserve(data.listoflist, '[].[]', cb); + + result += !!$._data(data.listoflist[0]).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 11false{}", + "observe '[].[]^a' unobserve '[].[].*' unobserve '[].[]' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data.listoflist, '[]^[].a', cb); + + result += "|setList| "; + + $.observable(data.listoflist[0]).refresh([{a: "2a4", b: "2b4"}, {a: "3a4", b: "3b4"}]); + observablyChange(data.listoflist[0]); + result += $._data(data.listoflist[0]).events.arrayChange.length; + + $.unobserve(data.listoflist, '[]^[].*', cb); + + result += !!$._data(data.listoflist[0]).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|setList| |Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 1false{}", + "observe '[]^[].a' unobserve '[]^[].*' works correctly"); + + // ................................ Act .................................. + reset(); + + $.observe(data.listoflist, '[]^[].a', cb); + + result += "|insertDeepList| "; + + $.observable(data.listoflist).insert(0, [[{a: "00a", b: "00b"}, {a: "01a", b: "01b"}]]); + observablyChange(data.listoflist[0]); + observablyChange(data.listoflist[1]); + result += $._data(data.listoflist).events.arrayChange.length + $._data(data.listoflist[0]).events.arrayChange.length + $._data(data.listoflist[1]).events.arrayChange.length; + + $.unobserve(data.listoflist, '[]^[].a', cb); + + result += !!$._data(data.listoflist).events + "" + !!$._data(data.listoflist[0]).events + "" + !!$._data(data.listoflist[1]).events + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(result, "|insertDeepList| |Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, |Set01| a: 0a2, a: 1a2, |Insert23| |Set0123| a: 0a3, a: 1a3, a: 2a3, a: 3a3, 3falsefalsefalse{}", + "observe '[]^[].a' unobserve '[]^[].a' works correctly"); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("observeAll - cyclic graphs", function(assert) { + reset(); + + // =============================== Arrange =============================== + // Test observeAll using data with cyclic graph - (children/parent cycle) + var data = {name: "Jo"}; + + data.children = [ + { + parent: data, + name: "Pete" + } + ]; + + $.observable(data).observeAll(observeAllCb2); + + // ................................ Act .................................. + $.observable(data).setProperty("name", "Hermione"); + + $.observable(data.children[0]).setProperty("name", "Mary"); + + // ............................... Assert ................................. + assert.equal(result, + "ObserveAll Path: root eventArgs: change: set|path: name|value: Hermione|oldValue: Jo|remove: false|" + + "ObserveAll Path: root.children[0] eventArgs: change: set|path: name|value: Mary|oldValue: Pete|remove: false|", + "observeAll with cyclic children/parent graph"); + + // ................................ Act .................................. + $.observable(data).unobserveAll(); + assert.ok(!$._data(data).events && !$._data(data.children).events && !$._data(data.children[0]).events && !$._data(data.children[0].parent).events, + "unobserveAll with cyclic children/parent graph removes all handlers"); + + reset(); + + // =============================== Arrange =============================== + // Test observeAll using data with cyclic graph - (children/parent cycle) + data = {name: "Jo"}; + + data.children = [ + { + parent: data, + name: "Pete" + }, + { + parent: data, + name: "Francois" + } + ]; + var child = data.children[0]; + $.observable(data).observeAll(observeAllCb2); + + // ................................ Act .................................. + $.observable(data).setProperty("name", "Hermione"); + + $.observable(data.children[1]).setProperty("name", "Mary"); + + $.observable(data.children).remove(0); + result += "ChildListener: " + !!$._data(child).events + "|"; + + $.observable(data.children).insert({ + parent: data, + name: "Inserted" + }); + child = data.children[0]; + result += "ChildListener: " + !!$._data(child).events + "|"; + + $.observable(data.children).remove(1); + $.observable(data.children).remove(); + result += "ChildListener: " + !!$._data(child).events + "|"; + result += "ArrayListener: " + !!$._data(data.children).events + "|"; + + // ............................... Assert ................................. + assert.equal(result, + "ObserveAll Path: root eventArgs: change: set|path: name|value: Hermione|oldValue: Jo|remove: false|" + + "ObserveAll Path: root.children[1] eventArgs: change: set|path: name|value: Mary|oldValue: Francois|remove: false|" + + "ObserveAll Path: root.children eventArgs: change: remove|index: 0|items: [object Object]|ChildListener: false|" + + "ObserveAll Path: root.children eventArgs: change: insert|index: 1|items: [object Object]|ChildListener: true|" + + "ObserveAll Path: root.children eventArgs: change: remove|index: 1|items: [object Object]|" + + "ObserveAll Path: root.children eventArgs: change: remove|index: 0|items: [object Object]|ChildListener: false|ArrayListener: true|", + "observeAll with cyclic children/parent graph, including remove action"); + + // ................................ Act .................................. + $.observable(data).unobserveAll(); + assert.ok(!$._data(data).events && !$._data(data.children).events, + "unobserveAll with cyclic children/parent graph removes all handlers"); + + reset(); + + // =============================== Arrange =============================== + // Test observeAll using data with cyclic graph - (child/parent cycle and duplicate object property - child/descendant) + data = {name: "Jo"}; + + data.child = data.descendant = { + parent: data, + name: "Pete" + }; + + $.observable(data).observeAll(observeAllCb2); + + // ................................ Act .................................. + $.observable(data).setProperty("name", "Hermione"); + + $.observable(data.child).setProperty("name", "Mary"); + $.observable(data.descendant).setProperty("name", "Jane"); + + // ............................... Assert ................................. + assert.equal(result, + "ObserveAll Path: root eventArgs: change: set|path: name|value: Hermione|oldValue: Jo|remove: false|" + + "ObserveAll Path: root.descendant eventArgs: change: set|path: name|value: Mary|oldValue: Pete|remove: false|" + + "ObserveAll Path: root.descendant eventArgs: change: set|path: name|value: Jane|oldValue: Mary|remove: false|", + "observeAll with cyclic child/parent graph with dup property child/descendant"); + + // ................................ Act .................................. + $.observable(data).unobserveAll(); + assert.ok(!$._data(data).events && !$._data(data.child).events && !$._data(data.descendant).events, + "unobserveAll with cyclic cyclic child/parent graph with dup property child/descendant removes all handlers"); + + reset(); + + // =============================== Arrange =============================== + // Test observeAll using data with cyclic graph - (children/parent cycle) + data = {name: "Jo"}; + + var children = data.children = [ + { + parent: data, + name: "Pete" + } + ]; + + child = data.children[0]; + + $.observable(data).observeAll(observeAllCb2); + + // ................................ Act .................................. + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + result += "ChildListener: " + !!$._data(child).events + "|"; + + $.observable(data.children).refresh([{ + parent: data, + name: "Fresh" + }]); + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + result += "ChildListener: " + !!$._data(child).events + "|"; + + child = data.children[0]; + result += "NewChildListener: " + !!$._data(child).events + "|"; + + $.observable(data).removeProperty("children"); + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + result += "ChildListener: " + !!$._data(child).events + "|"; + + // ............................... Assert ................................. + assert.equal(result, + "ArrayListener: true|ChildListener: true|" + + "ObserveAll Path: root.children eventArgs: change: refresh|oldItems: [object Object]|ArrayListener: true|ChildListener: false|NewChildListener: true|" + + "ObserveAll Path: root eventArgs: change: set|path: children|value: undefined|oldValue: [object Object]|remove: true|ArrayListener: false|ChildListener: false|", + "observeAll with cyclic children/parent graph - action refresh, remove array properties"); + + // ................................ Act .................................. + $.observable(data).unobserveAll(); + assert.ok(!$._data(data).events, + "unobserveAll with cyclic cyclic children/parent graph removes all handlers"); + + reset(); + + // =============================== Arrange =============================== + // Test observeAll using data with cyclic graph - (children/parent cycle and duplicate array - children/descendants) + data = {name: "Jo"}; + + children = data.children = [ + { + parent: data, + name: "Pete" + } + ]; + + child = data.children[0]; + + $.observable(data).observeAll(observeAllCb2); + + // ................................ Act .................................. + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + result += "ChildListener: " + !!$._data(child).events + "|"; + + $.observable(data.children).remove(); + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + result += "ChildListener: " + !!$._data(child).events + "|"; + + $.observable(data).setProperty("children", "string"); + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + // ............................... Assert ................................. + assert.equal(result, + "ArrayListener: true|ChildListener: true|" + + "ObserveAll Path: root.children eventArgs: change: remove|index: 0|items: [object Object]|ArrayListener: true|ChildListener: false|" + + "ObserveAll Path: root eventArgs: change: set|path: children|value: string|oldValue: |remove: false|ArrayListener: false|", + "observeAll with cyclic children/parent graph - action set array to string"); + + // ................................ Act .................................. + $.observable(data).unobserveAll(); + assert.ok(!$._data(data).events, + "unobserveAll with cyclic cyclic children/parent graph removes all handlers"); + + reset(); + + // =============================== Arrange =============================== + // Test observeAll using data with cyclic graph - (children/parent cycle and duplicate array - children/descendants) + data = {name: "Jo"}; + + children = data.children = [ + { + parent: data, + name: "Pete" + } + ]; + + child = data.children[0]; + + $.observable(data).observeAll(observeAllCb2); + + // ................................ Act .................................. + $.observable(data).setProperty("name", "Hermione"); + + $.observable(child).setProperty("name", "Mary"); + + $.observable(data.children).refresh([{ + parent: data, + name: "Fresh" + }]); + + result += "ChildListener: " + !!$._data(child).events + "|"; + + child = data.children[0]; + result += "NewChildListener: " + !!$._data(child).events + "|"; + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + $.observable(data).removeProperty("children"); + + result += "ArrayListener: " + !!$._data(children).events + "|"; + + result += "ChildListener: " + !!$._data(child).events + "|"; + + // ............................... Assert ................................. + assert.equal(result, + "ObserveAll Path: root eventArgs: change: set|path: name|value: Hermione|oldValue: Jo|remove: false|" + + "ObserveAll Path: root.children[0] eventArgs: change: set|path: name|value: Mary|oldValue: Pete|remove: false|" + + "ObserveAll Path: root.children eventArgs: change: refresh|oldItems: [object Object]|ChildListener: false|NewChildListener: true|ArrayListener: true|" + + "ObserveAll Path: root eventArgs: change: set|path: children|value: undefined|oldValue: [object Object]|remove: true|ArrayListener: false|ChildListener: false|", + "observeAll with cyclic children/parent graph - action remove array property"); + + // ................................ Act .................................. + $.observable(data).unobserveAll(); + //ok(!$._data(data).events && !$._data(data.children).events && !$._data(data.children[0]).events && !$._data(data.children[0].parent).events && !$._data(data.descendants[0].parent).events, + // "unobserveAll with cyclic cyclic children/parent graph with dup property children/descendants removes all handlers"); + + reset(); + + // =============================== Arrange =============================== + // Test observeAll using data with cyclic graph - (child/parent cycle and duplicate object property - child/descendant) + data = {name: "Jo"}; + + child = data.child = data.descendant = { + parent: data, + name: "Pete" + }; + + $.observable(data).observeAll(observeAllCb2); + + // ................................ Act .................................. + $.observable(data).setProperty("name", "Hermione"); + + $.observable(child).setProperty("name", "Mary"); + + $.observable(data).setProperty("child", undefined); + result += "ChildListener: " + !!$._data(child).events + "|"; + + $.observable(data).removeProperty("descendant"); + result += "ChildListener: " + !!$._data(child).events + "|"; + + // ............................... Assert ................................. + assert.equal(result, + "ObserveAll Path: root eventArgs: change: set|path: name|value: Hermione|oldValue: Jo|remove: false|" + + "ObserveAll Path: root.descendant eventArgs: change: set|path: name|value: Mary|oldValue: Pete|remove: false|" + + "ObserveAll Path: root eventArgs: change: set|path: child|value: undefined|oldValue: [object Object]|remove: false|ChildListener: true|" + + "ObserveAll Path: root eventArgs: change: set|path: descendant|value: undefined|oldValue: [object Object]|remove: true|ChildListener: false|", + "observeAll with cyclic child/parent graph with dup property child/descendant, with set undefined and removeProperty actions"); + + // ................................ Act .................................. + $.observable(data).unobserveAll(); + assert.ok(!$._data(data).events, + "unobserveAll with cyclic cyclic child/parent graph with dup property child/descendant removes all handlers"); + + reset(); + + // NOTE - WE DO NOT support ObserveAll on data with cyclic graphs which include DUPLICATE REFERENCES TO ARRAY PROPERTIES - such as data.children = data.descendants = [] +}); + +QUnit.test("observeAll/unobserveAll using namespaces", function(assert) { + + reset(); + + // =============================== Arrange =============================== + $.observable("my.nmspace", model).observeAll(observeAllCb1); + + // ................................ Act .................................. + $.observable(model).setProperty({ + "person1.home.address": { + street: "1st", + ZIP: "00000" + }, + "person1.home.address.street": "upper St", + "person1.home.address.ZIP": "33333", + things: [{thing: "tree"}] + }); + $.observable(model.things).insert({thing: "bush"}); + $.observable(model.things).refresh([model.things[1], model.things[0], model.things[1]]); + $.observable(model.things[2]).setProperty("thing", model.things[2].thing + "+"); + + // ............................... Assert ................................. + assert.equal(result, 'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"1st","ZIP":"00000"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "street"|value: "upper St"|oldValue: "1st"|remove: false|ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "ZIP"|value: "33333"|oldValue: "00000"|remove: false|ObserveAll Path: root eventArgs: change: "set"|path: "things"|value: [{"thing":"tree"}]|oldValue: []|remove: false|ObserveAll Path: root.things eventArgs: change: "insert"|index: 1|items: [{"thing":"bush"}]|ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush"}]|ObserveAll Path: root.things[0] eventArgs: change: "set"|path: "thing"|value: "bush+"|oldValue: "bush"|remove: false|', + "observeAll with namespace raises correct change events"); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'observeAll with namespace maintains a single event handler binding on every object in the graph, regardless of structural observable changes made'); + + // ................................ Act .................................. + $.observable("my.nmspace", model).observeAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'Calling observeAll with namespace more than once does not add extra event bindings'); + + // ................................ Act .................................. + $.observable("my.nmspace", model).observeAll(observeAllCb3); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 2 2 2", 'Calling observeAll with namespace with a different callback adds one binding for the new callback on each object or array'); + + // ................................ Act .................................. + $.observable("my.nmspace", model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "true true true true true true true", + 'Calling $.observable("my.nmspace", object).unobserveAll() removes all bindings with that namespace'); + + // ................................ Act .................................. + $.observable("my.nmspace", model).observeAll(observeAllCb1); + $.observable("our.nmspace", model).observeAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 2 2 2", 'Calling observeAll with different namespaces adds one binding for each namespace for each object or array'); + + // ................................ Act .................................. + $.observable("my.nmspace", model).unobserveAll(); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1 1 1 1 1", 'Calling $.observable("my.nmspace", object).unobserveAll() removes all bindings with that namespace'); + + // ................................ Act .................................. + $.observable("my.nmspace our.nmspace", model).observeAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 2 2 2", 'Calling observeAll with whitespace-separated namespaces adds one binding for each namespace (if not already bound) for each object or array'); + + // ................................ Act .................................. + $.observable("my.nmspace", model).observeAll(observeAllCb1); + + $.observable("my.nmspace", model.things).unobserveAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model).events.propertyChange.length + " " + + $._data(model.person1).events.propertyChange.length + " " + + $._data(model.person1.home).events.propertyChange.length + " " + + $._data(model.person1.home.address).events.propertyChange.length + " " + + $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "2 2 2 2 1 1 1", 'Calling $.observable("my.nmspace", objectOrArrayInTree).unobserveAll(myCallback) removes just my callback bindings in the subtree only'); + + // ................................ Act .................................. + $.observable(model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "true true true true true true true", + 'unobserveAll() with no callback and no namespace removes all bindings from the tree'); + + // ................................ Act .................................. + $.observable("my.nmspace", model.things).observeAll(observeAllCb1); + + // ............................... Assert ................................. + listeners = $._data(model.things).events.arrayChange.length + " " + + $._data(model.things[0]).events.propertyChange.length + " " + + $._data(model.things[1]).events.propertyChange.length; + + assert.equal(listeners, "1 1 1", '$.observable("my.nmspace", someArray).observeAll(changeHandler) works correctly'); + + $.observable(model.things).unobserveAll(observeAllCb1); + + // ................................ Act .................................. + $.observable("my.nmspace", model).observeAll(observeAllCb1); + $.observable("our.nmspace", model).observeAll(observeAllCb1); + $.observable("my.nmspace our.nmspace", model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "true true true true true true true", + '$.observable("my.nmspace our.nmspace", model).unobserveAll() removes all bindings for each namespace in whitespace-separated list'); + + // ................................ Act .................................. + $.observable("my.nmspace", model).observeAll(observeAllCb1); + $.observable("our.nmspace", model).observeAll(observeAllCb1); + $.observable("nmspace", model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "true true true true true true true", + '$.observable("nmspace", model).unobserveAll() removes all bindings for all namespaces that include that namespace component'); + + // ................................ Act .................................. + $.observable("my.nmspace.a", model).observeAll(observeAllCb1); + $.observable("our.a.nmspace.b", model).observeAll(observeAllCb1); + $.observable("nmspace.a", model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(!$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "true true true true true true true", + '$.observable("nmspace.a", model).unobserveAll() removes all bindings for all namespaces that include those namespace components'); + + // =============================== Arrange =============================== + + function myListener1(ev, eventArgs) { + calls++; + result += "Listener1 change: " + eventArgs.change + " Handler ns: '" + ev.data.ns + "' Caller ns: '" + ev.namespace + "' calls: " + calls + "|"; + } + + function myListener2(ev, eventArgs) { + calls++; + result += "Listener2 change: " + eventArgs.change + " Handler ns: '" + ev.data.ns + "' Caller ns: '" + ev.namespace + "' calls: " + calls + "|"; + } + // ................................ Act .................................. + + reset(); + $.observable("my.nmspace.a", model).observeAll(myListener1); + $.observable("our.a.nmspace.b", model).observeAll(myListener2); + + $.observable(model).setProperty("amount", 1); + $.observable(model.things).insert("water"); + + $.observable(model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(result + !$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "Listener1 change: set Handler ns: 'my.nmspace.a' Caller ns: '' calls: 1|" + + "Listener2 change: set Handler ns: 'our.a.nmspace.b' Caller ns: '' calls: 2|" + + "Listener1 change: insert Handler ns: 'my.nmspace.a' Caller ns: '' calls: 3|" + + "Listener2 change: insert Handler ns: 'our.a.nmspace.b' Caller ns: '' calls: 4|" + + "true true true true true true true", + '$.observable(model).setProperty(...)/insert(...) triggers all listeners in all namespaces'); + + // ................................ Act .................................. + + reset(); + $.observable("my.nmspace.a", model).observeAll(myListener1); + $.observable("our.a.nmspace.b", model).observeAll(myListener2); + + $.observable("my.a", model.things).insert("bread"); + $.observable("a.my", model).setProperty("amount", 2); + + $.observable("a", model).unobserveAll(); + + // ............................... Assert ................................. + assert.equal(result + !$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "Listener1 change: insert Handler ns: 'my.nmspace.a' Caller ns: 'a.my' calls: 1|" + + "Listener1 change: set Handler ns: 'my.nmspace.a' Caller ns: 'a.my' calls: 2|" + + "true true true true true true true", + '$.observable("a.b", model).setProperty(...)/insert(...) triggers all listeners whose namespaces include all of these tokens'); + + // ................................ Act .................................. + + reset(); + $.observable("my.nmspace.a", model).observeAll(myListener1); + $.observable("our.a.nmspace.b", model).observeAll(myListener2); + + $.observable("nmspace.a", model).setProperty("amount", 3); + $.observable("a.nmspace", model.things).insert("cheese"); + + $.unobserve("a.nmspace"); + + // ............................... Assert ................................. + assert.equal(result + !$._data(model).events + " " + + !$._data(model.person1).events + " " + + !$._data(model.person1.home).events + " " + + !$._data(model.person1.home.address).events + " " + + !$._data(model.things).events + " " + + !$._data(model.things[0]).events + " " + + !$._data(model.things[1]).events, + "Listener1 change: set Handler ns: 'my.nmspace.a' Caller ns: 'a.nmspace' calls: 1|" + + "Listener2 change: set Handler ns: 'our.a.nmspace.b' Caller ns: 'a.nmspace' calls: 2|" + + "Listener1 change: insert Handler ns: 'my.nmspace.a' Caller ns: 'a.nmspace' calls: 3|" + + "Listener2 change: insert Handler ns: 'our.a.nmspace.b' Caller ns: 'a.nmspace' calls: 4|" + + "true true true true true true true", + '$.observable("a.b", model).setProperty(...)/insert(...) triggers all listeners whose namespaces include all of these tokens'); + +// ................................ Reset .................................. + reset(); + model = { + person1: person1, + person2: person2, + things: [] + }; + person1.home.address.street = "StreetOne"; + person1.home.address.ZIP = "111"; + + // =============================== Arrange =============================== + + function myListener3(ev, eventArgs) { + calls++; + result += "myListener3 change: '" + eventArgs.change + + "' Caller ns: '" + ev.namespace + + "' Handler ns: '" + ev.data.ns + + ( eventArgs.change === "set" + ? "' Handler fullPath: '" + ev.data.fullPath + + "' Handler paths: '" + ev.data.paths + + "' Handler prop: '" + ev.data.prop + + (ev.data.observeAll + ? "' Handler observeAll._path : '" + ev.data.observeAll._path + + "' Handler observeAll.path() : '" + ev.data.observeAll.path() + + "' Handler observeAll.parents() : '" + ev.data.observeAll.parents().length +// + "' Handler observeAll.filter : '" + ev.data.observeAll.filter + : "") + : "" + ) + + "' calls: " + calls + "|"; + } + +// ................................ Act .................................. + + reset(); + var team = {person: {phones: []}}; + + $.observable("a.b.c", team).observeAll(myListener3); + + $.observable("a", team).setProperty({ + person: { + name: "Pete", + phones: [], + friend: {} + } + }); + $.observable("b", team.person.friend).setProperty("name","newName1"); + $.observable("c", team.person.phones).insert("newPhone"); + $.observable("d", team.person.friend).setProperty("name","newName2"); + $.observable("e", team.person.phones).insert("newPhone2"); + + // ............................... Assert ................................. + assert.equal(result, + "myListener3 change: 'set' Caller ns: 'a' Handler ns: 'a.b.c' Handler fullPath: '*' Handler paths: '' Handler prop: '*' " + + "Handler observeAll._path : 'root' Handler observeAll.path() : 'root' Handler observeAll.parents() : '1' calls: 1|" + + "myListener3 change: 'set' Caller ns: 'b' Handler ns: 'a.b.c' Handler fullPath: '*' Handler paths: '' Handler prop: '*' " + + "Handler observeAll._path : 'root.person.friend' Handler observeAll.path() : 'root.person.friend' Handler observeAll.parents() : '3' calls: 2|" + + "myListener3 change: 'insert' Caller ns: 'c' Handler ns: 'a.b.c' calls: 3|", + "call observeAll namespaces"); + +$.unobserve("a.b.c"); + +// ................................ Act .................................. + + reset(); + team = {person: {phones: []}}; + + $.observe("a.b.c", team, "**", myListener3); + + $.observable("a", team).setProperty({ + person: { + name: "Pete", + phones: [], + friend: {} + } + }); + $.observable("b", team.person.friend).setProperty("name","newName1"); + $.observable("c", team.person.phones).insert("newPhone"); + $.observable("d", team.person.friend).setProperty("name","newName2"); + $.observable("e", team.person.phones).insert("newPhone2"); + + // ............................... Assert ................................. + assert.equal(result, + "myListener3 change: 'set' Caller ns: 'a' Handler ns: 'a.b.c' Handler fullPath: '*' Handler paths: '' Handler prop: '*' " + + "Handler observeAll._path : 'root' Handler observeAll.path() : 'root' Handler observeAll.parents() : '1' calls: 1|" + + "myListener3 change: 'set' Caller ns: 'b' Handler ns: 'a.b.c' Handler fullPath: '*' Handler paths: '' Handler prop: '*' " + + "Handler observeAll._path : 'root.person.friend' Handler observeAll.path() : 'root.person.friend' Handler observeAll.parents() : '3' calls: 2|" + + "myListener3 change: 'insert' Caller ns: 'c' Handler ns: 'a.b.c' calls: 3|", + 'call observe with "**" - namespaces'); + +$.unobserve("a.b.c"); + +// ................................ Act .................................. + + reset(); + team = {person: {phones: []}}; + + $.observe("a.b.c", team, "person^phones", "person^friend.name", myListener3); + + $.observable("a", team).setProperty({ + person: { + name: "Pete", + phones: [], + friend: {} + } + }); + $.observable("b", team.person.friend).setProperty("name","newName1"); + $.observable("c", team.person.phones).insert("newPhone"); + $.observable("d", team.person.friend).setProperty("name","newName2"); + $.observable("e", team.person.phones).insert("newPhone2"); + + // ............................... Assert ................................. + + assert.equal(result, + "myListener3 change: 'set' Caller ns: 'a' Handler ns: 'a.b.c' Handler fullPath: 'person.phones' Handler paths: 'phones,friend.name' Handler prop: 'person' calls: 1|" + + "myListener3 change: 'set' Caller ns: 'b' Handler ns: 'a.b.c' Handler fullPath: 'friend.name' Handler paths: '' Handler prop: 'name' calls: 2|" + + "myListener3 change: 'insert' Caller ns: 'c' Handler ns: 'a.b.c' calls: 3|", + "call observe deep paths, with namespaces"); + +$.unobserve("a.b.c"); + +// ................................ Act .................................. + + reset(); + team = {person: {phones: []}}; + + $.observable("a.b.c", team).observeAll(myListener3); + + $.observable("a", team).setProperty({ + person: {name: "Pete"} + }); + + $.unobserve("a.b.c", myListener3); + + // ............................... Assert ................................. + $.views.settings.advanced({_jsv: true}); + + assert.equal(JSON.stringify([_jsv.cbBindings, $._data(team).events, $._data(team.person).events]), "[{},null,null]", + "observe/unobserve with namespaces - all bindings removed when unobserve called"); + + $.views.settings.advanced({_jsv: false}); + + reset(); + +//TODO add test cases for filter with observe and observeAll, and DataMap etc. +//function filter(allPath, object, parentObs) { +// debugger; +//} +}); + +QUnit.test("$.views.viewModels", function(assert) { + // =============================== Arrange =============================== + var Constr = $.views.viewModels({getters: ["a", "b"]}); + // ................................ Act .................................. + var vm = Constr("a1 ", "b1 "); + var result = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + // ............................... Assert ................................. + assert.equal(result, "a1 b1 a2 b2 ", "viewModels, two getters, no methods"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: ["a", "b", "c"], extend: {add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + }}}); + // ................................ Act .................................. + vm = Constr("a1 ", "b1 ", "c1 "); + vm.add("before "); + result = vm.c(); + // ............................... Assert ................................. + assert.equal(result, "before a1 b1 c1 ", "viewModels, two getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({extend: {add: function(val) { + this.foo = val; + }}}); + // ................................ Act .................................. + vm = Constr(); + vm.add("before"); + result = vm.foo; + // ............................... Assert ................................. + assert.equal(result, "before", "viewModels, no getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: []}); + // ................................ Act .................................. + vm = Constr(); + result = JSON.stringify(vm); + // ............................... Assert ................................. + assert.equal(result, "{}", "viewModels, no getters, no methods"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + } + }); + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 "}); + var changes = ""; + function observeAllHandler(ev, evArgs) { + changes += evArgs.value; + } + $.observable(vm).observeAll(observeAllHandler); + + result = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + + // ............................... Assert ................................. + assert.equal(result + "|" + changes, "a1 b1 a2 b2 |a2 b2 ", "viewModels, two getters, no methods"); + changes = ""; + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 "}); + + result = vm.a() + vm.b(); + + // ............................... Assert ................................. + assert.equal(result + "|" + changes, "a3 b3 |a3 b3 ", "viewModels merge, two getters, no methods"); + changes = ""; + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + assert.equal(result, '{"a":"a3 ","b":"b3 "}', "viewModels unmap, two getters, no methods"); + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // =============================== Arrange =============================== + var viewModels = $.views.viewModels({ + T1: { + getters: ["a", {getter: "b"}, "c", "d", {getter: "e", type: undefined}, {getter: "f", type: null}, {getter: "g", type: "foo"}, {getter: "h", type: ""}] + } + }, {}); + // ................................ Act .................................. + vm = viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 ", d: "d1 ", e: "e1 ", f: "f1 ", g: "g1 ", h: "h1 "}); + $.observable(vm).observeAll(observeAllHandler); + + result = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + // ............................... Assert ................................. + assert.equal(result + "|" + changes, "a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 |a2 b2 ", + "viewModels, multiple unmapped getters, no methods"); + changes = ""; + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 ", d: "d3 ", e: "e3 ", f: "f3 ", g: "g3 ", h: "h3 "}); + + result = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + + // ............................... Assert ................................. + assert.equal(result + "|" + changes, "a3 b3 c3 d3 e3 f3 g3 h3 |a3 b3 c3 d3 e3 f3 g3 h3 ", + "viewModels merge, multiple unmapped getters, no methods"); + changes = ""; + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + assert.equal(result, '{"a":"a3 ","b":"b3 ","c":"c3 ","d":"d3 ","e":"e3 ","f":"f3 ","g":"g3 ","h":"h3 "}', + "viewModels unmap, multiple unmapped getters, no methods"); + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b", "c"], + extend : { + add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + } + } + } + }); + + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 "}); + $.observable(vm).observeAll(observeAllHandler); + + vm.add("before "); + result = vm.c(); + + // ............................... Assert ................................. + assert.equal(result + "|" + changes, "before a1 b1 c1 |before a1 b1 c1 ", "viewModels, getters and one method"); + changes = ""; + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 "}); + vm.add("updated "); + result = vm.c(); + + // ............................... Assert ................................. + assert.equal(result + "|" + changes, "updated a3 b3 c3 |a3 b3 c3 updated a3 b3 c3 ", "viewModels merge, getters and one method"); + changes = ""; + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + assert.equal(result, '{"a":"a3 ","b":"b3 ","c":"updated a3 b3 c3 "}', "viewModels unmap, getters and one method"); + changes = ""; + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + }, + T2: { + getters: [{getter: "t1", type: "T1"}, {getter: "t1Arr", type: "T1"}, {getter: "t1OrNull", type: "T1", defaultVal: null}] + } + }); + viewModels = $.views.viewModels; + // ................................ Act .................................. + var t1 = viewModels.T1.map({a: "a1 ", b: "b1 "}); // Create a T1 + var t2 = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: [t1.unmap(), {a: "a2 ", b: "b2 "}]}); // Create a T2 (using unmap to scrape values the T1: vm) + + $.observable(t1).observeAll(observeAllHandler); + $.observable(t2).observeAll(observeAllHandler); + + result = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t2.t1Arr()[0].merge({a: "a1x ", b: "b1x "}); // merge not the root, but a VM instance within hierarchy: vm2.t1Arr()[0] - leaving rest unchanged + result = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + assert.equal(result + "|" + changes, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1x ","b":"b1x "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}|a1x b1x ', + "viewModels, merge deep node"); + changes = ""; + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // ................................ Act .................................. + var t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + var t2FromArr = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + result = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + t1Arr.push(viewModels.T1("a3 ", "b3 ")); + t2FromArr = viewModels.T2.map({t1: {a: "a4 ", b: "b4 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + result = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a4 ","b":"b4 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "},{"a":"a3 ","b":"b3 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + var t2new = viewModels.T2(viewModels.T1("a3 ", "b3 "), [viewModels.T1("a1 ", "b1 "), viewModels.T1("a2 ", "b2 ")], viewModels.T1("a4 ", "b4 ") ); + result = JSON.stringify(t2new.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":{"a":"a4 ","b":"b4 "}}', + "viewModels, hierarchy"); +}); + +})(this.jQuery); diff --git a/test/unit-tests/tests-jsobservable.js b/test/unit-tests/tests-jsobservable.js index f3b2b86..75bcf32 100644 --- a/test/unit-tests/tests-jsobservable.js +++ b/test/unit-tests/tests-jsobservable.js @@ -4,8 +4,7 @@ // =============== INIT APP =============== -var isIE8 = window.attachEvent && !window.addEventListener, - viewContent, before, after, lastEvData, lastEventArgs, listeners, result1, handlersCount, elems, +var viewContent, before, after, lastEvData, lastEventArgs, listeners, result1, handlersCount, elems, result = "", calls = 0; @@ -242,8 +241,7 @@ QUnit.test("PropertyChange: setProperty()", function(assert) { $.observable(person).setProperty("dob", dt); // ............................... Assert ................................. - assert.equal(result, isIE8 ? 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: 10/24/1991 value: \"1980-10-24T07:00:00Z\", eventArgs.path: dob|' - : 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: 10/24/1991 value: "1980-10-24T07:00:00.000Z", eventArgs.path: dob|', + assert.equal(result, 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: 10/24/1991 value: "1980-10-24T07:00:00.000Z", eventArgs.path: dob|', "setProperty to Date object"); // ................................ Reset ................................ @@ -256,8 +254,7 @@ QUnit.test("PropertyChange: setProperty()", function(assert) { $.observable(person).setProperty("dob", dt2); // ............................... Assert ................................. - assert.equal(result, isIE8 ? 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: \"1980-10-24T07:00:00Z\" value: \"1980-10-26T07:00:00Z\", eventArgs.path: dob|' - : 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: "1980-10-24T07:00:00.000Z" value: "1980-10-26T07:00:00.000Z", eventArgs.path: dob|', + assert.equal(result, 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: "1980-10-24T07:00:00.000Z" value: "1980-10-26T07:00:00.000Z", eventArgs.path: dob|', "setProperty to another Date object"); // ................................ Reset ................................ @@ -267,8 +264,7 @@ QUnit.test("PropertyChange: setProperty()", function(assert) { $.observable(person).setProperty("dob", "1/24/2002"); // ............................... Assert ................................. - assert.equal(result, isIE8 ? 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: \"1980-10-26T07:00:00Z\" value: 1/24/2002, eventArgs.path: dob|' - : 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: "1980-10-26T07:00:00.000Z" value: 1/24/2002, eventArgs.path: dob|', + assert.equal(result, 'calls: 1, ev.data: prop: dob, eventArgs: oldValue: "1980-10-26T07:00:00.000Z" value: 1/24/2002, eventArgs.path: dob|', "setProperty to date as string"); // ................................ Reset ................................ @@ -1205,6 +1201,12 @@ QUnit.test("Array", function(assert) { + "regularCallbackCalls: 5, eventArgs: change: insert|1 1 true", '$.observe(object, "a.b.*", myListener) listens to all propertyChange events on object.a.b and to array change on any array properties of object.a.b'); + "regularCallbackCalls: 1, eventArgs: change: insert|" + "calls: 2, ev.data: prop: *, eventArgs: oldValue: [4,3,2,1,11,16,17,16,18] value: [1,2,10], eventArgs.path: arr|" + "calls: 3, ev.data: prop: *, eventArgs: oldValue: undefined value: 2nd, eventArgs.path: notThereBefore|" + "calls: 4, ev.data: prop: *, eventArgs: oldValue: n value: 1st, eventArgs.path: first|" + "regularCallbackCalls: 5, eventArgs: change: insert|1 1 true" + // ................................ Act .................................. reset(); $.unobserve(obj, "name.*", myListener); @@ -3055,14 +3057,12 @@ QUnit.test("observeAll", function(assert) { // ............................... Assert ................................. assert.equal(result, -'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"1st","ZIP":"00000"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|' -+ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "street"|value: "upper St"|oldValue: "1st"|remove: false|' -+ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "ZIP"|value: "33333"|oldValue: "00000"|remove: false|' + 'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"upper St","ZIP":"33333"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|' + 'ObserveAll Path: root eventArgs: change: "set"|path: "things"|value: [{"thing":"tree"}]|oldValue: []|remove: false|' + 'ObserveAll Path: root.things eventArgs: change: "insert"|index: 1|items: [{"thing":"bush"}]|' -+ 'ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush"}]|' ++ 'ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush\"}]|' + 'ObserveAll Path: root.things[0] eventArgs: change: "set"|path: "thing"|value: "bush+"|oldValue: "bush"|remove: false|', - "observeAll raises correct change events"); + "observeAll raises correct change events"); // ............................... Assert ................................. listeners = $._data(model).events.propertyChange.length + " " @@ -3344,14 +3344,12 @@ QUnit.test('observe(... "**" ...)', function(assert) { // ............................... Assert ................................. assert.equal(result, -'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"1st","ZIP":"00000"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|' -+ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "street"|value: "upper St"|oldValue: "1st"|remove: false|' -+ 'ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "ZIP"|value: "33333"|oldValue: "00000"|remove: false|' + 'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"upper St","ZIP":"33333"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|' + 'ObserveAll Path: root eventArgs: change: "set"|path: "things"|value: [{"thing":"tree"}]|oldValue: []|remove: false|' + 'ObserveAll Path: root.things eventArgs: change: "insert"|index: 1|items: [{"thing":"bush"}]|' -+ 'ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush"}]|' ++ 'ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush\"}]|' + 'ObserveAll Path: root.things[0] eventArgs: change: "set"|path: "thing"|value: "bush+"|oldValue: "bush"|remove: false|', - '$.observe(data, "**", ...) works as observeAll and raises correct change events'); + '$.observe(data, "**", ...) works as observeAll and raises correct change events'); // ............................... Assert ................................. listeners = $._data(model).events.propertyChange.length + " " @@ -4418,7 +4416,12 @@ QUnit.test("observeAll/unobserveAll using namespaces", function(assert) { $.observable(model.things[2]).setProperty("thing", model.things[2].thing + "+"); // ............................... Assert ................................. - assert.equal(result, 'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"1st","ZIP":"00000"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "street"|value: "upper St"|oldValue: "1st"|remove: false|ObserveAll Path: root.person1.home.address eventArgs: change: "set"|path: "ZIP"|value: "33333"|oldValue: "00000"|remove: false|ObserveAll Path: root eventArgs: change: "set"|path: "things"|value: [{"thing":"tree"}]|oldValue: []|remove: false|ObserveAll Path: root.things eventArgs: change: "insert"|index: 1|items: [{"thing":"bush"}]|ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush"}]|ObserveAll Path: root.things[0] eventArgs: change: "set"|path: "thing"|value: "bush+"|oldValue: "bush"|remove: false|', + assert.equal(result, + 'ObserveAll Path: root.person1.home eventArgs: change: "set"|path: "address"|value: {"street":"upper St","ZIP":"33333"}|oldValue: {"street":"StreetOne","ZIP":"111"}|remove: false|' ++ 'ObserveAll Path: root eventArgs: change: "set"|path: "things"|value: [{"thing":"tree"}]|oldValue: []|remove: false|' ++ 'ObserveAll Path: root.things eventArgs: change: "insert"|index: 1|items: [{"thing":"bush"}]|' ++ 'ObserveAll Path: root.things eventArgs: change: "refresh"|oldItems: [{"thing":"tree"},{"thing":"bush\"}]|' ++ 'ObserveAll Path: root.things[0] eventArgs: change: "set"|path: "thing"|value: "bush+"|oldValue: "bush"|remove: false|', "observeAll with namespace raises correct change events"); // ............................... Assert ................................. @@ -4784,7 +4787,7 @@ $.unobserve("a.b.c"); + "myListener3 change: 'insert' Caller ns: 'c' Handler ns: 'a.b.c' calls: 3|", 'call observe with "**" - namespaces'); -$.unobserve("a.b.c"); + $.unobserve("a.b.c"); // ................................ Act .................................. @@ -4844,6 +4847,7 @@ $.unobserve("a.b.c"); //} }); +if ($.views.tags) { // $.views.viewModels requires JsRender to be loaded QUnit.test("$.views.viewModels", function(assert) { // =============================== Arrange =============================== var Constr = $.views.viewModels({getters: ["a", "b"]}); @@ -5073,5 +5077,166 @@ QUnit.test("$.views.viewModels", function(assert) { assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":{"a":"a4 ","b":"b4 "}}', "viewModels, hierarchy"); }); +} + +QUnit.test("setProperty/insert/remove etc. using async or batched events", function(assert) { + // =============================== Arrange =============================== + var done = assert.async(), + count = 0, + batch = [], + person = { first: "Jo", last: "Blow" }, + numbers = [0], + count = 1; + + function makeChanges(delay) { + result+= count + ": Set first and last"; + $.observable(person, delay).setProperty({first: person.first + count, last: person.last + count}); + result+= count + ": Insert number " + count; + $.observable(numbers, delay).insert([count, count+"b"]); + result+= count + ": Set first"; + $.observable(person, delay).setProperty("first", person.first + "!"); + result+= count + ": Remove number " + numbers[numbers.length - 1]; + $.observable(numbers, delay).remove(); + } + + function reset() { + $.observable(person).setProperty({first: "Jo", last: "Blow"}); + $.observable(numbers).remove(1, numbers.length-1); + count = 1; + result = ""; + } + + $.observe(person, "*", numbers, "**", function(ev, eventArgs) { + var message = " Event:"; + if (eventArgs.change === "set") { + message += "Set " + eventArgs.path + ": - " + eventArgs.value; + } else if (eventArgs.change === "insert") { + message += "Insert: - " + eventArgs.items[0]; + } else if (eventArgs.change === "remove") { + message += "Remove: - " + eventArgs.items[0]; + } + result+= message; + }); + + // ................................ Act .................................. + result = ""; + makeChanges(); + + // ............................... Assert ................................. + assert.equal(result, + "1: Set first and last Event:Set first: - Jo1 Event:Set last: - Blow11: Insert number 1 Event:Insert: - 11: Set first Event:Set first: - Jo1!1: Remove number 1b Event:Remove: - 1b", + "Synchronous events"); + + // ................................ Act .................................. + reset(); + makeChanges(batch); + batch.trigger(); + + // ............................... Assert ................................. + assert.equal(result, + "1: Set first and last1: Insert number 11: Set first1: Remove number 1b Event:Set last: - Blow1 Event:Insert: - 1 Event:Set first: - Jo1! Event:Remove: - 1b", + "Batched events, with batch.trigger()"); + + // ................................ Act .................................. + reset(); + makeChanges(true); + + // ............................... Assert ................................. + setTimeout(function() { + assert.equal(result, + "1: Set first and last1: Insert number 11: Set first1: Remove number 1b Event:Set last: - Blow1 Event:Insert: - 1 Event:Set first: - Jo1! Event:Remove: - 1b", + "Asynchronous events"); + + // ................................ Reset ................................ + result = ""; + $.unobserve(); + done(); + }, 0); +}); + +QUnit.test("setProperty/insert/remove etc. using namespaces", function(assert) { + // =============================== Arrange =============================== + var done = assert.async(), + count = 0, + batch = [], + person = { first: "Jo", last: "Blow" }, + numbers = [0], + count = 1; + + function makeChanges(ns, delay) { + result+= count + ": Set first and last"; + $.observable(ns, person, delay).setProperty({first: person.first + count, last: person.last + count}); + result+= count + ": Insert number " + count; + $.observable(ns, numbers, delay).insert([count, count+"b"]); + result+= count + ": Set first"; + $.observable(ns, person, delay).setProperty("first", person.first + "!"); + result+= count + ": Remove number " + numbers[numbers.length - 1]; + $.observable(ns, numbers, delay).remove(); + } + + function reset() { + $.observable(person).setProperty({first: "Jo", last: "Blow"}); + $.observable(numbers).remove(1, numbers.length-1); + count = 1; + result = ""; + } + + $.observe("my.name.spaces", person, "*", numbers, "**", function(ev, eventArgs) { + var message = " Event:"; + if (eventArgs.change === "set") { + message += "Set " + eventArgs.path + ": - " + eventArgs.value; + } else if (eventArgs.change === "insert") { + message += "Insert: - " + eventArgs.items[0]; + } else if (eventArgs.change === "remove") { + message += "Remove: - " + eventArgs.items[0]; + } + result+= message; + }); + + // ................................ Act .................................. + result = ""; + makeChanges("name.spaces.my"); + + // ............................... Assert ................................. + assert.equal(result, + "1: Set first and last Event:Set first: - Jo1 Event:Set last: - Blow11: Insert number 1 Event:Insert: - 11: Set first Event:Set first: - Jo1!1: Remove number 1b Event:Remove: - 1b", + "Synchronous events, with namespace"); + + // ................................ Act .................................. + reset(); + makeChanges("name.spaces.my", batch); + batch.trigger(); + + // ............................... Assert ................................. + assert.equal(result, + "1: Set first and last1: Insert number 11: Set first1: Remove number 1b Event:Set last: - Blow1 Event:Insert: - 1 Event:Set first: - Jo1! Event:Remove: - 1b", + "Batched events, with batch.trigger(), with namespace"); + + // ................................ Act .................................. + reset(); + makeChanges("name.another", batch); // Namespace does not match the listener namespace + batch.trigger(); + + // ............................... Assert ................................. + assert.equal(result, + "1: Set first and last1: Insert number 11: Set first1: Remove number 1b", + "Batched events, with batch.trigger(), but non-matching namespace"); + + // ................................ Act .................................. + reset(); + makeChanges("my.name.spaces", true); + + // ............................... Assert ................................. + setTimeout(function() { + assert.equal(result, + "1: Set first and last1: Insert number 11: Set first1: Remove number 1b Event:Set last: - Blow1 Event:Insert: - 1 Event:Set first: - Jo1! Event:Remove: - 1b", + "Asynchronous events, with namespace"); + + // ................................ Reset ................................ + result = ""; + $.unobserve(); + done(); + }, 0); +}); })(this.jQuery); diff --git a/test/unit-tests/tests-jsrender-no-jquery-withIE.js b/test/unit-tests/tests-jsrender-no-jquery-withIE.js new file mode 100644 index 0000000..fedddf5 --- /dev/null +++ b/test/unit-tests/tests-jsrender-no-jquery-withIE.js @@ -0,0 +1,2466 @@ +/*global QUnit*/ +(function(undefined) { +"use strict"; + +var global = (0, eval)('this'), // jshint ignore:line + + isIE8 = global.attachEvent && !global.addEventListener, + isBrowser = !!global.document, + + $ = global.jsrender || global.jQuery; // On Node.js with QUnit, jsrender is added as namespace, to global + +if (!isBrowser) { + global.document = {}; +} + +function compileTmpl(template) { + try { + return typeof $.templates(template).fn === "function" ? "compiled" : "failed compile"; + } catch(e) { + return e.message; + } +} + +function sort(array) { + var ret = ""; + if (this.tagCtx.props.reverse) { + // Render in reverse order + if (arguments.length > 1) { + for (i = arguments.length; i; i--) { + ret += sort.call(this, arguments[ i - 1 ]); + } + } else { + for (var i = array.length; i; i--) { + ret += this.tagCtx.render(array[ i - 1 ]); + } + } + } else { + // Render in original order + ret += this.tmpl.render(array); + } + return ret; +} + +var person = {name: "Jo"}, + people = [{name: "Jo"}, {name: "Bill"}], + towns = [{name: "Seattle"}, {name: "Paris"}, {name: "Delhi"}]; + +var tmplString = "A_{{:name}}_B"; +$.views.tags({sort: sort}); + +QUnit.module("tagParser"); +QUnit.test("{{if}} {{else}}", function(assert) { + assert.equal(compileTmpl("A_{{if true}}{{/if}}_B"), "compiled", "Empty if block: {{if}}{{/if}}"); + assert.equal(compileTmpl("A_{{if true}}yes{{/if}}_B"), "compiled", "{{if}}...{{/if}}"); + assert.equal(compileTmpl("A_{{if true/}}yes{{/if}}_B"), "Syntax error\nUnmatched or missing {{/if}}, in template:\nA_{{if true/}}yes{{/if}}_B", "unmatched or missing tag error"); + assert.equal($.templates(" a'b\"c\\").render(), " a\'b\"c\\", "Correct escaping of quotes and backslash"); +}); + +QUnit.test("syntax errors", function(assert) { + assert.equal(compileTmpl("{^{*:foo}}"), "Syntax error\n{^{*:foo}}", "Syntax error for {^{* ...}}"); + assert.equal(compileTmpl("{{:foo/}}"), "Syntax error\n{{:foo/}}", "Syntax error for {{: ... /}}"); + assert.equal(compileTmpl("{{:foo:}}"), "Syntax error\n{{:foo:}}", "Syntax error for {{: ... :}}"); + assert.equal(compileTmpl("{^{:foo:}}"), "Syntax error\n{^{:foo:}}", "Syntax error for {^{: ... :}}"); + assert.equal(compileTmpl("{{mytag foo :}}"), "Syntax error\n{{mytag foo :}}", "Syntax error for {{mytag ... :}}"); + assert.equal(compileTmpl("{^{mytag foo :}}"), "Syntax error\n{^{mytag foo :}}", "Syntax error for {^{mytag ... :}}"); + assert.equal(compileTmpl("{{if foo?bar:baz}}{{/if}}"), "compiled", "No syntax error for {{tag foo?bar:baz}}"); + assert.equal(compileTmpl("{{for [1,2]/}}"), "Syntax error\n[1,2]", "Syntax error for {{for [1,2]}} - top-level array"); + assert.equal(compileTmpl("{{:constructor()}}"), "Syntax error\nconstructor", "Syntax error for {{: ...constructor ...}}"); + assert.equal(compileTmpl("{{for #tmpl.constructor()}}"), "Syntax error\n#tmpl.constructor", "Syntax error for {{for ...constructor ...}}"); + +$.views.settings.debugMode(true); + assert.equal($.templates('{{:#data["constructor"]["constructor"]("alert(0);")()}}').render(), "{Error: Syntax error\n}", 'Syntax error 1 for ["constructor]"'); + assert.equal($.templates('{{:valueOf["constructor"]("alert(1);")()}}').render(1), "{Error: Syntax error\n}", 'Syntax error 2 for ["constructor]"'); + assert.equal($.templates('{{:valueOf["const"+"ructor"]("alert(2);")()}}').render(1), "{Error: Syntax error\n}", 'Syntax error 3 for ["constructor]"'); + assert.equal($.templates('{{if true ~c=toString["con" + foo + "or"]}}{{:convert=~c("alert(3);")}}{{/if}}').render({foo: "struct"}), "{Error: Syntax error\n}", 'Syntax error 1 for indirect ["constructor]"'); + assert.equal($.templates('{{if true ~tmp="constructo"}}{{if true ~tmp2="r"}}{{:toString[~tmp + ~tmp2]}}{{/if}}{{/if}}').render(1), "{Error: Syntax error\n}", 'Syntax error 2 for indirect ["constructor]"'); +$.views.settings.debugMode(false); +}); + +QUnit.module("{{if}}"); +QUnit.test("{{if}}", function(assert) { + assert.equal($.templates("A_{{if true}}yes{{/if}}_B").render(), "A_yes_B", "{{if a}}: a"); + assert.equal($.templates("A_{{if false}}yes{{/if}}_B").render(), "A__B", "{{if a}}: !a"); + assert.equal($.templates("A_{{if true}}{{/if}}_B").render(), "A__B", "{{if a}}: empty: a"); + assert.equal($.templates("A_{{if false}}{{/if}}_B").render(), "A__B", "{{if a}}: empty: !a"); +}); + +QUnit.test("{{if}} {{else}}", function(assert) { + assert.equal($.templates("A_{{if true}}yes{{else}}no{{/if}}_B").render(), "A_yes_B", "{{if a}} {{else}}: a"); + assert.equal($.templates("A_{{if false}}yes{{else}}no{{/if}}_B").render(), "A_no_B", "{{if a}} {{else}}: !a"); + assert.equal($.templates("A_{{if true}}yes{{else true}}or{{else}}no{{/if}}_B").render(), "A_yes_B", "{{if a}} {{else b}} {{else}}: a"); + assert.equal($.templates("A_{{if false}}yes{{else true}}or{{else}}no{{/if}}_B").render(), "A_or_B", "{{if a}} {{else b}} {{else}}: b"); + assert.equal($.templates("A_{{if false}}yes{{else false}}or{{else}}no{{/if}}_B").render(), "A_no_B", "{{if a}} {{else b}} {{else}}: !a!b"); + assert.equal($.templates("A_{{if undefined}}yes{{else true}}or{{else}}no{{/if}}_B").render({}), "A_or_B", "{{if undefined}} {{else b}} {{else}}: !a!b"); + assert.equal($.templates("A_{{if false}}yes{{else undefined}}or{{else}}no{{/if}}_B").render({}), "A_no_B", "{{if a}} {{else undefined}} {{else}}: !a!b"); + assert.equal($.templates("A_{{if false}}
x
_B").render(), "A_
x
_B", "{{if}} and {{else}} work across HTML tags"); + assert.equal($.templates("A_
x
_B").render(), "A_
x
_B", "{{if}} and {{else}} work across quoted strings"); +}); + +QUnit.test("{{if}} {{else}} external templates", function(assert) { + assert.equal($.templates("A_{{if true tmpl='yes
'/}}_B").render(), "A_yes
_B", "{{if a tmpl=foo/}}: a"); + assert.equal($.templates("A_{{if false tmpl='yes
'}}{{else false tmpl='or
'}}{{else tmpl='no
'}}{{/if}}_B").render(), "A_no
_B", "{{if a tmpl=foo}}{{else b tmpl=bar}}{{else tmpl=baz}}: !a!b"); +}); + +QUnit.module("{{:}}"); +QUnit.test("convert", function(assert) { + assert.equal($.templates("{{>#data}}").render("
'\"&"), "<br/>'"&", "default html converter"); + assert.equal($.templates("{{html:#data}}").render("
'\"&"), "<br/>'"&", "html converter"); + assert.equal($.templates("{{:#data}}").render("
'\"&"), "
'\"&", "no convert"); + + function loc(data) { + switch (data) {case "desktop": return "bureau";} + } + $.views.converters("loc", loc); + assert.equal($.templates("{{loc:#data}}:{{loc:'desktop'}}").render("desktop"), "bureau:bureau", '$.views.converters("loc", locFunction);... {{loc:#data}}'); +}); + +QUnit.test("paths", function(assert) { + assert.equal($.templates("{{:a}}").render({a: "aVal"}), "aVal", "a"); + assert.equal($.templates("{{:a.b}}").render({a: {b: "bVal"}}), "bVal", "a.b"); + assert.equal($.templates("{{:a.b.c}}").render({a: {b: {c: "cVal"}}}), "cVal", "a.b.c"); + assert.equal($.templates("{{:a.name}}").render({a: {name: "aName"}}), "aName", "a.name"); + assert.equal($.templates("{{:a['name']}}").render({a: {name: "aName"}}), "aName", "a['name']"); + assert.equal($.templates("{{:a['x - _*!']}}").render({a: {"x - _*!": "aName"}}), "aName", "a['x - _*!']"); + assert.equal($.templates("{{:#data['x - _*!']}}").render({"x - _*!": "aName"}), "aName", "#data['x - _*!']"); + assert.equal($.templates('{{:a["x - _*!"]}}').render({a: {"x - _*!": "aName"}}), "aName", 'a["x - _*!"]'); + assert.equal($.templates("{{:a.b[1].d}}").render({a: {b: [0, {d: "dVal"}]}}), "dVal", "a.b[1].d"); + assert.equal($.templates("{{:a.b[1].d}}").render({a: {b: {1:{d: "dVal"}}}}), "dVal", "a.b[1].d"); + assert.equal($.templates("{{:a.b[~incr(1-1)].d}}").render({a: {b: {1:{d: "dVal"}}}}, {incr:function(val) {return val + 1;}}), "dVal", "a.b[~incr(1-1)].d"); + assert.equal($.templates("{{:a.b.c.d}}").render({a: {b: {c:{d: "dVal"}}}}), "dVal", "a.b.c.d"); + assert.equal($.templates("{{:a[0]}}").render({a: [ "bVal" ]}), "bVal", "a[0]"); + assert.equal($.templates("{{:a.b[1][0].msg}}").render({a: {b: [22,[{msg: " yes - that's right. "}]]}}), " yes - that's right. ", "a.b[1][0].msg"); + assert.equal($.templates("{{:#data.a}}").render({a: "aVal"}), "aVal", "#data.a"); + assert.equal($.templates("{{:#view.data.a}}").render({a: "aVal"}), "aVal", "#view.data.a"); + assert.equal($.templates("{{:#index === 0}}").render([{a: "aVal"}]), "true", "#index"); +}); + +QUnit.test("types", function(assert) { + assert.equal($.templates("{{:'abc'}}").render(), "abc", "'abc'"); + assert.equal($.templates('{{:"abc"}}').render(), "abc", '"abc"'); + assert.equal($.templates("{{:true}}").render(), "true", "true"); + assert.equal($.templates("{{:false}}").render(), "false", "false"); + assert.equal($.templates("{{:null}}").render(), "", 'null -> ""'); + assert.equal($.templates("{{:199}}").render(), "199", "199"); + assert.equal($.templates("{{: 199.9}}").render(), "199.9", "| 199.9 |"); + assert.equal($.templates("{{:-33.33}}").render(), "-33.33", "-33.33"); + assert.equal($.templates("{{: -33.33}}").render(), "-33.33", "| -33.33 |"); + assert.equal($.templates("{{:-33.33 - 2.2}}").render(), "-35.53", "-33.33 - 2.2"); + assert.equal($.templates("{{:notdefined}}").render({}), "", "notdefined"); + assert.equal($.templates("{{:}}").render("aString"), "aString", "{{:}} returns current data item"); + assert.equal($.templates("{{:x=22}}").render("aString"), "aString", "{{:x=...}} returns current data item"); + assert.equal($.templates("{{html:x=22}}").render("aString"), "aString", "{{html:x=...}} returns current data item"); + assert.equal($.templates("{{>x=22}}").render("aString"), "aString", "{{>x=...}} returns current data item"); + assert.equal($.templates("{{:'abc('}}").render(), "abc(", "'abc(': final paren in string is rendered correctly"); // https://github.com/BorisMoore/jsviews/issues/300 + assert.equal($.templates('{{:"abc("}}').render(), "abc(", '"abc(": final paren in string is rendered correctly'); + assert.equal($.templates("{{:(('(abc('))}}").render(), "(abc(", "(('(abc('))"); + assert.equal($.templates('{{:((")abc)"))}}').render(), ")abc)", '((")abc)"))'); +}); + +QUnit.test("Fallbacks for missing or undefined paths:\nusing {{:some.path onError = 'fallback'}}, etc.", function(assert) { + var message; + try { + $.templates("{{:a.missing.willThrow.path}}").render({a:1}); + } catch(e) { + message = e.message; + } + assert.ok(!!message, + "{{:a.missing.willThrow.path}} throws: " + message); + + assert.equal($.templates("{{:a.missing.willThrow.path onError='Missing Object'}}").render({a:1}), "Missing Object", + '{{:a.missing.willThrow.path onError="Missing Object"}} renders "Missing Object"'); + assert.equal($.templates('{{:a.missing.willThrow.path onError=""}}').render({a:1}), "", + '{{:a.missing.willThrow.path onError=""}} renders ""'); + assert.equal($.templates("{{:a.missing.willThrow.path onError=null}}").render({a:1}), "", + '{{:a.missing.willThrow.path onError=null}} renders ""'); + assert.equal($.templates("{{>a.missing.willThrow.path onError='Missing Object'}}").render({a:1}), "Missing Object", + '{{>a.missing.willThrow.path onError="Missing Object"}} renders "Missing Object"'); + assert.equal($.templates('{{>a.missing.willThrow.path onError=""}}').render({a:1}), "", + '{{>a.missing.willThrow.path onError=""}} renders ""'); + assert.equal($.templates("{{>a.missing.willThrow.path onError=defaultVal}}").render( + { + a:1, + defaultVal: "defaultFromData" + }), "defaultFromData", + '{{>a.missing.willThrow.path onError=defaultVal}} renders "defaultFromData"'); + + assert.equal($.templates("{{>a.missing.willThrow.path onError=~myOnErrorFunction}}").render({a:1}, { + myOnErrorFunction: function(e, view) { + return "Override onError using a callback: " + view.ctx.helperValue + e.message; + }, + helperValue: "hlp" + }).slice(0, 38), "Override onError using a callback: hlp", + '{{>a.missing.willThrow.path onError=~myOnErrorFunction}}" >' + + '\nProviding a function "onError=~myOnErrorFunction" calls the function as onError callback'); + + assert.equal($.templates("{{>a.missing.willThrow.path onError=myOnErrorDataMethod}}").render( + { + a: "dataValue", + myOnErrorDataMethod: function(e) { + var data = this; + return "Override onError using a callback data method: " + data.a; + } + }), "Override onError using a callback data method: dataValue", + '{{>a.missing.willThrow.path onError=myOnErrorDataMethod}}" >' + + '\nProviding a function "onError=myOnErrorDataMethod" calls the function as onError callback'); + + assert.equal($.templates("1: {{>a.missing.willThrow.path onError=defaultVal}}" + + " 2: {{:a.missing.willThrow.path onError='Missing Object'}}" + + " 3: {{:a.missing.willThrow.path onError=''}}" + + " 4: {{:a.missing.willThrow.path onError=null}}" + + " 5: {{:a onError='missing'}}" + + " 6: {{:a.undefined onError='missing'}}" + + " 7: {{:a.missing.willThrow onError=myCb}} end").render( + { + a:"aVal", + defaultVal: "defaultFromData", + myCb: function(e, view) { + return "myCallback: " + this.a; + } + }), "1: defaultFromData 2: Missing Object 3: 4: 5: aVal 6: 7: myCallback: aVal end", + 'multiple onError fallbacks in same template - correctly concatenated into output'); + + assert.equal($.templates({ + markup: "{{withfallback:a.notdefined fallback='fallback for undefined'}}", + converters: { + withfallback: function(val) { + return val || this.tagCtx.props.fallback; + } + } + }).render({a:"yes"}), "fallback for undefined", + '{{withfallback:a.notdefined fallback="fallback for undefined"}}' + + '\nusing converter to get fallback value for undefined properties'); + + assert.equal($.templates({ + markup: "1: {{withfallback:a.missing.y onError='Missing object' fallback='undefined prop'}}" + + " 2: {{withfallback:a.undefined onError='Missing object' fallback='undefined prop'}}", + converters: { + withfallback: function(val) { + return val || this.tagCtx.props.fallback; + } + } + }).render({a:"yes"}), "1: Missing object 2: undefined prop", + 'both fallback for undefined and onError for missing on same tags'); + + assert.equal($.templates({ + markup: "1: {{>a.missing.willThrow.path onError=defaultVal}}" + + " 2: {{:a.missing.willThrow.path onError='Missing Object'}}" + + " 3: {{:a.missing.willThrow.path onError=''}}" + + " 4: {{:a onError='missing'}}" + + " 5: {{:a.undefined onError='missing'}}" + + " 6: {{:a.missing.willThrow onError=myCb}}" + + " 7: {{withfallback:a.undefined fallback='undefined prop'}} end", + converters: { + withfallback: function(val) { + return val || this.tagCtx.props.fallback; + } + } + }).render( + { + a:"aVal", + defaultVal: "defaultFromData", + myCb: function(e, view) { + return "myCallback: " + this.a; + } + }), "1: defaultFromData 2: Missing Object 3: 4: aVal 5: 6: myCallback: aVal 7: undefined prop end", + 'multiple onError fallbacks or undefined property fallbacks in same template - correctly concatenated into output'); + + try { + message = ""; + $.templates({ + markup: "1: {{>a.missing.willThrow.path onError=defaultVal}}" + + " 2: {{:a.missing.willThrow.path onError='Missing Object'}}" + + " 3: {{:a.missing.willThrow.path onError=''}}" + + " 4: {{:a onError='missing'}}" + + " 5: {{:a.missing.willThrow.foo}}" + + " 6: {{:a.undefined onError='missing'}}" + + " 7: {{:a.missing.willThrow onError=myCb}}" + + " 8: {{withfallback:a.undefined fallback='undefined prop'}} end", + converters: { + withfallback: function(val) { + return val || this.tagCtx.props.fallback; + } + } + }).render({ + a:"aVal", + defaultVal: "defaultFromData", + myCb: function(e, view) { + return "myCallback: " + this.a; + } + }); + } catch(e) { + message = e.message; + } + + assert.ok(!!message, + 'onError/fallback converter and regular thrown error message in same template: throws:\n"' + message + '"'); + + assert.equal($.templates("{{for missing.willThrow.path onError='Missing Object'}}yes{{/for}}").render({a:1}), "Missing Object", + '{{for missing.willThrow.path onError="Missing Object"}} -> "Missing Object"'); + + assert.equal($.templates("{{for true missing.willThrow.path onError='Missing Object'}}yes{{/for}}").render({a:1}), "Missing Object", + '{{for true missing.willThrow.path onError="Missing Object"}} -> "Missing Object"'); + + assert.equal($.templates("{{for true foo=missing.willThrow.path onError='Missing Object'}}yes{{/for}}").render({a:1}), "Missing Object", + '{{for ... foo=missing.willThrow.path onError="Missing Object"}} -> "Missing Object"'); + + assert.equal($.templates("{{for true ~foo=missing.willThrow.path onError='Missing Object'}}yes{{/for}}").render({a:1}), "Missing Object", + '{{for ... ~foo=missing.willThrow.path onError="Missing Object"}} -> "Missing Object"'); + + assert.equal($.templates({ + markup: "{{mytag foo='a'/}} {{mytag foo=missing.willThrow.path onError='Missing Object'/}} {{mytag foo='c' bar=missing.willThrow.path onError='Missing Object'/}} {{mytag foo='c' missing.willThrow.path onError='Missing Object'/}} {{mytag foo='b'/}}", + tags: { + mytag: {template: "MyTag: {{:~tagCtx.props.foo}} end"} + } + }).render({a:1}), "MyTag: a end Missing Object Missing Object Missing Object MyTag: b end", + 'onError=... for custom tags: e.g. {{mytag foo=missing.willThrow.path onError="Missing Object"/}}'); + + assert.equal($.templates({ + markup: "1: {{for a.missing.willThrow.path onError=defaultVal}}yes{{/for}}" + + " 2: {{if a.missing.willThrow.path onError='Missing Object'}}yes{{/if}}" + + " 3: {{include a.missing.willThrow.path onError=''/}}" + + " 4: {{if a onError='missing'}}yes{{/if}}" + + " 5: {{for a.undefined onError='missing'}}yes{{/for}}" + + " 6: {{if a.missing.willThrow onError=myCb}}yes{{/if}}" + + " 7: {{withfallback:a.undefined fallback='undefined prop'}} end" + + " 8: {{mytag foo=missing.willThrow.path onError='Missing Object'/}}", + converters: { + withfallback: function(val) { + return val || this.tagCtx.props.fallback; + } + }, + tags: { + mytag: {template: "MyTag: {{:~tagCtx.props.foo}} end"} + } + }).render( + { + a:"aVal", + defaultVal: "defaultFromData", + myCb: function(e, view) { + return "myCallback: " + this.a; + } + }), "1: defaultFromData 2: Missing Object 3: 4: yes 5: 6: myCallback: aVal 7: undefined prop end 8: Missing Object", + 'multiple onError fallbacks or undefined property fallbacks in same template - correctly concatenated into output'); + + try { + message = ""; + $.templates({ + markup: "1: {{for a.missing.willThrow.path onError=defaultVal}}yes{{/for}}" + + " 2: {{if a.missing.willThrow.path onError='Missing Object'}}yes{{/if}}" + + " 3: {{include a.missing.willThrow.path onError=''/}}" + + " 4: {{if a onError='missing'}}yes{{/if}}" + + " 5: {{for missing.willThrow.foo}}yes{{/for}}" + + " 6: {{for a.undefined onError='missing'}}yes{{/for}}" + + " 7: {{if a.missing.willThrow onError=myCb}}yes{{/if}}" + + " 8: {{withfallback:a.undefined fallback='undefined prop'}} end", + converters: { + withfallback: function(val) { + return val || this.tagCtx.props.fallback; + } + } + }).render({ + a:"aVal", + defaultVal: "defaultFromData", + myCb: function(e, view) { + return "myCallback: " + this.a; + } + }); + } catch(e) { + message = e.message; + } + + assert.ok(!!message, + 'onError/fallback converter and regular thrown error message in same template: throws: \n"' + message + '"'); + + $.views.settings.debugMode(true); + assert.equal($.templates({ + markup: "1: {{for a.missing.willThrow.path onError=defaultVal}}yes{{/for}}" + + " 2: {{if a.missing.willThrow.path onError='Missing Object'}}yes{{/if}}" + + " 3: {{include a.missing.willThrow.path onError=''/}}" + + " 4: {{if a onError='missing'}}yes{{/if}}" + + " 5: {{for missing.willThrow.foo}}yes{{/for}}" + + " 6: {{for a.undefined onError='missing'}}yes{{/for}}" + + " 7: {{if a.missing.willThrow onError=myCb}}yes{{/if}}" + + " 8: {{withfallback:a.undefined fallback='undefined prop'}} end", + converters: { + withfallback: function(val) { + return val || this.tagCtx.props.fallback; + } + } + }).render( + { + a:"aVal", + defaultVal: "defaultFromData", + myCb: function(e, view) { + return "myCallback: " + this.a; + } + }).slice(0, 21), "1: defaultFromData 2:", + 'In debug mode, onError/fallback converter and regular thrown error message in same template:' + + '\override errors and regular thrown error each render for the corrresponding tag'); + $.views.settings.debugMode(false); + +}); + +QUnit.test("comparisons", function(assert) { + assert.equal($.templates("{{:1<2}}").render(), "true", "1<2"); + assert.equal($.templates("{{:2<1}}").render(), "false", "2<1"); + assert.equal($.templates("{{:5===5}}").render(), "true", "5===5"); + assert.equal($.templates("{{:0==''}}").render(), "true", "0==''"); + assert.equal($.templates("{{:'ab'=='ab'}}").render(), "true", "'ab'=='ab'"); + assert.equal($.templates("{{:2>1}}").render(), "true", "2>1"); + assert.equal($.templates("{{:2 == 2}}").render(), "true", "2 == 2"); + assert.equal($.templates("{{:2<=2}}").render(), "true", "2<=2"); + assert.equal($.templates("{{:'ab'<'ac'}}").render(), "true", "'ab'<'ac'"); + assert.equal($.templates("{{:3>=3}}").render(), "true", "3 =3"); + assert.equal($.templates("{{:3>=2}}").render(), "true", "3>=2"); + assert.equal($.templates("{{:3>=4}}").render(), "false", "3>=4"); + assert.equal($.templates("{{:3 !== 2}}").render(), "true", "3 !== 2"); + assert.equal($.templates("{{:3 != 2}}").render(), "true", "3 != 2"); + assert.equal($.templates("{{:0 !== null}}").render(), "true", "0 !== null"); + assert.equal($.templates("{{:(3 >= 4)}}").render(), "false", "3>=4"); + assert.equal($.templates("{{:3 >= 4}}").render(), "false", "3>=4"); + assert.equal($.templates("{{:(3>=4)}}").render(), "false", "3>=4"); + assert.equal($.templates("{{:(3 < 4)}}").render(), "true", "3>=4"); + assert.equal($.templates("{{:3 < 4}}").render(), "true", "3>=4"); + assert.equal($.templates("{{:(3<4)}}").render(), "true", "3>=4"); + assert.equal($.templates("{{:0 != null}}").render(), "true", "0 != null"); +}); + +QUnit.test("array access", function(assert) { + assert.equal($.templates("{{:a[1]}}").render({a: ["a0","a1"]}), "a1", "a[1]"); + assert.equal($.templates("{{:a[1+1]+5}}").render({a: [11,22,33]}), "38", "a[1+1]+5)"); + assert.equal($.templates("{{:a[~incr(1)]+5}}").render({a: [11,22,33]}, {incr:function(val) {return val + 1;}}), "38", "a[~incr(1)]+5"); + assert.equal($.templates("{{:true && (a[0] || 'default')}}").render({a: [0,22,33]}, {incr:function(val) {return val + 1;}}), "default", "true && (a[0] || 'default')"); +}); + +QUnit.test("context", function(assert) { + assert.equal($.templates("{{:~val}}").render(1, {val: "myvalue"}), "myvalue", "~val"); + function format(value, upper) { + return value[upper ? "toUpperCase" : "toLowerCase"](); + } + assert.equal($.templates("{{:~format(name) + ~format(name, true)}}").render(person, {format: format}), "joJO", + "render(data, {format: formatFn}); ... {{:~format(name, true)}}"); + assert.equal($.templates("{{for people[0]}}{{:~format(~type) + ~format(name, true)}}{{/for}}").render({people: people}, {format: format, type: "PascalCase"}), "pascalcaseJO", + "render(data, {format: formatFn}); ... {{:~format(name, true)}}"); + assert.equal($.templates("{{for people ~twn=town}}{{:name}} lives in {{:~format(~twn, true)}}. {{/for}}").render({people: people, town:"Redmond"}, {format: format}), + "Jo lives in REDMOND. Bill lives in REDMOND. ", + "Passing in context to nested templates: {{for people ~twn=town}}"); + assert.equal($.templates("{{if true}}{{for people}}{{:~root.people[0].name}}{{/for}}{{/if}}").render({people: people}), "JoJo", + "{{:~root}} returns the top-level data"); +}); + +QUnit.test("values", function(assert) { + assert.equal($.templates("{{:a}}").render({a: 0}), "0", '{{:0}} returns "0"'); + assert.equal($.templates("{{:a}}").render({}), "", "{{:undefined}} returns empty string"); + assert.equal($.templates("{{:a}}").render({a: ""}), "", "{{:''}} returns empty string"); + assert.equal($.templates("{{:a}}").render({a: null}), "", "{{:null}} returns empty string"); +}); + +QUnit.test("expressions", function(assert) { + assert.equal(compileTmpl("{{:a++}}"), "Syntax error\na++", "a++"); + assert.equal(compileTmpl("{{:(a,b)}}"), "Syntax error\n(a,b)", "(a,b)"); + assert.equal($.templates("{{: a+2}}").render({a: 2, b: false}), "4", "a+2"); + assert.equal($.templates("{{: b?'yes':'no'}}").render({a: 2, b: false}), "no", "b?'yes':'no'"); + assert.equal($.templates("{{:(a||-1) + (b||-1)}}").render({a: 2, b: 0}), "1", "a||-1"); + assert.equal($.templates("{{:3*b()*!a*4/3}}").render({a: false, b: function() {return 3;}}), "12", "3*b()*!a*4/3"); + assert.equal($.templates("{{:a%b}}").render({a: 30, b: 16}), "14", "a%b"); + assert.equal($.templates("A_{{if v1 && v2 && v3 && v4}}no{{else !v1 && v2 || v3 && v4}}yes{{/if}}_B").render({v1:true,v2:false,v3:2,v4:"foo"}), "A_yes_B", "x && y || z"); + assert.equal($.templates("{{:!true}}").render({}), "false", "!true"); + assert.equal($.templates("{{if !true}}yes{{else}}no{{/if}}").render({}), "no", "{{if !true}}..."); + assert.equal($.templates("{{:!false}}").render({}), "true", "!false"); + assert.equal($.templates("{{if !false}}yes{{else}}no{{/if}}").render({}), "yes", "{{if !false}}..."); + assert.equal($.templates("{{:!!true}}").render({}), "true", "!!true"); + assert.equal($.templates("{{if !!true}}yes{{else}}no{{/if}}").render({}), "yes", "{{if !!true}}..."); + assert.equal($.templates("{{:!(true)}}").render({}), "false", "!(true)"); + assert.equal($.templates("{{:!true === false}}").render({}), "true", "!true === false"); + assert.equal($.templates("{{:false === !true}}").render({}), "true", "false === !true"); + assert.equal($.templates("{{:false === !null}}").render({}), "false", "false === !null"); +}); + +QUnit.module("{{for}}"); +QUnit.test("{{for}}", function(assert) { + $.templates({ + forTmpl: "header_{{for people}}{{:name}}{{/for}}_footer", + templateForArray: "header_{{for #data}}{{:name}}{{/for}}_footer", + pageTmpl: '{{for [people] tmpl="templateForArray"/}}', + simpleFor: "a{{for people}}Content{{:#data}}|{{/for}}b", + forPrimitiveDataTypes: "a{{for people}}|{{:#data}}{{/for}}b", + testTmpl: "xxx{{:name}} {{:~foo}}" + }); + + assert.equal($.render.forTmpl({people: people}), "header_JoBill_footer", '{{for people}}...{{/for}}'); + assert.equal($.render.templateForArray([people]), "header_JoBill_footer", 'Can render a template against an array, as a "layout template", by wrapping array in an array'); + assert.equal($.render.pageTmpl({people: people}), "header_JoBill_footer", '{{for [people] tmpl="templateForArray"/}}'); + assert.equal($.templates("{{for}}xxx{{:name}} {{:~foo}}{{/for}}").render({name: "Jeff"}, {foo:"fooVal"}), "xxxJeff fooVal", "no parameter - renders once with parent #data context: {{for}}"); + assert.equal($.templates("{{for tmpl='testTmpl'/}}").render({name: "Jeff"}, {foo:"fooVal"}), "xxxJeff fooVal", ": {{for tmpl=.../}} no parameter - equivalent to {{include tmpl=.../}} - renders once with parent #data context"); + assert.equal($.templates("{{include tmpl='testTmpl'/}}").render({name: "Jeff"}, {foo:"fooVal"}), "xxxJeff fooVal", "{{include tmpl=.../}} with tmpl parameter - renders once with parent #data context. Equivalent to {{for tmpl=.../}}"); + assert.equal($.templates("{{for missingProperty}}xxx{{:#data===~undefined}}{{/for}}").render({}), "", "missingProperty - renders empty string"); + assert.equal($.templates("{{for null}}xxx{{:#data===null}}{{/for}}").render(), "xxxtrue", "null - renders once with #data null: {{for null}}"); + assert.equal($.templates("{{for false}}xxx{{:#data}}{{/for}}").render(), "xxxfalse", "false - renders once with #data false: {{for false}}"); + assert.equal($.templates("{{for 0}}xxx{{:#data}}{{/for}}").render(), "xxx0", "0 - renders once with #data false: {{for 0}}"); + assert.equal($.templates("{{for ''}}xxx{{:#data===''}}{{/for}}").render(), "xxxtrue", "'' - renders once with #data false: {{for ''}}"); + assert.equal($.templates("{{for #data}}{{:name}}{{/for}}").render(people), "JoBill", "If #data is an array, {{for #data}} iterates"); + + assert.equal($.render.simpleFor({people:[]}), "ab", 'Empty array renders empty string'); + assert.equal($.render.simpleFor({people:["", false, null, undefined, 1]}), "aContent|Contentfalse|Content|Content|Content1|b", 'Empty string, false, null or undefined members of array are also rendered'); + assert.equal($.render.simpleFor({people:null}), "aContent|b", 'null is rendered once with #data null'); + assert.equal($.render.simpleFor({}), "ab", 'if #data is undefined, renders empty string'); + assert.equal($.render.forPrimitiveDataTypes({people:[0, 1, "abc", "", ,null ,true ,false]}), "a|0|1|abc||||true|falseb", 'Primitive types render correctly, even if falsey'); +}); +QUnit.test("{{for start end sort filter reverse}}", function(assert) { + // =============================== Arrange =============================== + function level(aField, bField) { + return aField > bField ? 1 : aField < bField ? -1 : 0; + } + + var oddValue = function(item, index, items) { return item%2; }; + var oddIndex = function(item, index, items) { return index%2; }; + var sortAgeName = function(a, b) { + return level(a.details.role.toLowerCase(), b.details.role.toLowerCase()) // First level sort: by role + || (this.props.reverseAge ? level(b.details.age, a.details.age) : level(a.details.age, b.details.age)) // 2nd level sort: sort by age, or reverse sort by age + || level(a.name.toLowerCase(), b.name.toLowerCase()); // 3rd level sort: sort by name + }; + var underLimit = function(item, index, items) { + return item.details.age < this.props.limit; + }; + + // ................................ Assert .................................. + + assert.equal($.templates("{{for start=0 end=10}}{{:}} {{/for}}").render(), "0 1 2 3 4 5 6 7 8 9 ", "{{for start=0 end=10}}: Auto-create array"); + assert.equal($.templates("{{for start=5 end=9 reverse=1}}{{:}} {{/for}}").render(), "8 7 6 5 ", "{{for start=5 end=9 reverse=1}}: Auto-create array"); + assert.equal($.templates("{{for start=8 end=4 step=-1}}{{:}} {{/for}}").render(), "8 7 6 5 ", "{{for start=8 end=4 step=-1}}: Auto-create array"); + assert.equal($.templates("{{for start=8 end=4 step=-1 reverse=true}}{{:}} {{/for}}").render(), "5 6 7 8 ", "{{for start=8 end=4 step=-1 reverse=true}}: Auto-create array, with reverse"); + assert.equal($.templates("{{for start=20 end='10' step=-2}}{{:}} {{/for}}").render(), "20 18 16 14 12 ", "{{for start=20 end='10' step=-2}}: Auto-create array"); + assert.equal($.templates("{{for start=20 end='10' step=2}}{{:}} {{/for}}").render(), "", "{{for start=20 end='10' step=2}}: Auto-create array (outputs nothing)"); + assert.equal($.templates("{{for start=2 end=-1.5 step=-.5}}{{:}} {{/for}}").render(), "2 1.5 1 0.5 0 -0.5 -1 ", "{{for start=0 end='10' step=-1}}: Auto-create array"); + assert.equal($.templates("{{for start=2}}{{:}} {{/for}}").render(), "", "{{for start=2}}: (outputs nothing)"); + assert.equal($.templates("{{for end=4}}{{:}} {{/for}}").render(), "0 1 2 3 ", "{{for end=4}}: (start defaults to 0)"); + assert.equal($.templates("{{for start=8 end=4 step=-1 reverse=true sort=true filter=~oddIndex}}{{:}} {{/for}}").render({}, {oddIndex: oddIndex}), "5 6 7 8 ", "{{for start=8 end=4 step=-1 reverse=true sort=true}}: Auto-create array, sort and filter not supported with auto-create arrays - do nothing"); + + // =============================== Arrange =============================== + + var myarray = [1, 9, 2, 8, 3, 7, 4, 6, 5]; + + assert.equal($.templates("{{for #data }}{{:}} {{/for}}").render(myarray, true), "1 9 2 8 3 7 4 6 5 ", "{{for #data}}"); + assert.equal($.templates("{{for #data sort=true}}{{:}} {{/for}}").render(myarray, true), "1 2 3 4 5 6 7 8 9 ", "{{for #data sort=true}}"); + assert.equal($.templates("{{for myarray reverse=true}}{{:}} {{/for}}").render({myarray: myarray}), "5 6 4 7 3 8 2 9 1 ", "{{for myarray reverse=true}}"); + assert.equal($.templates("{{for myarray start=1 end=-1}}{{:}} {{/for}}").render({myarray: myarray}), "9 2 8 3 7 4 6 ", "{{for myarray start=1 end=-1}}"); + assert.equal($.templates("{{for myarray start=1}}{{:}} {{/for}}").render({myarray: myarray}), "9 2 8 3 7 4 6 5 ", "{{for myarray start=1}}"); + assert.equal($.templates("{{for myarray end=-1}}{{:}} {{/for}}").render({myarray: myarray}), "1 9 2 8 3 7 4 6 ", "{{for myarray end=-1}}"); + assert.equal($.templates("{{for myarray sort=true}}{{:}} {{/for}}").render({myarray: myarray}), "1 2 3 4 5 6 7 8 9 ", "{{for myarray sort=true}}"); + assert.equal($.templates("{{for myarray sort=true reverse=true}}{{:}} {{/for}}").render({myarray: myarray}), "9 8 7 6 5 4 3 2 1 ", "{{for myarray sort=true reverse=true}}"); + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{for myarray filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 9 3 7 5 ", "{{for myarray filter=~oddValue}}"); + assert.equal($.templates("{{for myarray filter=~oddIndex}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 8 7 6 ", "{{for myarray filter=~oddIndex}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 3 5 7 9 ", "{{for myarray sort=true filter=~oddValue}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "2 4 6 8 ", "{{for myarray sort=true filter=~oddIndex}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=1 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "4 6 ", "{{for myarray sort=true filter=~oddIndex start=1 end=3}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=-3 end=-1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "4 6 ", "{{for myarray sort=true filter=~oddIndex start=-3 end=-1}} Negative start or end count from the end"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=3 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "", "{{for myarray sort=true filter=~oddIndex start=3 end=3}} (outputs nothing)"); +} + assert.equal($.templates("{{for myarray step=2 start=1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 8 7 6 ", "{{for myarray step=2 start=1}}"); + assert.equal($.templates("{{for myarray sort=true step=2 start=1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "2 4 6 8 ", "{{for myarray sort=true step=2 start=1}}"); + assert.equal($.templates("{{for myarray sort=true step=2 start=3 end=6}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "4 6 ", "{{for myarray sort=true step=2 start=3 end=6}}"); + assert.equal($.templates("{{for myarray sort=true step=2 start=-6 end=-3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "4 6 ", "{{for myarray sort=true step=2 start=-6 end=-3}} Negative start or end count from the end"); + assert.equal($.templates("{{for myarray sort=true step=2 start=3 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "", "{{for myarray sort=true step=2 start=3 end=3}} (outputs nothing)"); + assert.equal($.templates("{{for myarray step=3.5}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "1 8 4 ", "{{for myarray step=3.5}} - equivalent to step=3"); + assert.equal($.templates("{{for myarray step=-2}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "1 9 2 8 3 7 4 6 5 ", "{{for myarray step=-2}} equivalent to no step"); + assert.equal($.templates("{{for myarray step=1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "1 9 2 8 3 7 4 6 5 ", "{{for myarray step=1}} equivalent to no step"); + // =============================== Arrange =============================== + + var mypeople = [ + {name: "Jo", details: {age: 22}}, + {name: "Bob", details: {age: 2}}, + {name: "Emma", details: {age: 12}}, + {name: "Jeff", details: {age: 13.5}}, + {name: "Julia", details: {age: 0.6}}, + {name: "Xavier", details: {age: 0}} + ]; + + // ................................ Assert .................................. + + assert.equal($.templates("{{for mypeople sort='name'}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}), "Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - Julia: age 0.6 - Xavier: age 0 - ", + "{{for mypeople sort='name'}}"); + assert.equal($.templates("{{for mypeople sort='details.age'}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}), "Xavier: age 0 - Julia: age 0.6 - Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - ", + "{{for mypeople sort='details.age'}}"); + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~underLimit limit=20}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Jeff: age 13.5 - Emma: age 12 - Bob: age 2 - Julia: age 0.6 - Xavier: age 0 - ", + "{{for mypeople sort='details.age' reverse=true filter=~underLimit...}}"); + assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", + "{{for mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); + assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", + "{{for mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); +} + // =============================== Arrange =============================== + + var mypeople2 = [ + {name: "Bill", details: {age: 22, role: "Lead"}}, + {name: "Anne", details: {age: 32, role: "Assistant"}}, + {name: "Emma", details: {age: 19.1, role: "Team member"}}, + {name: "Jeff", details: {age: 33.5, role: "Lead"}}, + {name: "Xavier", details: {age: 32, role: "Team member"}}, + {name: "Julia", details: {age: 18, role: "Assistant"}}, + {name: "Bill", details: {age: 32, role: "Team member"}} + ]; + + // ................................ Assert .................................. + + assert.equal($.templates("{{for mypeople sort=~sortAgeName}}{{:name}}: ({{:details.role}}) age {{:details.age}} -{{/for}}").render({mypeople: mypeople2}, {sortAgeName: sortAgeName}), + "Julia: (Assistant) age 18 -Anne: (Assistant) age 32 -Bill: (Lead) age 22 -Jeff: (Lead) age 33.5 -Emma: (Team member) age 19.1 -Bill: (Team member) age 32 -Xavier: (Team member) age 32 -", + "{{for mypeople sort=~sortAgeName}}: custom sort function"); + + // ................................ Assert .................................. + + assert.equal($.templates("{{for mypeople sort=~sortAgeName reverseAge=true}}{{:name}}: ({{:details.role}}) age {{:details.age}} -{{/for}}").render({mypeople: mypeople2}, {sortAgeName: sortAgeName}), + "Anne: (Assistant) age 32 -Julia: (Assistant) age 18 -Jeff: (Lead) age 33.5 -Bill: (Lead) age 22 -Bill: (Team member) age 32 -Xavier: (Team member) age 32 -Emma: (Team member) age 19.1 -", + "{{for mypeople sort=~sortAgeName}}: custom sort function - this pointer is tagCtx"); + + // ................................ Assert .................................. + + assert.equal($.templates("{{for start=0 end=0}}{{else mypeople sort=~sortAgeName reverseAge=true}}{{:name}}: ({{:details.role}}) age {{:details.age}} -{{/for}}").render({mypeople: mypeople2}, {sortAgeName: sortAgeName}), + "Anne: (Assistant) age 32 -Julia: (Assistant) age 18 -Jeff: (Lead) age 33.5 -Bill: (Lead) age 22 -Bill: (Team member) age 32 -Xavier: (Team member) age 32 -Emma: (Team member) age 19.1 -", + "{{for start=0 end=0}}{{else mypeople sort=~sortAgeName}}: custom sort function - this pointer is tagCtx (else block)"); + + // =============================== Arrange =============================== + + $.views.tags("for2", { + baseTag: "for" + }); + + // ................................ Assert .................................. + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{for2 mypeople sort='details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for2}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", + "{{for2 mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}} Derived tag"); +} +}); + +QUnit.module("{{props}}"); +QUnit.test("{{props}}", function(assert) { + $.templates({ + propsTmpl: "header_{{props person}}Key: {{:key}} - Prop: {{:prop}}| {{/props}}_footer", + propsTmplObjectArray: "header_{{props people}}Key: {{:key}} - Prop: {{for prop}}{{:name}} {{/for}}{{/props}}_footer", + propsTmplPrimitivesArray: "header_{{props people}}Key: {{:key}} - Prop: {{for prop}}{{:name}} {{/for}}{{/props}}_footer", + templatePropsArray: "header_{{props #data}}Key: {{:key}} - Prop: {{for prop}}{{:name}} {{/for}}{{/props}}_footer", + propTmpl: "Key: {{:key}} - Prop: {{:prop}}", + pageTmpl: '{{props person tmpl="propTmpl"/}}', + simpleProps: "a{{props people}}Content{{:#data}}|{{/props}}b", + propsPrimitiveDataTypes: "a{{props people}}|{{:#data}}{{/props}}b", + testTmpl: "xxx{{:name}} {{:~foo}}" + }); + + assert.equal($.render.propsTmpl({person: people[0]}), "header_Key: name - Prop: Jo| _footer", '{{props person}}...{{/props}} for an object iterates over properties'); + assert.equal($.render.propsTmplObjectArray({people: people}), "header_Key: 0 - Prop: Jo Key: 1 - Prop: Bill _footer", '{{props people}}...{{/props}} for an array iterates over the array - with index as key and object a prop'); + assert.equal($.render.templatePropsArray([people]), "header_Key: 0 - Prop: Jo Key: 1 - Prop: Bill _footer", 'Can render a template against an array, as a "layout template", by wrapping array in an array'); + assert.equal($.render.pageTmpl({person: people[0]}), "Key: name - Prop: Jo", '{{props person tmpl="propTmpl"/}}'); + assert.equal($.templates("{{props}}{{:key}} {{:prop}}{{/props}}").render({name: "Jeff"}), "name Jeff", "no parameter - defaults to current data item"); + assert.equal($.templates("{{props foo}}xxx{{:key}} {{:prop}} {{:~foo}}{{/props}}").render({name: "Jeff"}), "", "undefined arg - renders nothing"); + assert.equal($.templates("{{props tmpl='propTmpl'/}}").render({name: "Jeff"}), "Key: name - Prop: Jeff", ": {{props tmpl=.../}} no parameter - defaults to current data item"); + + assert.equal($.templates("{{props null}}Key: {{:key}} - Prop: {{:prop}}| {{/props}}").render(), "", "null - renders nothing"); + assert.equal($.templates("{{props false}}Key: {{:key}} - Prop: {{:prop}}| {{/props}}").render(), "", "false - renders nothing"); + assert.equal($.templates("{{props 0}}Key: {{:key}} - Prop: {{:prop}}| {{/props}}").render(), "", "0 - renders nothing"); + assert.equal($.templates("{{props 'abc'}}Key: {{:key}} - Prop: {{:prop}}| {{/props}}").render(), "", "'abc' - renders nothing"); + assert.equal($.templates("{{props ''}}Key: {{:key}} - Prop: {{:prop}}| {{/props}}").render(), "", "'' - renders nothing"); + assert.equal($.templates("{{props #data}}Key: {{:key}} - Prop: {{:prop}}| {{/props}}").render(people), + "Key: name - Prop: Jo| Key: name - Prop: Bill| ", + "If #data is an array, {{props #data}} iterates"); + + assert.equal($.render.propsTmpl({person:{}}), "header__footer", 'Empty object renders empty string'); + assert.equal($.render.propsTmpl({person:{zero: 0, one: 1, str: "abc", emptyStr: "", nullVal: null , trueVal: true , falseVal: false}}), + "header_Key: zero - Prop: 0| Key: one - Prop: 1| Key: str - Prop: abc| Key: emptyStr - Prop: | Key: nullVal - Prop: | Key: trueVal - Prop: true| Key: falseVal - Prop: false| _footer", + 'Primitive types render correctly, even if falsey'); +}); + +QUnit.test("{{props start end sort filter reverse}}", function(assert) { + // =============================== Arrange =============================== + function level(aField, bField) { + return aField > bField ? 1 : aField < bField ? -1 : 0; + } + + var oddValue = function(item, index, items) { return item.prop%2; }; + var oddIndex = function(item, index, items) { return index%2; }; + var sortAgeName = function(a, b) { + return level(a.prop.details.role.toLowerCase(), b.prop.details.role.toLowerCase()) // First level sort: by role + || (this.props.reverseAge ? level(b.prop.details.age, a.prop.details.age) : level(a.prop.details.age, b.prop.details.age)) // 2nd level sort: sort by age, or reverse sort by age + || level(a.prop.name.toLowerCase(), b.prop.name.toLowerCase()); // 3rd level sort: sort by name + }; + + var underLimit = function(item, index, items) { + return item.prop.details.age < this.props.limit; + }; + + var myobject = {a: 1, b: 9, c: 2, d:8, A:3, B:7, C:4, D:6, e:5}; + + assert.equal($.templates("{{props myobject}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}), "a 1 - b 9 - c 2 - d 8 - A 3 - B 7 - C 4 - D 6 - e 5 - ", "{{props myobject}} (original order)"); + assert.equal($.templates("{{props #data sort='prop'}}{{:key}} {{:prop}} - {{/props}}").render(myobject, true), "a 1 - c 2 - A 3 - C 4 - e 5 - D 6 - B 7 - d 8 - b 9 - ", "{{props #data sort='prop'}}"); + assert.equal($.templates("{{props #data sort='key'}}{{:key}} {{:prop}} - {{/props}}").render(myobject, true), "a 1 - A 3 - b 9 - B 7 - c 2 - C 4 - d 8 - D 6 - e 5 - ", "{{props #data sort='key'}}"); + assert.equal($.templates("{{props #data sort='prop' reverse=true}}{{:key}} {{:prop}} - {{/props}}").render(myobject, true), "b 9 - d 8 - B 7 - D 6 - e 5 - C 4 - A 3 - c 2 - a 1 - ", "{{props #data sort='prop' reverse=true}}"); + assert.equal($.templates("{{props #data sort='key' reverse=true}}{{:key}} {{:prop}} - {{/props}}").render(myobject, true), "e 5 - d 8 - D 6 - c 2 - C 4 - b 9 - B 7 - a 1 - A 3 - ", "{{props #data sort='key' reverse=true}}"); + assert.equal($.templates("{{props myobject reverse=true}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}), "e 5 - D 6 - C 4 - B 7 - A 3 - d 8 - c 2 - b 9 - a 1 - ", "{{props myobject reverse=true}}"); + assert.equal($.templates("{{props myobject sort='key' reverse=true}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}), "e 5 - d 8 - D 6 - c 2 - C 4 - b 9 - B 7 - a 1 - A 3 - ", "{{props myobject sort='key' reverse=true}}"); + assert.equal($.templates("{{props myobject start=1 end=-1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "b 9 - c 2 - d 8 - A 3 - B 7 - C 4 - D 6 - ", "{{props myobject start=1 end=-1}}"); + assert.equal($.templates("{{props myobject start=1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "b 9 - c 2 - d 8 - A 3 - B 7 - C 4 - D 6 - e 5 - ", "{{props myobject start=1}}"); + assert.equal($.templates("{{props myobject end=-1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "a 1 - b 9 - c 2 - d 8 - A 3 - B 7 - C 4 - D 6 - ", "{{props myobject end=-1}}"); + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{props myobject filter=~oddValue}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddValue: oddValue}), "a 1 - b 9 - A 3 - B 7 - e 5 - ", "{{props myobject filter=~oddValue}}"); + assert.equal($.templates("{{props myobject filter=~oddIndex}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "b 9 - d 8 - B 7 - D 6 - ", "{{props myobject filter=~oddIndex}}"); + assert.equal($.templates("{{props myobject sort='prop' filter=~oddValue}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddValue: oddValue}), "a 1 - A 3 - e 5 - B 7 - b 9 - ", "{{props myobject sort='prop' filter=~oddValue}}"); + assert.equal($.templates("{{props myobject sort='prop' filter=~oddIndex}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "c 2 - C 4 - D 6 - d 8 - ", "{{props myobject sort='prop' filter=~oddIndex}}"); + assert.equal($.templates("{{props myobject sort='prop' filter=~oddIndex start=1 end=3}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "C 4 - D 6 - ", "{{props myobject sort='prop' filter=~oddIndex start=1 end=3}}"); + assert.equal($.templates("{{props myobject sort='prop' filter=~oddIndex start=-3 end=-1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "C 4 - D 6 - ", "{{props myobject sort='prop' filter=~oddIndex start=-3 end=-1}} Negative start or end count from the end"); + assert.equal($.templates("{{props myobject sort='prop' filter=~oddIndex start=3 end=3}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "", "{{props myobject sort='key' filter=~oddIndex start=3 end=3}} (outputs nothing)"); +} + assert.equal($.templates("{{props myobject step=2 start=1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "b 9 - d 8 - B 7 - D 6 - ", "{{props myobject step=2 start=1}}"); + assert.equal($.templates("{{props myobject sort='prop' step=2 start=1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "c 2 - C 4 - D 6 - d 8 - ", "{{props myobject sort='prop' step=2 start=1}}"); + assert.equal($.templates("{{props myobject sort='prop' step=2 start=3 end=6}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "C 4 - D 6 - ", "{{props myobject sort='prop' step=2 start=3 end=6}}"); + assert.equal($.templates("{{props myobject sort='prop' step=2 start=-6 end=-3}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "C 4 - D 6 - ", "{{props myobject sort='prop' step=2 start=-6 end=-3}} Negative start or end count from the end"); + assert.equal($.templates("{{props myobject sort='prop' step=2 start=3 end=3}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "", "{{props myobject sort='key' step=2 start=3 end=3}} (outputs nothing)"); + // =============================== Arrange =============================== + + var mypeople = { + p1: {name: "Jo", details: {age: 22}}, + p2: {name: "Bob", details: {age: 2}}, + p3: {name: "Emma", details: {age: 12}}, + p7: {name: "Jeff", details: {age: 13.5}}, + p6: {name: "Julia", details: {age: 0.6}}, + p5: {name: "Xavier", details: {age: 0}} + }; + + // ................................ Assert .................................. + + assert.equal($.templates("{{props mypeople sort='prop.name'}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}), "Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - Julia: age 0.6 - Xavier: age 0 - ", "{{props mypeople sort='name'}}"); + assert.equal($.templates("{{props mypeople sort='prop.details.age'}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}), "Xavier: age 0 - Julia: age 0.6 - Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - ", "{{props mypeople sort='details.age'}}"); + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{props mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Jeff: age 13.5 - Emma: age 12 - Bob: age 2 - Julia: age 0.6 - Xavier: age 0 - ", "{{props mypeople sort='details.age' reverse=true filter=~underLimit...}}"); + assert.equal($.templates("{{props mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{props mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); + assert.equal($.templates("{{props mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{props mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); +} + // =============================== Arrange =============================== + + var mypeople2 = { + p1: {name: "Bill", details: {age: 22, role: "Lead"}}, + p2: {name: "Anne", details: {age: 32, role: "Assistant"}}, + p3: {name: "Emma", details: {age: 19.1, role: "Team member"}}, + p7: {name: "Jeff", details: {age: 33.5, role: "Lead"}}, + p6: {name: "Xavier", details: {age: 32, role: "Team member"}}, + p5: {name: "Julia", details: {age: 18, role: "Assistant"}}, + p4: {name: "Bill", details: {age: 32, role: "Team member"}} + }; + + // ................................ Assert .................................. + + assert.equal($.templates("{{props mypeople sort=~sortAgeName}}{{:prop.name}}: ({{:prop.details.role}}) age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople2}, {sortAgeName: sortAgeName}), + "Julia: (Assistant) age 18 - Anne: (Assistant) age 32 - Bill: (Lead) age 22 - Jeff: (Lead) age 33.5 - Emma: (Team member) age 19.1 - Bill: (Team member) age 32 - Xavier: (Team member) age 32 - ", + "{{props mypeople sort=~sortAgeName}}: custom sort function"); + + // ................................ Assert .................................. + + assert.equal($.templates("{{props mypeople sort=~sortAgeName reverseAge=true}}{{:prop.name}}: ({{:prop.details.role}}) age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople2}, {sortAgeName: sortAgeName}), + "Anne: (Assistant) age 32 - Julia: (Assistant) age 18 - Jeff: (Lead) age 33.5 - Bill: (Lead) age 22 - Bill: (Team member) age 32 - Xavier: (Team member) age 32 - Emma: (Team member) age 19.1 - ", + "{{props mypeople sort=~sortAgeName}}: custom sort function - this pointer is tagCtx"); + + // ................................ Assert .................................. + + assert.equal($.templates("{{props ''}}{{else mypeople sort=~sortAgeName reverseAge=true}}{{:prop.name}}: ({{:prop.details.role}}) age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople2}, {sortAgeName: sortAgeName}), + "Anne: (Assistant) age 32 - Julia: (Assistant) age 18 - Jeff: (Lead) age 33.5 - Bill: (Lead) age 22 - Bill: (Team member) age 32 - Xavier: (Team member) age 32 - Emma: (Team member) age 19.1 - ", + "{{props ''}}{{else mypeople sort=~sortAgeName}}: custom sort function - this pointer is tagCtx (else block)"); + + // =============================== Arrange =============================== + + $.views.tags("props2", { + baseTag: "props" + }); + + // ................................ Assert .................................. + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{props2 mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:prop.name}}: age {{:prop.details.age}} - {{/props2}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{for2 mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}} Derived tag"); +} +}); + +QUnit.module("{{!-- --}}"); +QUnit.test("{{!-- --}}", function(assert) { + // =============================== Arrange =============================== + var result, + tmpl = $.templates("a {{:'--1'}}\n {{for '--2} }'}} {{:}} {{/for}} \n b"), + tmplWrappedInComment = $.templates("a {{!-- {{:'--1'}}\n {{for '--2} }'}} {{:}} {{/for}} \n--}} b"); + + // ................................ Assert .................................. + result = tmpl.render() + "|" + tmplWrappedInComment.render(); + assert.equal(result, "a --1\n --2} } \n b|a b", + "{{!-- --}} comments out blocks including newlines and --"); +}); + +QUnit.module("allowCode"); +QUnit.test("{{*}}", function(assert) { + // =============================== Arrange =============================== + $.views.settings.allowCode(false); + global.glob = {a: "AA"}; + + var tmpl = $.templates("_{{*:glob.a}}_"); + + // ................................ Assert .................................. + assert.equal(tmpl.render(), "__", + "{{*:expression}} returns nothing if allowCode not set to true"); + + // =============================== Arrange =============================== + $.views.settings.allowCode(true); + + var result = "" + !!tmpl.allowCode + " " + tmpl.render(); // Still returns "__" until we recompile + + tmpl.allowCode = true; + + result += "|" + !!tmpl.allowCode + " " + tmpl.render(); // Still returns "__" until we recompile + + // ................................ Assert .................................. + assert.equal(result, "false __|true __", + "If $.settings.allowCode() or tmpl.allowCode are set to true, previously compiled template is unchanged, so {{*}} still inactive"); + + // ................................ Act .................................. + tmpl = $.templates("_{{*:glob.a}}_"); + + result = "" + !!tmpl.allowCode + " " + tmpl.render(); // Now {{*}} is active + + // ................................ Assert .................................. + assert.equal(result, "true _AA_", + "If $.settings.allowCode() set to true, {{*: expression}} returns evaluated expression, with access to globals"); + + // =============================== Arrange =============================== + $.views.settings.allowCode(false); + + tmpl = $.templates({ + markup: "_{{*:glob.a}}_", + allowCode: true + }); + + // ................................ Assert .................................. + assert.equal(tmpl.render(), "_AA_", + "If template allowCode property set to true, {{*: expression}} returns evaluated expression, with access to globals"); + + // ................................ Act .................................. + tmpl = $.templates({ + markup: "_{{*:glob.a}}_" + }); + + result = "" + !!tmpl.allowCode + ":" + tmpl(); + + tmpl = $.templates({markup: tmpl, allowCode: true}); + + result += "|" + tmpl.allowCode + ":" + tmpl(); + + // ................................ Assert .................................. + assert.equal(result, "false:__|true:_AA_", + "Can recompile tmpl to allow code, using tmpl = $.templates({markup: tmpl, allowCode: true})"); + + // ................................ Act .................................. + $.templates("myTmpl", { + markup: "_{{*:glob.a}}_" + }); + + tmpl = $.templates.myTmpl; + + result = "" + !!tmpl.allowCode + ":" + tmpl(); + + $.templates("myTmpl", {markup: $.templates.myTmpl, allowCode: true}); + + tmpl = $.templates.myTmpl; + + result += "|" + tmpl.allowCode + ":" + tmpl(); + + // ................................ Assert .................................. + assert.equal(result, "false:__|true:_AA_", + 'Can recompile named tmpl to allow code, using $.templates("myTemplateName", {markup: $.templates.myTmpl, allowCode:true})"'); + + // =============================== Arrange =============================== + $.views.settings.allowCode(true); + + // ................................ Act .................................. + global.myVar = 0; + + tmpl = $.templates( + "{{* myvar=2; myvar+=4; }}" + + "Initial value: {{*:myvar}} " + + "{{* myvar+=11; }}" + + "New value: {{*:myvar}}"); + + // ................................ Assert .................................. + assert.equal(tmpl.render(), "Initial value: 6 New value: 17", + "{{* expression}} or {{*: expression}} can access globals as window.myVar or myVar"); + + // ................................ Act .................................. + global.people = people; + tmpl = $.templates("{{:start}}" + + + "{{* for (var i=0, l=people.length; iname}}" + + "{{*:view.index===view.parent.data.length-2 ? ' and ' : view.index 0, + "A simple template with useViews=false will not provide access to the views through allowCode"); + + // ................................ Act .................................. + message = ""; + tmpl.useViews = true; + + // ................................ Assert .................................. + assert.equal(tmpl.render({towns: towns}), "Seattle, Paris and Delhi", + "If tmpl.useViews set to true (for an existing template - without recompiling), the template renders with view hierarchy"); + + // ................................ Act .................................. + tmpl.useViews = false; + + $.views.settings.advanced({useViews: true}); + // ................................ Assert .................................. + assert.equal(tmpl.render({towns: towns}), "Seattle, Paris and Delhi", + "If tmpl.useViews is set to false, but $.views.settings.advanced({useViews: ...}) is set to true, the template renders with view hierarchy, (without recompiling)."); + + // ................................ Act .................................. + $.views.settings.advanced({useViews: false}); + + tmpl = $.templates({markup: tmpl, + useViews: true + }); + + // ................................ Assert .................................. + tmpl = $.templates( + "{{:#type}} " + + "{{for towns}}" + + "{{>name}}" + + "{{*:view.index===view.parent.data.length-2 ? ' and ' : view.indexname}}" + + "{{*:view.index===view.parent.data.length-2 ? ' and ' : view.indexname}}" + + "{{*:view.index===view.parent.data.length-2 ? ' and ' : view.index" + this.tagCtx.render(val) + ""; + } + } + } + }).render({people: otherPeople}), + "Jo 1 2 Bill 91 92 Fred ", + "itemVar with custom tags {{wrappedFor}}{{else}}{{/wrappedFor}}, and passing context to nested templates"); + + assert.equal($.templates( + "{{for people itemVar='~person'}}" + + "{{props ~person itemVar='~prop'}}" + + "{{:~prop.key}}: {{:~prop.prop}} " + + "{{/props}}" + + "{{/for}}" + ).render({people: otherPeople}), + "name: Jo otherTels: 1,2 name: Bill tels: 91,92 name: Fred ", + "itemVar with {{props}}, and passing context to nested templates"); + + assert.equal($.templates( + "{{for people itemVar='~person'}}" + + "{{props ~person.tels itemVar='~prop'}}" + + "{{:~person.name}} Tel: {{:~prop.key}}: {{:~prop.prop}} " + + "{{else itemVar='~personWithoutTels'}}" + + "{{:~personWithoutTels.name}}: has no tels " + + "{{/props}}" + + "{{/for}}" + ).render({people: otherPeople}), + "Jo: has no tels Bill Tel: 0: 91 Bill Tel: 1: 92 Fred: has no tels ", + "itemVar with {{props}}{{else}}{{/props}}, and passing context to nested templates"); +}); + +QUnit.module("api no jQuery"); +QUnit.test("templates", function(assert) { + // ................................ Arrange .................................. + $.templates("./test/templates/file/path.html", null); // In case template has been stored in a previous test + + // ................................ Act .................................. + var tmpl0 = $.templates({markup: "./test/templates/file/path.html"}); // Compile template but do not cache + + // ............................... Assert ................................. + assert.equal(!$.templates["./test/templates/file/path.html"] && tmpl0.render({name: "Jo0"}), + isIE8 ? "\nServerRenderedTemplate_Jo0_B" : "ServerRenderedTemplate_Jo0_B", + "Compile server-generated template, without caching"); + + // ................................ Act .................................. + var tmpl1 = $.templates("./test/templates/file/path.html"); // Compile and cache, using path as key + + // ............................... Assert ................................. + assert.equal(tmpl1 !== tmpl0 && $.templates["./test/templates/file/path.html"] === tmpl1 && tmpl1.render({name: "Jo1"}), + isIE8 ? "\nServerRenderedTemplate_Jo1_B" : "ServerRenderedTemplate_Jo1_B", + "Compile server-generated template, and cache on file path"); + + // ................................ Act .................................. + var tmpl2 = $.templates("./test/templates/file/path.html"); // Use cached template, accessed by path as key + + // ............................... Assert ................................. + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), + isIE8 ? "\nServerRenderedTemplate_Jo2_B" : "ServerRenderedTemplate_Jo2_B", + "Re-use cached server-generated template"); + + // ................................ Act .................................. + var tmpl3 = $.templates({markup: "./test/templates/file/path.html"}); // Re-compile template but do not cache. Leaved cached template. + + // ............................... Assert ................................. + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.templates["./test/templates/file/path.html"] === tmpl1 && tmpl3.render({name: "Jo3"}), + isIE8 ? "\nServerRenderedTemplate_Jo3_B" : "ServerRenderedTemplate_Jo3_B", + "Recompile server-generated template, without caching"); + + // ................................ Reset ................................ + delete $.templates["./test/templates/file/path.html"]; + if (isBrowser) { + document.getElementById("./test/templates/file/path.html").removeAttribute("data-jsv-tmpl"); + } + + // =============================== Arrange =============================== + tmplString = "A_{{:name}}_B"; + + var tmpl = $.templates(tmplString); + // ............................... Assert ................................. + assert.equal(tmpl.render(person), "A_Jo_B", + 'Compile from string: var tmpl = $.templates(tmplString);'); + + // ............................... Assert ................................. + assert.equal(tmpl(person), "A_Jo_B", + 'Compiled template is itself the render function: html = tmpl(data);'); + + // =============================== Arrange =============================== + var fnToString = tmpl.fn.toString(); + + // ............................... Assert ................................. + assert.equal($.templates("", tmplString).fn.toString() === fnToString && $.templates(null, tmplString).fn.toString() === fnToString && $.templates(undefined, tmplString).fn.toString() === fnToString, true, + 'if name is "", null, or undefined, then var tmpl = $.templates(name, tmplString)' + + '\nis equivalent to var tmpl = $.templates(tmplString);'); + + // =============================== Arrange =============================== + $.templates("myTmpl", tmplString); + + // ............................... Assert ................................. + assert.equal($.render.myTmpl(person), "A_Jo_B", + 'Compile and register named template: $.templates("myTmpl", tmplString);'); + + // =============================== Arrange =============================== + $.templates({myTmpl2: tmplString, myTmpl3: "X_{{:name}}_Y"}); + + // ............................... Assert ................................. + assert.equal($.render.myTmpl2(person) + $.render.myTmpl3(person), "A_Jo_BX_Jo_Y", + 'Compile and register named templates: $.templates({myTmpl: tmplString, myTmpl2: tmplString2});'); + + // =============================== Arrange =============================== + $.templates("!'-#==", "x"); + $.templates({'&^~>"2': "y"}); + assert.equal($.render["!'-#=="](person) + $.render['&^~>"2'](person), "xy", + 'Named templates can have arbitrary names;'); + + $.templates({myTmpl4: "A_B"}); + + // ............................... Assert ................................. + assert.equal($.render.myTmpl4(person), "A_B", + '$.templates({myTmpl: htmlWithNoTags});'); + + // =============================== Arrange =============================== + $.templates("myTmpl5", { + markup: tmplString + }); + + // ............................... Assert ................................. + assert.equal($.render.myTmpl5(person), "A_Jo_B", + '$.templates("myTmpl", {markup: markupString});'); + + // ............................... Assert ................................. + assert.equal($.templates("", {markup: tmplString}).render(person), "A_Jo_B", + 'Compile from template object without registering: var tmpl = $.templates("", {markup: markupString});'); + + // ............................... Assert ................................. + assert.equal($.templates({markup: tmplString}).render(person), "A_Jo_B", + 'Compile from template object without registering: var tmpl = $.templates({markup: markupString});'); + + // =============================== Arrange =============================== + $.templates({ + myTmpl6: { + markup: tmplString + } + }); + + // ............................... Assert ................................. + assert.equal($.render.myTmpl6(person), "A_Jo_B", + '$.templates({myTmpl: {markup: markupString}});'); + + // =============================== Arrange =============================== + $.templates("myTmpl7", tmpl); + + // ............................... Assert ................................. + assert.equal($.render.myTmpl7(person), "A_Jo_B", + 'Cloning a template: $.templates("newName", tmpl);'); + + // ............................... Assert ................................. + assert.equal($.templates(tmpl) === tmpl, true, + '$.templates(tmpl) returns tmpl'); + + // ............................... Assert ................................. + assert.equal($.templates("", tmpl) === tmpl, true, + '$.templates("", tmpl) returns tmpl'); + + // =============================== Arrange =============================== + var tmplWithHelper = $.templates("A_{{:name}}_B{{:~foo}}"); + var result = tmplWithHelper(person, {foo: "thisFoo"}); + + var tmplWithHelper2 = $.templates({markup: tmplWithHelper, helpers: {foo: "thatFoo"}}); + result += "|" + tmplWithHelper2(person); + + // ............................... Assert ................................. + assert.equal(result, "A_Jo_BthisFoo|A_Jo_BthatFoo", + 'Cloning a template to add/replace/change some template properties: var tmpl2 = $.templates({markup: tmpl1, otherOptions...});'); + + // ............................... Assert ................................. + assert.equal($.templates("", tmpl) === tmpl, true, + '$.templates(tmpl) returns tmpl'); + + // ............................... Assert ................................. + assert.equal($.templates("").render(), "", + '$.templates("") is a template with empty string as content'); + + // =============================== Arrange =============================== + $.templates("myEmptyTmpl", ""); + + // ............................... Assert ................................. + assert.equal($.templates.myEmptyTmpl.render(), "", + '$.templates("myEmptyTmpl", "") is a template with empty string as content'); + + // =============================== Arrange =============================== + $.templates("myTmpl", null); + + // ............................... Assert ................................. + assert.equal($.templates.myTmpl === undefined && $.render.myTmpl === undefined, true, + 'Remove a named template: $.templates("myTmpl", null);'); +}); + +QUnit.test("render", function(assert) { + var tmpl1 = $.templates("myTmpl8", tmplString); + $.templates({ + simple: "Content{{:#data}}|", + templateForArray: "Content{{for #data}}{{:#index}}{{/for}}{{:~foo}}", + primitiveDataTypes: "|{{:#data}}" + }); + + assert.equal(tmpl1.render(person), "A_Jo_B", 'tmpl1.render(data);'); + assert.equal($.render.myTmpl8(person), "A_Jo_B", '$.render.myTmpl8(data);'); + + $.templates("myTmpl9", "A_{{for}}inner{{:name}}content{{/for}}_B"); + assert.equal($.templates.myTmpl9.tmpls[0].render(person), "innerJocontent", 'Access nested templates: $.templates["myTmpl9[0]"];'); + + $.templates("myTmpl10", "top index:{{:#index}}|{{for 1}}nested index:{{:#get('item').index}}|{{if #get('item').index===0}}nested if index:{{:#get('item').index}}|{{else}}nested else index:{{:#get('item').index}}|{{/if}}{{/for}}"); + + assert.equal($.render.myTmpl10(people), "top index:0|nested index:0|nested if index:0|top index:1|nested index:1|nested else index:1|", + "#get('item').index gives the integer index even in nested blocks"); + + $.templates("myTmpl11", "top index:{{:#index}}|{{for people}}nested index:{{:#index}}|{{if #index===0}}nested if index:{{:#get('item').index}}|{{else}}nested else index:{{:#get('item').index}}|{{/if}}{{/for}}"); + + assert.equal($.render.myTmpl11({people: people}), "top index:|nested index:0|nested if index:0|nested index:1|nested else index:1|", + "#get('item').index gives the integer index even in nested blocks"); + + $.views.tags({ + myWrap: {} + }); + + var templateWithIndex = $.templates( + '{{for people}}' + + 'a{{:#index}} ' + + '{{if true}}b{{:#index}}{{/if}} ' + + 'c{{:#index}} ' + + '{{myWrap}}d{{:#index}} {{/myWrap}}' + + '{{/for}}'); + + $.views.settings.debugMode(true); + var result = templateWithIndex.render({people: [1,2]}); + + $.views.settings.debugMode(false); + var result2 = templateWithIndex.render({people: [1,2]}); + + assert.equal(result2 === result && result, + "a0 bFor #index in nested block use #getIndex(). c0 dFor #index in nested block use #getIndex(). a1 bFor #index in nested block use #getIndex(). c1 dFor #index in nested block use #getIndex(). ", + "#index gives error message in nested blocks (whether or not debugMode is true)."); + + var templateWithGetIndex = $.templates( + '{{for people}}' + + 'a{{:#getIndex()}} ' + + '{{if true}}b{{:#getIndex()}}{{/if}} ' + + 'c{{:#getIndex()}} ' + + '{{myWrap}}d{{:#getIndex()}} {{/myWrap}}' + + '{{/for}}'); + + assert.equal(templateWithGetIndex.render({people: [1,2]}), + "a0 b0 c0 d0 a1 b1 c1 d1 ", + "#getIndex gives inherited index in nested blocks."); + + $.views.helpers({myKeyIsCorrect: function(view) { + return view.parent.views[view._.key] === view; + }}); + $.templates("myTmpl12", "{{for people}}nested {{:~myKeyIsCorrect(#view)}}|{{if #index===0}}nested if {{:~myKeyIsCorrect(#view)}}|{{else}}nested else {{:~myKeyIsCorrect(#view)}}|{{/if}}{{/for}}"); + + assert.equal($.render.myTmpl12({people: people}), "nested true|nested if true|nested true|nested else true|", + 'view._key gives the key of this view in the parent views collection/object'); + + assert.equal($.templates(tmplString).render(person), "A_Jo_B", 'Compile from string: var html = $.templates(tmplString).render(data);'); + assert.equal($.render.myTmpl8(people), "A_Jo_BA_Bill_B", '$.render.myTmpl(array);'); + assert.equal($.render.simple([]), "", 'Empty array renders empty string'); + assert.equal($.render.simple(["",false,null,undefined,1]), "Content|Contentfalse|Content|Content|Content1|", 'Empty string, false, null or undefined members of array are also rendered'); + assert.equal($.render.simple(null), "Content|", 'null renders once with #data null'); + assert.equal($.render.simple(), "Content|", 'Undefined renders once with #data undefined'); + assert.equal($.render.simple(false), "Contentfalse|", 'false renders once with #data false'); + assert.equal($.render.simple(0), "Content0|", '0 renders once with #data 0'); + assert.equal($.render.simple(""), "Content|", '"" renders once with #data ""'); + + assert.equal($.render.templateForArray([[null,undefined,1]]), "Content012", 'Can render a template against an array without iteration, by wrapping array in an array'); + assert.equal($.render.templateForArray([null,undefined,1], true), "Content012", 'render(array, true) renders an array without iteration'); + assert.equal($.render.templateForArray([null,undefined,1], {foo:"foovalue"}, true), "Content012foovalue", 'render(array, helpers, true) renders an array without iteration, while passing in helpers'); + assert.equal($.templates.templateForArray.render([null,undefined,1], {foo:"foovalue"}, true), "Content012foovalue", 'render(array, helpers, true) renders an array without iteration, while passing in helpers'); + assert.equal($.render.templateForArray([[]]), "Content", 'Can render a template against an empty array without iteration, by wrapping array in an array'); + assert.equal($.render.templateForArray([], true), "Content", 'Can render a template against an empty array without iteration, by passing in true as second parameter'); + assert.equal($.render.templateForArray([], {foo: "foovalue"}, true), "Contentfoovalue", 'Can render a template against an empty array without iteration, by by passing in true as third parameter'); + assert.equal($.render.primitiveDataTypes([0,1,"abc","",,true,false]), "|0|1|abc|||true|false", 'Primitive types render correctly, even if falsey'); +}); + +QUnit.test("converters", function(assert) { + function loc(data) { + switch (data) {case "desktop": return "bureau";} + return data; + } + $.views.converters({loc2: loc}); + assert.equal($.templates("{{loc2:#data}}:{{loc2:'desktop'}}").render("desktop"), "bureau:bureau", "$.views.converters({loc: locFunction})"); + + var locFn = $.views.converters("loc", loc); + assert.equal(locFn === loc && $.views.converters.loc === loc && $.views.converters.loc2 === loc, true, 'locFunction === $.views.converters.loc === $.views.converters.loc2'); + + $.views.converters({loc2: null}); + assert.equal($.views.converters.loc2, undefined, '$.views.converters({loc2: null}) to remove registered converter'); + + assert.equal($.templates("{{attr:a}}").render({a: 0}), "0", '{{attr:0}} returns "0"'); + assert.equal($.templates("{{attr:a}}").render({}), "", "{{attr:undefined}} returns empty string"); + assert.equal($.templates("{{attr:a}}").render({a: ""}), "", "{{attr:''}} returns empty string"); + assert.equal($.templates("{{attr:a}}").render({a: null}), "", '{{attr:null}} returns empty string'); + assert.equal($.templates("{{attr:a}}").render({a: "<>&'" + '"'}), "<>&'"", '{{attr:"<>&' + "'" + '}} returns "<>&'""'); + + assert.equal($.templates("{{>a}}").render({a: 0}), "0", '{{>0}} returns "0"'); + assert.equal($.templates("{{>a}}").render({}), "", "{{>undefined}} returns empty string"); + assert.equal($.templates("{{>a}}").render({a: ""}), "", "{{>''}} returns empty string"); + assert.equal($.templates("{{>a}}").render({a: null}), "", "{{>null}} returns empty string"); + assert.equal($.templates("{{>a}}").render({a: "<>&'" + '"'}), "<>&'"", '{{>"<>&' + "'" + '}} returns "<>&'""'); + + assert.equal($.templates("{{loc:a}}").render({a: 0}), "0", '{{cnvt:0}} returns "0"'); + assert.equal($.templates("{{loc:a}}").render({}), "", '{{cnvt:undefined}} returns empty string'); + assert.equal($.templates("{{loc:a}}").render({a: ""}), "", "{{cnvt:''}} returns empty string"); + assert.equal($.templates("{{loc:a}}").render({a: null}), "", "{{cnvt:null}} returns empty string"); + + assert.equal($.templates("{{attr:a}}|{{>a}}|{{loc:a}}|{{:a}}").render({}), "|||", "{{attr:undefined}}|{{>undefined}}|{{loc:undefined}}|{{:undefined}} returns correct values"); + assert.equal($.templates("{{attr:a}}|{{>a}}|{{loc:a}}|{{:a}}").render({a:0}), "0|0|0|0", "{{attr:0}}|{{>0}}|{{loc:0}}|{{:0}} returns correct values"); + assert.equal($.templates("{{attr:a}}|{{>a}}|{{loc:a}}|{{:a}}").render({a:false}), "false|false|false|false", "{{attr:false}}|{{>false}}|{{loc:false}}|{{:false}} returns correct values"); +}); + +QUnit.test("{{sometag convert=converter}}", function(assert) { + function loc(data) { + switch (data) { + case "desktop": return "bureau"; + case "a 'a 'a convert=~myconverter}} html converter takes precedence and ~myconverter is ignored"); + assert.equal($.templates("{{if true convert=~invert}}yes{{else false convert=~invert}}no{{else}}neither{{/if}}").render('desktop', {invert: function(val) {return !val;}}), "no", "{{if expression convert=~myconverter}}...{{else expression2 convert=~myconverter}}... "); + assert.equal($.templates("{{for #data convert=~reverse}}{{:#data}}{{/for}}").render([1,2,3], {reverse: function(val) {return val.reverse();}}, true), "321", "{{for expression convert=~myconverter}}"); +}); + +QUnit.test("tags", function(assert) { + // ................................ Reset .................................. + towns = [{name: "Seattle"}, {name: "Paris"}, {name: "Delhi"}]; + + // ................................ Act .................................. + assert.equal($.templates("{{sort people reverse=true}}{{:name}}{{/sort}}").render({people: people}), "BillJo", "$.views.tags({sort: sortFunction})"); + + assert.equal($.templates("{^{sort people reverse=true}}{^{:name}}{{/sort}}").render({people: people}), "BillJo", "Calling render() with inline data-binding {^{...}} renders normally without binding"); + + assert.equal($.templates("{{sort people reverse=true towns}}{{:name}}{{/sort}}").render({people: people, towns:towns}), "DelhiParisSeattleBillJo", "Multiple parameters in arbitrary order: {{sort people reverse=true towns}}"); + + assert.equal($.templates("{{sort reverse=false people reverse=true towns}}{{:name}}{{/sort}}").render({people: people, towns:towns}), "DelhiParisSeattleBillJo", "Duplicate named parameters - last wins: {{sort reverse=false people reverse=true towns}}"); + + var sort2 = $.views.tags("sort2", sort); + assert.equal(sort2.render === sort && $.views.tags.sort.render === sort && $.views.tags.sort2.render === sort, true, 'sortFunction === $.views.tags.sort.render === $.views.tags.sort2.render'); + + $.views.tags("sort2", null); + assert.equal($.views.tags.sort2, undefined, '$.views.tags("sort2", null) to remove registered tag'); + + $.views.tags("boldTag", { + render: function() { + return "" + this.tagCtx.render() + ""; + }, + template: "{{:#data}}" + }); + assert.equal($.templates("{{boldTag}}{{:#data}}{{/boldTag}}").render("theData"), "theData", + 'Data context inside a block tag using tagCtx.render() is the same as the outer context'); + + assert.equal($.templates("{{boldTag/}}").render("theData"), "theData", + 'Data context inside the built-in template of a self-closing tag using tagCtx.render() is the same as the outer context'); + + assert.equal($.templates("{{sort people reverse=true}}{{:name}}{{/sort}}").render({people: people}), "BillJo", "$.views.tags({sort: sortFunction})"); + + // =============================== Arrange =============================== + // ................................ Act .................................. + var eventData = "", + + renderedOutput = $.templates({ + markup: '{^{myWidget name/}}', + tags: { + myWidget: { + init: function(tagCtx, linkCtx) { + eventData += " init"; + }, + render: function(name, things) { + eventData += " render"; + return name + " " + this.getType(); + }, + getType: function() { + eventData += " getType"; + return this.type; + }, + type: "special" + } + } + }).render(person); + + // ............................... Assert ................................. + assert.equal(renderedOutput + "|" + eventData, "Jo special| init render getType", '{^{myWidget/}} - Events fire in order during rendering: init render'); + + // =============================== Arrange =============================== + $.views.tags({ + noRenderNoTemplate: {}, + voidRender: function() {}, + emptyRender: function() {return "";}, + emptyTemplate: { + template: "" + }, + templateReturnsEmpty: { + template: "{{:a}}" + } + }); + + // ............................... Assert ................................. + assert.equal($.templates("a{{noRenderNoTemplate/}}b{^{noRenderNoTemplate/}}c{{noRenderNoTemplate}}{{/noRenderNoTemplate}}d{^{noRenderNoTemplate}}{{/noRenderNoTemplate}}e").render(1), "abcde", + "non-rendering tag (no template, no render function) renders empty string"); + + assert.equal($.templates("a{{voidRender/}}b{^{voidRender/}}c{{voidRender}}{{/voidRender}}d{^{voidRender}}{{/voidRender}}e").render(1), "abcde", + "non-rendering tag (no template, no return from render function) renders empty string"); + + assert.equal($.templates("a{{emptyRender/}}b{^{emptyRender/}}c{{emptyRender}}{{/emptyRender}}d{^{emptyRender}}{{/emptyRender}}e").render(1), "abcde", + "non-rendering tag (no template, empty string returned from render function) renders empty string"); + + assert.equal($.templates("a{{emptyTemplate/}}b{^{emptyTemplate/}}c{{emptyTemplate}}{{/emptyTemplate}}d{^{emptyTemplate}}{{/emptyTemplate}}e").render(1), "abcde", + "non-rendering tag (template has no content, no render function) renders empty string"); + + assert.equal($.templates("a{{templateReturnsEmpty/}}b{^{templateReturnsEmpty/}}c{{templateReturnsEmpty}}{{/templateReturnsEmpty}}d{^{templateReturnsEmpty}}{{/templateReturnsEmpty}}e").render(1), "abcde", + "non-rendering tag (template returns empty string, no render function) renders empty string"); + + $.views.tags({ + tagJustTemplate: { + argDefault: false, + template: "{{:#data ? name||length : 'Not defined'}} " + }, + tagJustTemplateObject: { + argDefault: false, + template: {markup: "{{:#data ? name||length : 'Not defined'}} "} + }, + tagWithTemplateWhichIteratesAgainstCurrentData: { + template: "{{:#data ? name : 'Not defined'}} ", + render: function() { + return this.tagCtx.render(); // Renders against current data - and iterates if array + } + }, + tagJustRender: function(val) { + return val.name + " "; + }, + tagJustRenderArray: function(val) { + return val.length + " "; + }, + tagWithTemplateNoIteration: { + contentCtx: true, + render: function(val) { + return this.tagCtx.render(val, true); // Render without iteration + }, + template: "{{:#data.length}} " + }, + tagWithTemplateNoIterationWithHelpers: { + render: function(val) { + return this.tagCtx.render(val, {foo: "foovalue"}, true); // Render without iteration + }, + template: "{{:#data.length}} {{:~foo}}" + }, + tagWithTemplateWhichIteratesFirstArg: { + template: "{{:#data ? name : 'Not defined'}} ", + render: function(val) { + return this.tagCtx.render(val); // Renders against first arg - defaults to current data - and iterates if array + } + }, + tagWithTemplateWhichIteratesFirstArgNoDefaultArg: { + template: "{{:#data ? name : 'Not defined'}} ", + argDefault: false, + render: function(val) { + return this.tagCtx.render(val); // Renders against first arg and iterates if array. Does not default to current data + } + } + }); + + assert.equal($.templates("a{{include person}}{{tagJustTemplate/}}{{/include}}").render({person: {name: "Jo"}}), "aJo ", + "Tag with just a template and no param renders once against current data, if object"); + + assert.equal($.templates("a{{include person}}{{tagJustTemplateObject/}}{{/include}}").render({person: {name: "Jo"}}), "aJo ", + "Tag with just a template object and no param renders once against current data, if object"); + + assert.equal($.templates("a{{include person}}{{tagJustTemplate undefinedProperty/}}{{/include}}").render({person: {name: "Jo"}}), "aNot defined ", + "Tag with just a template and a parameter which is not defined renders once against 'undefined'"); + + assert.equal($.templates("a{{include people}}{{tagJustTemplate/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "a2 ", + "Tag with just a template and no param renders once against current data, even if array" + + "\n- but can add render method with tagCtx.render(val) to iterate - (next test)"); + + assert.equal($.templates("a{{include people}}{{tagWithTemplateWhichIteratesAgainstCurrentData/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "aJo Mary ", + "Tag with a template and no param and render method calling tagCtx.render() iterates against current data if array"); + + assert.equal($.templates("a{{include people}}{{tagWithTemplateWhichIteratesAgainstCurrentData thisisignored/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "aJo Mary ", + "Tag with a template and no param and render method calling tagCtx.render() iterates against current data if array" + + "\n- and ignores argument if provided"); + + assert.equal($.templates("a{{include people}}{{tagWithTemplateWhichIteratesFirstArg/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "aJo Mary ", + "Tag with a template and no param and render method calling tagCtx.render(val) renders against first arg" + + "\n- or defaults to current data, and iterates if array"); + + assert.equal($.templates("a{{tagWithTemplateWhichIteratesFirstArg people/}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "aJo Mary ", + "Tag with a template and no param and render method calling tagCtx.render(val) iterates against argument if array"); + + assert.equal($.templates("a{{include people}}{{tagWithTemplateNoIteration/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "a2 ", + "If current data is an array, a tag with a template and a render method calling" + + "\ntagCtx.render(val, true) and no param renders against array without iteration"); + + assert.equal($.templates("a{{include people}}{{tagWithTemplateWhichIteratesFirstArgNoDefaultArg/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "aNot defined ", + "Tag with a template and no param and render method calling tagCtx.render(val) but with tag.argDefault=false renders against first arg" + + "\n- and does not default to current data if arg is undefined"); + + assert.equal($.templates("a{{include people}}{{tagWithTemplateNoIterationWithHelpers/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "a2 foovalue", + "If current data is an array, a tag with a template and a render method calling" + + "\ntagCtx.render(val, helpers, true) and no param renders against array without iteration"); + + assert.equal($.templates("a{{include person}}{{tagJustRender/}}{{/include}}").render({person: {name: "Jo"}}), "aJo ", + "Tag with just a render and no param renders once against current data, if object"); + + assert.equal($.templates("a{{include people}}{{tagJustRenderArray/}}{{/include}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "a2 ", + "Tag with just a render and no param renders once against current data, even if array - but render method can choose to iterate"); + + assert.equal($.templates("a{{tagJustTemplate person/}}").render({person: {name: "Jo"}}), "aJo ", + "Tag with just a template and renders once against first argument data, if object"); + + assert.equal($.templates("a{{tagJustTemplate people/}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "a2 ", + "Tag with just a template renders once against first argument data even if it is an array" + + "\n- but can add render method with tagCtx.render(val) to iterate - (next test)"); + + assert.equal($.templates("a{{tagWithTemplateWhichIteratesFirstArg people/}}").render({people: [{name: "Jo"}, {name: "Mary"}]}), "aJo Mary ", + "Tag with a template and render method calling tagCtx.render(val) renders against first param data, and iterates if array"); + +}); + +QUnit.test("derived tags", function(assert) { + // =============================== Arrange =============================== + var tmpl = $.templates("a:{{A 1/}} b:{{B 2/}}"), + + tagA = $.views.tags("A", + function(val) {return "A" + val;}, + tmpl + ); + + $.views.tags("B", + { + baseTag: tagA, + render: function(val) { + return "B" + val + this.base(val); + } + }, + tmpl + ); + + // ................................ Act .................................. + var result = tmpl.render({}); + + // ............................... Assert ................................. + assert.equal(result, "a:A1 b:B2A2", "One level tag inheritance chain - calling base method"); + + // =============================== Arrange =============================== + tmpl = $.templates("a:{{A 1 2 3/}} b:{{B 11 12 13/}} c:{{C 21 22 23/}} d:{{D 31 32 33/}} e:{{E 41 42 43/}}"); + + tagA = $.views.tags("A", + function(val) {return "A" + val;}, + tmpl + ); + + $.views.tags("B", + { + baseTag: tagA, + foo: function(val) { + return "FOO-B:" + val; + }, + render: function(val) { + return "B" + val + this.base(val); + } + }, + tmpl + ); + + var tagC = $.views.tags("C", + { + baseTag: "A", + foo: function(val) { + return "FOO-C:" + val; + }, + bar: function(x, y, z) { + return "BAR-C" + x + y + z; + }, + render: function(val) { + return "C" + val + this.base(val) + this.foo(val) + this.bar.apply(this, this.tagCtx.args); + } + }, + tmpl + ); + + $.views.tags("D", + { + baseTag: tagC, + render: function(val) { + return "D" + val + this.base(val); + } + }, + tmpl + ); + + $.views.tags("E", + { + baseTag: "D", + foo: function(val) { + return "FOO-E" + val + this.base(val); + }, + bar: function(x, y, z) { + return "BAR-E" + x + y + z + this.baseApply(arguments); + }, + render: function(val) { + return "E" + val + this.base(val); + } + }, + tmpl + ); + + // ................................ Act .................................. + result = tmpl.render({}); + + // ............................... Assert ................................. + assert.equal(result, "a:A1 b:B11A11 c:C21A21FOO-C:21BAR-C212223 d:D31C31A31FOO-C:31BAR-C313233 e:E41D41C41A41FOO-E41FOO-C:41BAR-E414243BAR-C414243", "Complex multi-level inheritance chain"); + + // =============================== Arrange =============================== + $.views.settings.debugMode(true); + tmpl = $.templates("a:{{A 1 2 3/}}"); + + tagA = $.views.tags("A", + function(val) { + return "A" + val + this.baseApply(arguments); + }, + tmpl + ); + $.views.settings.debugMode(false); + + // ................................ Act .................................. + result = tmpl.render({}); + + // ............................... Assert ................................. + assert.equal(result.slice(0, 10), "a:{Error: ", "Calling base or baseApply when there is no base tag: Type Error"); + + // =============================== Arrange =============================== + tmpl = $.templates("a:{{A 1 2 3/}} b:{{B 11 12 13/}} c:{{C 21 22 23/}}"); + + tagA = $.views.tags("A", + function(val) { + return "A" + val; + }, + tmpl + ); + + $.views.tags("B", + { + baseTag: tagA, + render: function(val) { + return "B" + val + this.base(val); + } + }, + tmpl + ); + + tagC = $.views.tags("C", + { + baseTag: "A", + bar: function(x, y, z) { + return "BAR-C" + x + y + z + " Missing base method call: " + this.base(x) + this.baseApply(arguments) + "."; + }, + render: function(val) { + return "C" + val + this.bar.apply(this, this.tagCtx.args); + } + }, + tmpl + ); + + // ................................ Act .................................. + result = tmpl.render({}); + + // ............................... Assert ................................. + assert.equal(result, "a:A1 b:B11A11 c:C21BAR-C212223 Missing base method call: .", + 'Calling base or baseApply when there is no corresponding method on base tag implementation: noop - returning ""'); + +}); + +QUnit.test('{{include}} and wrapping content', function(assert) { + var result = $.templates({ + markup: + 'Before {{include tmpl="wrapper"}}' + + '{{:name}}' + + '{{/include}} After', + templates: { + wrapper: "header{{include tmpl=#content/}}footer" + } + }).render(people); + + assert.equal(result, "Before headerJofooter AfterBefore headerBillfooter After", 'Using {{include ... tmpl="wrapper"}}wrapped{{/include}}'); + + result = $.templates({ + markup: + 'This (render method) replaces: {{mytag override="replacementText" tmpl="wrapper"}}' + + '{{:name}}' + + '{{/mytag}} | ' + + 'This (original template) adds: {{mytag}}' + + '{{:name}}' + + '{{/mytag}} | ' + + 'This (new template) wraps: {{mytag setTmpl="wrapper"}}' + + '{{:name}}' + + '{{/mytag}} | ', + tags: { + mytag: { + template: "add{{include tmpl=#content/}}", + init: function() { + this.template = this.tagCtx.props.setTmpl || this.template; + }, + render: function() { + return this.tagCtx.props.override; + } + } + }, + templates: { + wrapper: "header{{include tmpl=#content/}}footer" + } + }).render(people); + + assert.equal(result, + "This (render method) replaces: replacementText |" + + " This (original template) adds: addJo |" + + " This (new template) wraps: headerJofooter |" + + " This (render method) replaces: replacementText |" + + " This (original template) adds: addBill |" + + " This (new template) wraps: headerBillfooter | ", + 'Custom tag with wrapped content: {{mytag ... tmpl="wrapper"}}wrapped{{/myTmpl}}'); + + result = $.templates({ + markup: + 'Before {{include tmpl="wrapper"}}' + + '{{:name}}' + + '{{/include}} After', + templates: { + wrapper: "header{{for people tmpl=#content/}}footer" + } + }).render({people: people}); + + assert.equal(result, "Before headerJoBillfooter After", 'Using {{for ... tmpl="wrapper"}}wrapped{{/for}}'); + + result = $.templates({ + markup: + 'This replaces:{{mytag override="replacementText"}}' + + '{{:name}}' + + '{{/mytag}}' + + 'This wraps:{{mytag tmpl="wrapper"}}' + + '{{:name}}' + + '{{/mytag}}', + tags: { + mytag: function() { + return this.tagCtx.props.override; + } + }, + templates: { + wrapper: "header{{for people tmpl=#content/}}footer" + } + }).render({people: people}); + + assert.equal(result, "This replaces:replacementTextThis wraps:headerJoBillfooter", 'Using {{mytag ... tmpl="wrapper"}}wrapped{{/myTmpl}}'); + + result = $.templates({ + markup: + '{{mytag}}' + + '{{:name}}' + + '{{/mytag}} | ' + + '{{mytag tmpl="innerwrap"}}' + + '{{:name}}' + + '{{/mytag}} | ' + + '{{mytag tmpl="middlewrap"}}' + + '{{:name}}' + + '{{/mytag}} | ' + + '{{mytag tmpl="wrapper"}}' + + '{{:name}}' + + '{{/mytag}} | ' + + + '{{mytag2}}' + + '{{:name}}' + + '{{/mytag2}} | ' + + '{{mytag2 tmpl="innerwrap"}}' + + '{{:name}}' + + '{{/mytag2}} | ' + + '{{mytag2 tmpl="middlewrap"}}' + + '{{:name}}' + + '{{/mytag2}} | ' + + '{{mytag2 tmpl="wrapper"}}' + + '{{:name}}' + + '{{/mytag2}} | ', + templates: { + wrapper: "middle {{include tmpl=#content/}} {{include tmpl='middlewrap'/}} {{include tmpl='innerwrap'/}}/middle", + middlewrap: "inner {{include tmpl=#content/}} and {{include tmpl='innerwrap'/}} /inner", + innerwrap: "innermost {{include tmpl=#content/}} /innermost" + }, + tags: { + mytag: { + template: "outer {{include tmpl=#content/}} /outer" + }, + mytag2: { + } + } + }).render(people); + + assert.equal(result, + "outer Jo /outer |" + + " outer innermost Jo /innermost /outer |" + + " outer inner Jo and innermost Jo /innermost /inner /outer |" + + " outer middle Jo inner Jo and innermost Jo /innermost /inner innermost Jo /innermost/middle /outer |" + + + " Jo |" + + " innermost Jo /innermost |" + + " inner Jo and innermost Jo /innermost /inner |" + + " middle Jo inner Jo and innermost Jo /innermost /inner innermost Jo /innermost/middle |" + + + " outer Bill /outer |" + + " outer innermost Bill /innermost /outer |" + + " outer inner Bill and innermost Bill /innermost /inner /outer |" + + " outer middle Bill inner Bill and innermost Bill /innermost /inner innermost Bill /innermost/middle /outer |" + + + " Bill |" + + " innermost Bill /innermost |" + + " inner Bill and innermost Bill /innermost /inner |" + + " middle Bill inner Bill and innermost Bill /innermost /inner innermost Bill /innermost/middle | ", + 'Cascading multi-level wrappers around #content' + ); + + var data = [{ + phones: [ + {number: "Ph0", alt: "Alt0"}, + {number: "Ph1", alt: "Alt1"}, + {number: "Ph2", alt: "Alt2"} + ] + }]; + + result = $.templates({ + markup: + '{{mytag tmpl="phonelist"}}' + + '{{:number}} ' + + '{{/mytag}} | ' + + '{{mytag2 tmpl="phonelist"}}' + + '{{:number}} ' + + '{{/mytag2}}', + templates: { + phonelist: "{{for phones}}{{include tmpl=#content/}}{{/for}}" + }, + tags: { + mytag: { + template: "outer {{include tmpl=#content/}} /outer" + }, + mytag2: { + } + } + }).render(data); + + assert.equal(result, + "outer Ph0 Ph1 Ph2 /outer | Ph0 Ph1 Ph2 ", + 'Cascading multi-level wrapper around #content with {{for}}' + ); + + result = $.templates({ + markup: + '{{mytag tmpl="phonelist"}}' + + '{{:number}}' + + '{{else tmpl="altlist"}}' + + '{{:alt}}' + + '{{else tmpl="altlist2"}}' + + '{{:alt}}' + + '{{/mytag}}' + + '{{mytag2 tmpl="phonelist"}}' + + '{{:number}}' + + '{{else tmpl="altlist"}}' + + '{{:alt}}' + + '{{else tmpl="altlist2"}}' + + '{{:alt}}' + + '{{/mytag2}}', + templates: { + phonelist: "A< {{for phones}}{{include tmpl=#content/}} {{/for}} > ", + altlist: "B< {{for phones tmpl='titlewrap'/}} > ", + altlist2: "C< {{for phones}}{{include tmpl='titlewrap'/}}{{/for}} > ", + titlewrap: "alternate: {{include tmpl=#content/}} " + }, + tags: { + mytag: { + template: "outer {{include tmpl=#content/}} /outer | " + }, + mytag2: { + } + } + }).render(data); + + assert.equal(result, + "outer A< Ph0 Ph1 Ph2 > /outer |" + + " outer B< alternate: Alt0 alternate: Alt1 alternate: Alt2 > /outer |" + + " outer C< alternate: Alt0 alternate: Alt1 alternate: Alt2 > /outer |" + + " A< Ph0 Ph1 Ph2 >" + + " B< alternate: Alt0 alternate: Alt1 alternate: Alt2 >" + + " C< alternate: Alt0 alternate: Alt1 alternate: Alt2 > ", + 'Cascading multi-level wrapper around #content with {{for}}{{else}}' + ); +}); + +QUnit.test("helpers", function(assert) { + $.views.helpers({ + not: function(value) { + return !value; + }, + concat: function() { + return "".concat.apply("", arguments) + "top"; + } + }); + assert.equal($.templates("{{:~concat(a, 'b', ~not(false))}}").render({a: "aVal"}), "aValbtruetop", "~concat('a')"); + + function toUpperCase(value) { + return value.toUpperCase(); + } + var toUpperCaseFn = $.views.helpers("toUpperCase", toUpperCase); + assert.equal($.templates("{{:~toUpperCase(name)}} {{:~toUpperCase('Foo')}}").render(person), "JO FOO", '$.views.helpers("toUpperCase", toUpperCaseFn);... {{:~toUpperCase(name)}}'); + + $.views.helpers({toUpperCase2: toUpperCase}); + assert.equal(toUpperCaseFn === toUpperCase && $.views.helpers.toUpperCase === toUpperCase && $.views.helpers.toUpperCase2 === toUpperCase, true, 'sortFunction === $.views.helpers.toUpperCase === $.views.helpers("toUpperCase")'); + + $.views.helpers("toUpperCase2", null); + assert.equal($.views.helpers.toUpperCase2, undefined, '$.views.helpers("toUpperCase2", null) to remove registered helper'); +}); + +QUnit.test("settings", function(assert) { + // ................................ Act .................................. + // Delimiters + + $.views.settings.delimiters("@%","%@"); + var result = $.templates("A_@%if true%@yes@%/if%@_B").render() + + "|" + $.views.settings.delimiters() + "|" + $.views.sub.settings.delimiters; + + $.views.settings.delimiters("<<",">>", "*"); + + result += "|" + $.views.settings.delimiters() + "|" + $.views.sub.settings.delimiters; + + $.views.settings.delimiters("{{","}}", "^"); + result += "|" + $.templates("A_{{if true}}YES{{/if}}_B").render() + + "|" + $.views.settings.delimiters() + "|" + $.views.sub.settings.delimiters; + + // ............................... Assert ................................. + assert.equal(result, "A_yes_B|@%,%@,^|@%,%@,^|<<,>>,*|<<,>>,*|A_YES_B|{{,}},^|{{,}},^", "Custom delimiters with render()"); + + // =============================== Arrange =============================== + // Debug mode false + + var oldDebugMode = $.views.settings.debugMode(); + var app = {choose: true, name: "Jo"}; + result = ""; + + // ................................ Act .................................. + $.views.settings.debugMode(false); + + try { + result = $.templates('{{:missing.willThrow}}').render(app); + } catch(e) { + result += !!e.message; + } + + // ............................... Assert ................................. + assert.equal($.views.settings.debugMode() + " " + result, 'false true', + 'Debug mode false: {{:missing.willThrow}} throws error'); + + // ................................ Act .................................. + // Debug mode true + + $.views.settings.debugMode(true); + + try { + result = $.templates('{{:missing.willThrow}}').render(app); + } catch(e) { + result += !!e.message; + } + + // ............................... Assert ................................. + assert.equal($.views.settings.debugMode() + " " + result.slice(0, 8), 'true {Error: ', + 'Debug mode true: {{:missing.willThrow}} renders error'); + + // ................................ Act .................................. + // Debug mode 'onError' handler function with return value + + $.views.settings.debugMode(function(e, fallback, view) { + var data = this; + return "Override error - " + (fallback||"") + "_" + (view ? data.name + " " + (e.message.indexOf("undefined")>-1): e); // For syntax errors e is a string, and view is undefined + }); + + // ................................ Act .................................. + result = typeof $.views.settings.debugMode() + " "; + result += $.templates('{{:missing.willThrow}}').render(app); + + // ............................... Assert ................................. + assert.equal(result, "function Override error - _Jo true", + "Debug mode 'onError' handler override, with {{:missing.willThrow}}"); + + // ................................ Act .................................. + result = typeof $.views.settings.debugMode() + " "; + result += $.templates('{{:missing.willThrow onError="myFallback"}}').render(app); + + // ............................... Assert ................................. + assert.equal(result, "function Override error - myFallback_Jo true", + 'Debug mode \'onError\' handler override, with onError fallback: {{:missing.willThrow onError="myFallback"}}'); + + // ................................ Act .................................. + result = typeof $.views.settings.debugMode() + " "; + result += $.templates('{{if missing.willThrow onError="myFallback"}}yes{{/if}}').render(app); + + // ............................... Assert ................................. + assert.equal(result, 'function Override error - myFallback_Jo true', + 'Debug mode \'onError\' handler override, with onError fallback: {{if missing.willThrow onError="myFallback"}}'); + + // ................................ Act .................................. + // Debug mode 'onError' handler function without return value + var ret = ""; + $.views.settings.debugMode(function(e, fallback, view) { + var data = this; + ret = "Override error - " + (fallback||"") + "_" + data.name + " " + (e.message.indexOf("undefined")>-1); // For syntax errors e is a string, and view is undefined + }); + + // ................................ Act .................................. + result = typeof $.views.settings.debugMode() + " "; + result += $.templates('{{:missing.willThrow}}').render(app); + + // ............................... Assert ................................. + assert.equal(ret + "|" + result.slice(0, 17), "Override error - _Jo true|function {Error: ", + "Debug mode 'onError' handler (no return) with {{:missing.willThrow}}"); + + // ................................ Act .................................. + result = typeof $.views.settings.debugMode() + " "; + result += $.templates('{{:missing.willThrow onError="myFallback"}}').render(app); + + // ............................... Assert ................................. + assert.equal(ret + "|" + result, "Override error - myFallback_Jo true|function myFallback", + 'Debug mode \'onError\' handler (no return) with onError fallback: {{:missing.willThrow onError="myFallback"}}'); + + // ................................ Act .................................. + result = typeof $.views.settings.debugMode() + " "; + result += $.templates('{{if missing.willThrow onError="myFallback"}}yes{{/if}}').render(app); + + // ............................... Assert ................................. + assert.equal(ret + "|" + result, "Override error - myFallback_Jo true|function myFallback", + 'Debug mode \'onError\' handler (no return) with onError fallback: {{if missing.willThrow onError="myFallback"}}'); + + // ................................ Reset .................................. + $.views.settings.debugMode(oldDebugMode); +}); + +QUnit.test("template encapsulation", function(assert) { + // =============================== Arrange =============================== +$.templates({ + myTmpl6: { + markup: "{{sort reverse=true people}}{{:name}}{{/sort}}", + tags: { + sort: sort + } + } + }); + + // ............................... Assert ................................. + assert.equal($.render.myTmpl6({people: people}), "BillJo", '$.templates("myTmpl", tmplObjWithNestedItems);'); + + // =============================== Arrange =============================== + $.views.helpers("h1", "globalHelper"); + + var tmpl = $.templates({ + markup: "{{if true}}{{:~h1}} {{:~h2}} {{:~h3}}{{/if}}", + helpers: { + h2: "templateHelper" + } + }); + + // ............................... Assert ................................. + assert.equal(tmpl.render({}, {h3:"optionHelper"}), "globalHelper templateHelper optionHelper", 'Passing in helpers - global, template or option'); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: "{{if true}}{{:~h1}}{{/if}}", + helpers: { + h1: "templateHelper" + } + }); + + // ............................... Assert ................................. + assert.equal(tmpl.render({}), "templateHelper", 'template helper overrides global helper'); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: "{{if true}}{{:~h1}}{{/if}}" + }); + + // ............................... Assert ................................. + assert.equal(tmpl.render({}, {h1: "optionHelper"}), "optionHelper", 'option helper overrides global helper'); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: "{{if true}}{{:~h2}}{{/if}}", + helpers: { + h2: "templateHelper" + } + }); + + // ............................... Assert ................................. + assert.equal(tmpl.render({}, {h2: "optionHelper"}), "templateHelper", 'template helper overrides option helper'); + + // =============================== Arrange =============================== + $.views.converters("c1", function(val) {return val + "globalCvt";}); + + tmpl = $.templates({ + markup: "{{if true}}{{c1:1}}{{c2:2}}{{/if}}", + converters: { + c2: function(val) {return val + "templateCvt";} + } + }); + + // ............................... Assert ................................. + assert.equal(tmpl.render({}), "1globalCvt2templateCvt", 'template converter and global converter'); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: "{{if true}}{{c1:1}}{{/if}}", + converters: { + c1: function(val) {return val + "templateCvt";} + } + }); + + // ............................... Assert ................................. + assert.equal(tmpl.render({}), "1templateCvt", 'template converter overrides global converter'); + + // =============================== Arrange =============================== + + $.templates({ + cascade: "outerCascade", + nesting: { + markup: "{{if true}} {{c1:~h1}} {{include tmpl='inner'/}}{{/if}} {{include tmpl='cascade'/}}", + helpers: { + h1: "templateHelper" + }, + converters: { + c1: function(val) {return val + " templateCvt";} + }, + templates: { + cascade: "innerCascade", + inner: { + markup: "{{if true}}{{c1:~h1}}{{/if}} {{include tmpl='cascade'/}}", + helpers: { + h1: "innerTemplateHelper" + }, + converters: { + c1: function(val) {return val + " innerTemplateCvt";} + }, + templates: { + cascade: "innerInnerCascade" + } + } + } + } + }); + + // ............................... Assert ................................. + assert.equal($.templates.nesting.render({}, {b: "optionHelper"}), " templateHelper templateCvt innerTemplateHelper innerTemplateCvt innerInnerCascade innerCascade", + 'Inner template, helper, and converter override outer template, helper, and converter'); +}); + +QUnit.module("Custom tags"); + +QUnit.test("contentCtx", function(assert) { + +var tmpl = $.templates("{{for 'parent'}}{{mytag 'arg1' 'arg2' 'arg3'}} {{:#data}}A{{else 'elseArg1'}} {{:#data}}B{{else}} {{:#data}}C{{/mytag}}{{/for}}"); + + // =============================== Arrange =============================== + +$.views.tags({mytag: { +}}, tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl.render("outer"), " arg1A elseArg1B parentC", 'No contentCtx - context is 1st arg or parentView.data'); + + // =============================== Arrange =============================== + +$.views.tags({mytag: { + contentCtx: function(val) { + return 0; + } +}}, tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl.render("outer"), " 0A 0B 0C", 'contentCtx returns 0 - context is 0 (even for falsy values like 0'); + + // =============================== Arrange =============================== + +$.views.tags({mytag: { + contentCtx: function(val) { + return val; + } +}}, tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl.render("outer"), " arg1A elseArg1B parentC", 'contentCtx returns first arg/parentView - context is 1st arg or parentView.data'); + + // =============================== Arrange =============================== + +$.views.tags({mytag: { + contentCtx: function(val) { + return this.tagCtx.view; + } +}}, tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl.render("outer"), " parentA parentB parentC", 'contentCtx returns this.tagCtx.view - context is parentView.data'); + + // =============================== Arrange =============================== + +$.views.tags({mytag: { + contentCtx: function(val) { + return this.tagCtx.view.data; + } +}}, tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl.render("outer"), " parentA parentB parentC", 'contentCtx returns this.tagCtx.view.data - context is parentView.data'); + + // =============================== Arrange =============================== + +$.views.tags({mytag: { + contentCtx: function(val) { + return this.tagCtxs[0].args[this.tagCtx.index]; + } +}}, tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl.render("outer"), " arg1A arg2B arg3C", 'contentCtx returns arg from first tagCtx indexed on else - context is arg1/arg2/arg3'); + + // =============================== Arrange =============================== + + tmpl = $.templates("{{for 'outerparent'}}{{for 'parent'}}{{mytag 'arg1' 'arg2' 'arg3'}} {{:#data}}A{{else 'elseArg1'}} {{:#data}}B{{else}} {{:#data}}C{{/mytag}}{{/for}}{{/for}}"); + +$.views.tags({mytag: { + contentCtx: function(val) { + return this.tagCtx.view.parent; + } +}}, tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl.render("outer"), " outerparentA outerparentB outerparentC", 'contentCtx returns this.tagCtx.view.parent'); + +}); + +})(); diff --git a/test/unit-tests/tests-jsrender-no-jquery.js b/test/unit-tests/tests-jsrender-no-jquery.js index fedddf5..86524ae 100644 --- a/test/unit-tests/tests-jsrender-no-jquery.js +++ b/test/unit-tests/tests-jsrender-no-jquery.js @@ -4,7 +4,6 @@ var global = (0, eval)('this'), // jshint ignore:line - isIE8 = global.attachEvent && !global.addEventListener, isBrowser = !!global.document, $ = global.jsrender || global.jQuery; // On Node.js with QUnit, jsrender is added as namespace, to global @@ -550,7 +549,6 @@ QUnit.test("{{for start end sort filter reverse}}", function(assert) { assert.equal($.templates("{{for myarray sort=true}}{{:}} {{/for}}").render({myarray: myarray}), "1 2 3 4 5 6 7 8 9 ", "{{for myarray sort=true}}"); assert.equal($.templates("{{for myarray sort=true reverse=true}}{{:}} {{/for}}").render({myarray: myarray}), "9 8 7 6 5 4 3 2 1 ", "{{for myarray sort=true reverse=true}}"); -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{for myarray filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 9 3 7 5 ", "{{for myarray filter=~oddValue}}"); assert.equal($.templates("{{for myarray filter=~oddIndex}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 8 7 6 ", "{{for myarray filter=~oddIndex}}"); assert.equal($.templates("{{for myarray sort=true filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 3 5 7 9 ", "{{for myarray sort=true filter=~oddValue}}"); @@ -558,7 +556,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=1 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "4 6 ", "{{for myarray sort=true filter=~oddIndex start=1 end=3}}"); assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=-3 end=-1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "4 6 ", "{{for myarray sort=true filter=~oddIndex start=-3 end=-1}} Negative start or end count from the end"); assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=3 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "", "{{for myarray sort=true filter=~oddIndex start=3 end=3}} (outputs nothing)"); -} + assert.equal($.templates("{{for myarray step=2 start=1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 8 7 6 ", "{{for myarray step=2 start=1}}"); assert.equal($.templates("{{for myarray sort=true step=2 start=1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "2 4 6 8 ", "{{for myarray sort=true step=2 start=1}}"); assert.equal($.templates("{{for myarray sort=true step=2 start=3 end=6}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "4 6 ", "{{for myarray sort=true step=2 start=3 end=6}}"); @@ -585,14 +583,13 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that assert.equal($.templates("{{for mypeople sort='details.age'}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}), "Xavier: age 0 - Julia: age 0.6 - Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - ", "{{for mypeople sort='details.age'}}"); -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~underLimit limit=20}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Jeff: age 13.5 - Emma: age 12 - Bob: age 2 - Julia: age 0.6 - Xavier: age 0 - ", "{{for mypeople sort='details.age' reverse=true filter=~underLimit...}}"); assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{for mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{for mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); -} + // =============================== Arrange =============================== var mypeople2 = [ @@ -631,10 +628,8 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that // ................................ Assert .................................. -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{for2 mypeople sort='details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for2}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{for2 mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}} Derived tag"); -} }); QUnit.module("{{props}}"); @@ -705,7 +700,6 @@ QUnit.test("{{props start end sort filter reverse}}", function(assert) { assert.equal($.templates("{{props myobject start=1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "b 9 - c 2 - d 8 - A 3 - B 7 - C 4 - D 6 - e 5 - ", "{{props myobject start=1}}"); assert.equal($.templates("{{props myobject end=-1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "a 1 - b 9 - c 2 - d 8 - A 3 - B 7 - C 4 - D 6 - ", "{{props myobject end=-1}}"); -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{props myobject filter=~oddValue}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddValue: oddValue}), "a 1 - b 9 - A 3 - B 7 - e 5 - ", "{{props myobject filter=~oddValue}}"); assert.equal($.templates("{{props myobject filter=~oddIndex}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "b 9 - d 8 - B 7 - D 6 - ", "{{props myobject filter=~oddIndex}}"); assert.equal($.templates("{{props myobject sort='prop' filter=~oddValue}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddValue: oddValue}), "a 1 - A 3 - e 5 - B 7 - b 9 - ", "{{props myobject sort='prop' filter=~oddValue}}"); @@ -713,7 +707,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that assert.equal($.templates("{{props myobject sort='prop' filter=~oddIndex start=1 end=3}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "C 4 - D 6 - ", "{{props myobject sort='prop' filter=~oddIndex start=1 end=3}}"); assert.equal($.templates("{{props myobject sort='prop' filter=~oddIndex start=-3 end=-1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "C 4 - D 6 - ", "{{props myobject sort='prop' filter=~oddIndex start=-3 end=-1}} Negative start or end count from the end"); assert.equal($.templates("{{props myobject sort='prop' filter=~oddIndex start=3 end=3}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "", "{{props myobject sort='key' filter=~oddIndex start=3 end=3}} (outputs nothing)"); -} + assert.equal($.templates("{{props myobject step=2 start=1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "b 9 - d 8 - B 7 - D 6 - ", "{{props myobject step=2 start=1}}"); assert.equal($.templates("{{props myobject sort='prop' step=2 start=1}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "c 2 - C 4 - D 6 - d 8 - ", "{{props myobject sort='prop' step=2 start=1}}"); assert.equal($.templates("{{props myobject sort='prop' step=2 start=3 end=6}}{{:key}} {{:prop}} - {{/props}}").render({myobject: myobject}, {oddIndex: oddIndex}), "C 4 - D 6 - ", "{{props myobject sort='prop' step=2 start=3 end=6}}"); @@ -735,11 +729,10 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that assert.equal($.templates("{{props mypeople sort='prop.name'}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}), "Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - Julia: age 0.6 - Xavier: age 0 - ", "{{props mypeople sort='name'}}"); assert.equal($.templates("{{props mypeople sort='prop.details.age'}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}), "Xavier: age 0 - Julia: age 0.6 - Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - ", "{{props mypeople sort='details.age'}}"); -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{props mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Jeff: age 13.5 - Emma: age 12 - Bob: age 2 - Julia: age 0.6 - Xavier: age 0 - ", "{{props mypeople sort='details.age' reverse=true filter=~underLimit...}}"); assert.equal($.templates("{{props mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{props mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); assert.equal($.templates("{{props mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:prop.name}}: age {{:prop.details.age}} - {{/props}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{props mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}}"); -} + // =============================== Arrange =============================== var mypeople2 = { @@ -778,9 +771,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that // ................................ Assert .................................. -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{props2 mypeople sort='prop.details.age' reverse=true filter=~underLimit limit=20 start=1 end=-1}}{{:prop.name}}: age {{:prop.details.age}} - {{/props2}}").render({mypeople: mypeople}, {underLimit: underLimit}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{for2 mypeople sort='details.age' reverse=true filter=~underLimit... start=1 end=-1}} Derived tag"); -} }); QUnit.module("{{!-- --}}"); @@ -1252,7 +1243,7 @@ QUnit.test("templates", function(assert) { // ............................... Assert ................................. assert.equal(!$.templates["./test/templates/file/path.html"] && tmpl0.render({name: "Jo0"}), - isIE8 ? "\nServerRenderedTemplate_Jo0_B" : "ServerRenderedTemplate_Jo0_B", + "ServerRenderedTemplate_Jo0_B", "Compile server-generated template, without caching"); // ................................ Act .................................. @@ -1260,7 +1251,7 @@ QUnit.test("templates", function(assert) { // ............................... Assert ................................. assert.equal(tmpl1 !== tmpl0 && $.templates["./test/templates/file/path.html"] === tmpl1 && tmpl1.render({name: "Jo1"}), - isIE8 ? "\nServerRenderedTemplate_Jo1_B" : "ServerRenderedTemplate_Jo1_B", + "ServerRenderedTemplate_Jo1_B", "Compile server-generated template, and cache on file path"); // ................................ Act .................................. @@ -1268,7 +1259,7 @@ QUnit.test("templates", function(assert) { // ............................... Assert ................................. assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), - isIE8 ? "\nServerRenderedTemplate_Jo2_B" : "ServerRenderedTemplate_Jo2_B", + "ServerRenderedTemplate_Jo2_B", "Re-use cached server-generated template"); // ................................ Act .................................. @@ -1276,7 +1267,7 @@ QUnit.test("templates", function(assert) { // ............................... Assert ................................. assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.templates["./test/templates/file/path.html"] === tmpl1 && tmpl3.render({name: "Jo3"}), - isIE8 ? "\nServerRenderedTemplate_Jo3_B" : "ServerRenderedTemplate_Jo3_B", + "ServerRenderedTemplate_Jo3_B", "Recompile server-generated template, without caching"); // ................................ Reset ................................ diff --git a/test/unit-tests/tests-jsrender-with-jquery-withIE.js b/test/unit-tests/tests-jsrender-with-jquery-withIE.js new file mode 100644 index 0000000..429c106 --- /dev/null +++ b/test/unit-tests/tests-jsrender-with-jquery-withIE.js @@ -0,0 +1,456 @@ +/*global test, equal, module, ok*/ +(function(global, $, undefined) { +"use strict"; + +var isIE8 = window.attachEvent && !window.addEventListener; + +function sort(array) { + var ret = ""; + if (this.tagCtx.props.reverse) { + // Render in reverse order + for (var i = array.length; i; i--) { + ret += this.tagCtx.render(array[ i - 1 ]); + } + } else { + // Render in original order + ret += this.tmpl.render(array); + } + return ret; +} + +var person = {name: "Jo"}, + people = [{name: "Jo"},{name: "Bill"}], + towns = [{name: "Seattle"},{name: "Paris"},{name: "Delhi"}]; + +var tmplString = "A_{{:name}}_B"; + +QUnit.module("api"); + +QUnit.test("templates", function(assert) { + var tmplElem = document.getElementById("./test/templates/file/path.html"); + + // =============================== Arrange =============================== + $.removeData(tmplElem, "jsvTmpl"); // In case data has been set in a previous test + + // ................................ Act .................................. + var tmpl0 = $.templates({markup: "./test/templates/file/path.html"}); // Compile template but do not cache + + // ............................... Assert ................................. + assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), isIE8 ? "\nServerRenderedTemplate_Jo0_B" : "ServerRenderedTemplate_Jo0_B", "Compile server-generated template, without caching"); + + // ................................ Act .................................. + var tmpl1 = $.templates("./test/templates/file/path.html"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), isIE8 ? "\nServerRenderedTemplate_Jo1_B" : "ServerRenderedTemplate_Jo1_B", "Compile server-generated template, and cache on file path"); + + // ................................ Act .................................. + var tmpl2 = $.templates("./test/templates/file/path.html"); // Use cached template, accessed by path as key + + // ............................... Assert ................................. + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), isIE8 ? "\nServerRenderedTemplate_Jo2_B" : "ServerRenderedTemplate_Jo2_B", "Re-use cached server-generated template"); + + // ................................ Act .................................. + var tmpl3 = $.templates({markup: "./test/templates/file/path.html"}); // Re-compile template but do not cache. Leaved cached template. + + // ............................... Assert ................................. + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), isIE8 ? "\nServerRenderedTemplate_Jo3_B" : "ServerRenderedTemplate_Jo3_B", "Recompile server-generated template, without caching"); + + // ................................ Reset ................................ + delete $.data(tmplElem).jsvTmpl; + document.getElementById("./test/templates/file/path.html").removeAttribute("data-jsv-tmpl"); + + tmplElem = $("#myTmpl")[0]; + delete $.data(tmplElem).jsvTmpl; + tmplElem.removeAttribute("data-jsv-tmpl"); + + // ................................ Act .................................. + tmpl0 = $.templates({markup: "#myTmpl"}); // Compile template declared in script block, but do not cache + + // ............................... Assert ................................. + assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), isIE8 ? "\nA_Jo0_B" : "A_Jo0_B", "Compile template declared in script block, without caching"); + + // ................................ Act .................................. + tmpl1 = $.templates("#myTmpl"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); + + // ............................... Assert ................................. + assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), isIE8 ? "\nA_Jo1_B" : "A_Jo1_B", "Compile template declared in script block, and cache on file path"); + + // ................................ Act .................................. + tmpl2 = $.templates("#myTmpl"); // Use cached template, accessed by $.data(elem, "jsvTmpl") + + // ............................... Assert ................................. + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), isIE8 ? "\nA_Jo2_B" : "A_Jo2_B", "Re-use cached template declared in script block"); + + // ................................ Act .................................. + tmpl3 = $.templates({markup: "#myTmpl"}); // Re-compile template but do not cache. Leave cached template. + + // ............................... Assert ................................. + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), isIE8 ? "\nA_Jo3_B" : "A_Jo3_B", "Recompile template declared in script block, without caching"); + + // ................................ Reset ................................ + delete $.data(tmplElem).jsvTmpl; + tmplElem.removeAttribute("data-jsv-tmpl"); + + // =============================== Arrange =============================== + // ............................... Assert ................................. + assert.equal($.templates("#my_tmpl2").render(), isIE8 ? "\n' \" \\ \\' \\\"" : "' \" \\ \\' \\\"", "correct treatment of ' \" and ' in template declared in script block"); + + assert.equal($.templates("' \" \\ \\' \\\"").render(), "' \" \\ \\' \\\"", "correct treatment of ' \" and ' in template compiled from string"); + + $.templates("my_tmpl", tmplString); + assert.equal($.render.my_tmpl(person), "A_Jo_B", 'Compile a template and then render it: $.templates("my_tmpl", tmplString); $.render.my_tmpl(data);'); + + $.templates({myTmpl2: tmplString}); + assert.equal($.render.myTmpl2(person), "A_Jo_B", 'Compile and register templates: $.templates({"my_tmpl", tmplString, ...}); $.render.my_tmpl(data);'); + + assert.equal($.templates.myTmpl2.render(person), "A_Jo_B", 'Get named template: $.templates.my_tmpl.render(data);'); + + assert.equal($.templates(tmplString).render(person), "A_Jo_B", 'Compile without registering as named template: $.templates(tmplString).render(person);'); + + tmpl2 = $.templates("#my_tmpl"); + tmpl3 = $.templates("#my_tmpl"); + assert.equal(tmpl2 === tmpl3 && $.trim(tmpl2.render(person)), "A_Jo_B", 'var tmpl = $.templates("#my_tmpl"); returns compiled template for script element'); + + $.templates({ + my_tmpl3: { + markup: "#my_tmpl" + } + }); + + assert.equal($.render.my_tmpl3 === $.templates.my_tmpl3 && $.templates.my_tmpl3 !== tmpl2 && $.trim($.render.my_tmpl3(person)), "A_Jo_B", 'Named template for template object with selector: {markup: "#my_tmpl"}'); + + tmpl3 = $.templates("", { + markup: "#my_tmpl" + }); + assert.equal($.trim(tmpl3.render(person)), "A_Jo_B", 'Compile from template object with selector, without registering: {markup: "#my_tmpl"}'); + + var tmpl4 = $.templates({ + markup: "#my_tmpl" + }); + assert.equal($.trim(tmpl4.render(person)), "A_Jo_B", 'Compile from template object with selector, without registering: {markup: "#my_tmpl"}'); + + assert.equal($.templates("#my_tmpl"), $.templates("#my_tmpl"), '$.templates("#my_tmpl") caches compiled template, and does not recompile each time;'); + + assert.ok($.templates({markup: "#my_tmpl"}) !== $.templates({markup: "#my_tmpl"}), '$.templates({markup: "#my_tmpl" ...}) recompiles template, so as to merge additional options;'); + + assert.equal($.templates("", "#my_tmpl"), $.templates("#my_tmpl"), '$.templates("#my_tmpl") and $.templates("", "#my_tmpl") are equivalent'); + + var renamed = $.templates("renamed", "#my_tmpl"); + assert.ok(renamed === tmpl2 && renamed.tmplName === "renamed", '$.templates("renamed", "#my_tmpl") will rename the cached template'); + + $.templates({renamed2: "#my_tmpl"}); + assert.ok($.templates.renamed2 === tmpl2 && $.templates.renamed2.tmplName === "renamed2", '$.templates({renamed2: "#my_tmpl"}) will rename the cached template'); + + $.templates("cloned", {markup: "#my_tmpl"}); + assert.ok($.templates.cloned !== tmpl2 && $.templates.cloned.tmplName === "cloned", '$.templates("cloned", {markup: "#my_tmpl"}}) will clone the cached template'); + + $.templates({cloned2: {markup: "#my_tmpl"}}); + assert.ok($.templates.cloned2 !== tmpl2 && $.templates.cloned2.tmplName === "cloned2", '$.templates({cloned: {markup: "#my_tmpl"}}) will clone the cached template'); + + $.templates("my_tmpl", null); + assert.equal($.templates.my_tmpl, undefined, 'Remove a named template: $.templates("my_tmpl", null);'); + + $.templates({ + scriptTmpl: { + markup: "#my_tmpl", + debug:true + }, + tmplFromString: { + markup: "X_{{:name}}_Y", + debug:true + } + }); + assert.equal($.templates.tmplFromString.fn.toString().indexOf("debugger;") > 0 + && $.templates.scriptTmpl.fn.toString().indexOf("debugger;") > 0 + && $.templates.scriptTmpl({name: "Jo"}) + $.templates.tmplFromString({name: "Jo"}), isIE8 + ? "\nA_Jo_BX_Jo_Y" + : "A_Jo_BX_Jo_Y", + 'Debug a template: set debug:true on object'); + + // reset + $("#my_tmpl")[0].removeAttribute("data-jsv-tmpl"); + + delete $.templates.scriptTmpl; +}); + +QUnit.test("render", function(assert) { + assert.equal($.trim($("#my_tmpl").render(person)), "A_Jo_B", '$(tmplSelector).render(data);'); // Trimming because IE adds whitespace + + var tmpl3 = $.templates("my_tmpl4", tmplString); + + assert.equal($.render.my_tmpl4(person), "A_Jo_B", '$.render.my_tmpl(object);'); + assert.equal($.render.my_tmpl4(people), "A_Jo_BA_Bill_B", '$.render.my_tmpl(array);'); + + var tmplObject = $.templates.my_tmpl4; + assert.equal(tmplObject.render(people), "A_Jo_BA_Bill_B", 'var tmplObject = $.templates.my_tmpl; tmplObject.render(data);'); + + $.templates("my_tmpl5", "A_{{for}}inner{{:name}}content{{/for}}_B"); + assert.equal($.templates.my_tmpl5.tmpls[0].render(person), "innerJocontent", 'Nested template objects: $.templates.my_tmpl.tmpls'); + + $("#result").html(""); + assert.equal($("#tmpl").render([null,undefined,1], {foo:"foovalue"}, true), (isIE8 ? "\n" : "") + "Content012foovalue", 'render(array, helpers, true) renders an array without iteration, while passing in helpers'); + + $("#result").html(""); + assert.equal($("#tmpl").render([null, undefined, 1], true), (isIE8 ? "\n" : "") + "Content012", 'render(array, true) renders an array without iteration'); + $("#result").empty(); +}); + +QUnit.test("converters", function(assert) { + function loc(data) { + switch (data) {case "desktop": return "bureau"; } + } + $.views.converters({loc: loc}); + assert.equal($.templates("{{loc:#data}}:{{loc:'desktop'}}").render("desktop"), "bureau:bureau", "$.views.converters({loc: locFunction})"); + + $.views.converters("loc2", loc); + assert.equal($.views.converters.loc2 === loc, true, 'locFunction === $.views.converters.loc'); + + $.views.converters({loc2: null}); + assert.equal($.views.converters.loc2, undefined, 'Remove a registered converter: $.views.converters({loc: null})'); +}); + +QUnit.test("tags", function(assert) { + $.views.tags({sort1: sort}); + assert.equal($.templates("{{sort1 people reverse=true}}{{:name}}{{/sort1}}").render({people: people}), "BillJo", "$.views.tags({sort: sortFunction})"); + + $.views.tags("sort2", sort); + assert.equal($.views.tags.sort1.render === sort, true, 'sortFunction === $.views.tags.sort'); + + $.views.tags("sort2", null); + assert.equal($.views.tags.sort2, undefined, 'Remove a registered tag: $.views.tag({sor: null})'); +}); + +QUnit.test("helpers", function(assert) { + function concat() { + return "".concat.apply("", arguments); + } + + $.views.helpers({ + not: function(value) { + return !value; + }, + concat: concat + }); + assert.equal($.templates("{{:~concat(a, 'b', ~not(false))}}").render({a: "aVal"}), "aValbtrue", "$.views.helpers({concat: concatFunction})"); + + $.views.helpers({concat2: concat}); + + assert.equal($.views.helpers.concat === concat, true, 'concatFunction === $.views.helpers.concat'); + + $.views.helpers("concat2", null); + assert.equal($.views.helpers.concat2, undefined, 'Remove a registered helper: $.views.helpers({concat: null})'); +}); + +QUnit.test("template encapsulation", function(assert) { + $.templates({ + myTmpl6: { + markup: "{{sort reverse=true people}}{{:name}}{{/sort}}", + tags: { + sort: sort + } + } + }); + assert.equal($.render.myTmpl6({people: people}), "BillJo", '$.templates("my_tmpl", tmplObjWithNestedItems);'); +}); + +QUnit.test("$.views.viewModels", function(assert) { + // =============================== Arrange =============================== + var Constr = $.views.viewModels({getters: ["a", "b"]}); + // ................................ Act .................................. + var vm = Constr("a1 ", "b1 "); + var result = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + // ............................... Assert ................................. + assert.equal(result, "a1 b1 a2 b2 ", "viewModels, two getters, no methods"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: ["a", "b", "c"], extend: {add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + }}}); + // ................................ Act .................................. + vm = Constr("a1 ", "b1 ", "c1 "); + vm.add("before "); + result = vm.c(); + // ............................... Assert ................................. + assert.equal(result, "before a1 b1 c1 ", "viewModels, two getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({extend: {add: function(val) { + this.foo = val; + }}}); + // ................................ Act .................................. + vm = Constr(); + vm.add("before"); + result = vm.foo; + // ............................... Assert ................................. + assert.equal(result, "before", "viewModels, no getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: []}); + // ................................ Act .................................. + vm = Constr(); + result = JSON.stringify(vm); + // ............................... Assert ................................. + assert.equal(result, "{}", "viewModels, no getters, no methods"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + } + }); + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 "}); + + result = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + + // ............................... Assert ................................. + assert.equal(result, "a1 b1 a2 b2 ", "viewModels, two getters, no methods"); + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 "}); + + result = vm.a() + vm.b(); + + // ............................... Assert ................................. + assert.equal(result, "a3 b3 ", "viewModels merge, two getters, no methods"); + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + assert.equal(result, '{"a":"a3 ","b":"b3 "}', "viewModels unmap, two getters, no methods"); + + // =============================== Arrange =============================== + var viewModels = $.views.viewModels({ + T1: { + getters: ["a", {getter: "b"}, "c", "d", {getter: "e", type: undefined}, {getter: "f", type: null}, {getter: "g", type: "foo"}, {getter: "h", type: ""}] + } + }, {}); + // ................................ Act .................................. + vm = viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 ", d: "d1 ", e: "e1 ", f: "f1 ", g: "g1 ", h: "h1 "}); + result = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + vm.a("a2 "); + vm.b("b2 "); + result += vm.a() + vm.b(); + // ............................... Assert ................................. + assert.equal(result, "a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 ", + "viewModels, multiple unmapped getters, no methods"); + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 ", d: "d3 ", e: "e3 ", f: "f3 ", g: "g3 ", h: "h3 "}); + + result = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + + // ............................... Assert ................................. + assert.equal(result, "a3 b3 c3 d3 e3 f3 g3 h3 ", + "viewModels merge, multiple unmapped getters, no methods"); + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + assert.equal(result, '{"a":"a3 ","b":"b3 ","c":"c3 ","d":"d3 ","e":"e3 ","f":"f3 ","g":"g3 ","h":"h3 "}', + "viewModels unmap, multiple unmapped getters, no methods"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b", "c"], + extend : { + add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + } + } + } + }); + + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 "}); + + vm.add("before "); + result = vm.c(); + + // ............................... Assert ................................. + assert.equal(result, "before a1 b1 c1 ", "viewModels, getters and one method"); + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 "}); + vm.add("updated "); + result = vm.c(); + + // ............................... Assert ................................. + assert.equal(result, "updated a3 b3 c3 ", "viewModels merge, getters and one method"); + + // ................................ Act .................................. + result = vm.unmap(); + result = JSON.stringify(result); + + // ............................... Assert ................................. + assert.equal(result, '{"a":"a3 ","b":"b3 ","c":"updated a3 b3 c3 "}', "viewModels unmap, getters and one method"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + }, + T2: { + getters: [{getter: "t1", type: "T1"}, {getter: "t1Arr", type: "T1"}, {getter: "t1OrNull", type: "T1", defaultVal: null}] + } + }); + viewModels = $.views.viewModels; + // ................................ Act .................................. + var t1 = viewModels.T1.map({a: "a1 ", b: "b1 "}); // Create a T1 + var t2 = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: [t1.unmap(), {a: "a2 ", b: "b2 "}]}); // Create a T2 (using unmap to scrape values the T1: vm) + + result = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t2.t1Arr()[0].merge({a: "a1x ", b: "b1x "}); // merge not the root, but a VM instance within hierarchy: vm2.t1Arr()[0] - leaving rest unchanged + result = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1x ","b":"b1x "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, merge deep node"); + + // ................................ Act .................................. + var t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + var t2FromArr = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + result = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + t1Arr.push(viewModels.T1("a3 ", "b3 ")); + t2FromArr = viewModels.T2.map({t1: {a: "a4 ", b: "b4 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + result = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a4 ","b":"b4 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "},{"a":"a3 ","b":"b3 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + var t2new= viewModels.T2(viewModels.T1("a3 ", "b3 "), [viewModels.T1("a1 ", "b1 "), viewModels.T1("a2 ", "b2 ")], viewModels.T1("a4 ", "b4 ")); + result = JSON.stringify(t2new.unmap()); + + // ............................... Assert ................................. + assert.equal(result, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":{"a":"a4 ","b":"b4 "}}', + "viewModels, hierarchy"); +}); + +})(this, this.jQuery); diff --git a/test/unit-tests/tests-jsrender-with-jquery.js b/test/unit-tests/tests-jsrender-with-jquery.js index 429c106..459f766 100644 --- a/test/unit-tests/tests-jsrender-with-jquery.js +++ b/test/unit-tests/tests-jsrender-with-jquery.js @@ -2,8 +2,6 @@ (function(global, $, undefined) { "use strict"; -var isIE8 = window.attachEvent && !window.addEventListener; - function sort(array) { var ret = ""; if (this.tagCtx.props.reverse) { @@ -36,25 +34,25 @@ QUnit.test("templates", function(assert) { var tmpl0 = $.templates({markup: "./test/templates/file/path.html"}); // Compile template but do not cache // ............................... Assert ................................. - assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), isIE8 ? "\nServerRenderedTemplate_Jo0_B" : "ServerRenderedTemplate_Jo0_B", "Compile server-generated template, without caching"); + assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), "ServerRenderedTemplate_Jo0_B", "Compile server-generated template, without caching"); // ................................ Act .................................. var tmpl1 = $.templates("./test/templates/file/path.html"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); // ............................... Assert ................................. - assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), isIE8 ? "\nServerRenderedTemplate_Jo1_B" : "ServerRenderedTemplate_Jo1_B", "Compile server-generated template, and cache on file path"); + assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), "ServerRenderedTemplate_Jo1_B", "Compile server-generated template, and cache on file path"); // ................................ Act .................................. var tmpl2 = $.templates("./test/templates/file/path.html"); // Use cached template, accessed by path as key // ............................... Assert ................................. - assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), isIE8 ? "\nServerRenderedTemplate_Jo2_B" : "ServerRenderedTemplate_Jo2_B", "Re-use cached server-generated template"); + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), "ServerRenderedTemplate_Jo2_B", "Re-use cached server-generated template"); // ................................ Act .................................. var tmpl3 = $.templates({markup: "./test/templates/file/path.html"}); // Re-compile template but do not cache. Leaved cached template. // ............................... Assert ................................. - assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), isIE8 ? "\nServerRenderedTemplate_Jo3_B" : "ServerRenderedTemplate_Jo3_B", "Recompile server-generated template, without caching"); + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), "ServerRenderedTemplate_Jo3_B", "Recompile server-generated template, without caching"); // ................................ Reset ................................ delete $.data(tmplElem).jsvTmpl; @@ -68,25 +66,25 @@ QUnit.test("templates", function(assert) { tmpl0 = $.templates({markup: "#myTmpl"}); // Compile template declared in script block, but do not cache // ............................... Assert ................................. - assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), isIE8 ? "\nA_Jo0_B" : "A_Jo0_B", "Compile template declared in script block, without caching"); + assert.equal(!$.data(tmplElem).jsvTmpl && tmpl0.render({name: "Jo0"}), "A_Jo0_B", "Compile template declared in script block, without caching"); // ................................ Act .................................. tmpl1 = $.templates("#myTmpl"); // Compile and cache, using $.data(elem, "jsvTmpl", tmpl); // ............................... Assert ................................. - assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), isIE8 ? "\nA_Jo1_B" : "A_Jo1_B", "Compile template declared in script block, and cache on file path"); + assert.equal(tmpl1 !== tmpl0 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl1.render({name: "Jo1"}), "A_Jo1_B", "Compile template declared in script block, and cache on file path"); // ................................ Act .................................. tmpl2 = $.templates("#myTmpl"); // Use cached template, accessed by $.data(elem, "jsvTmpl") // ............................... Assert ................................. - assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), isIE8 ? "\nA_Jo2_B" : "A_Jo2_B", "Re-use cached template declared in script block"); + assert.equal(tmpl2 === tmpl1 && tmpl1.render({name: "Jo2"}), "A_Jo2_B", "Re-use cached template declared in script block"); // ................................ Act .................................. tmpl3 = $.templates({markup: "#myTmpl"}); // Re-compile template but do not cache. Leave cached template. // ............................... Assert ................................. - assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), isIE8 ? "\nA_Jo3_B" : "A_Jo3_B", "Recompile template declared in script block, without caching"); + assert.equal(tmpl3 !== tmpl0 && tmpl3 !== tmpl1 && $.data(tmplElem).jsvTmpl === tmpl1 && tmpl3.render({name: "Jo3"}), "A_Jo3_B", "Recompile template declared in script block, without caching"); // ................................ Reset ................................ delete $.data(tmplElem).jsvTmpl; @@ -94,7 +92,7 @@ QUnit.test("templates", function(assert) { // =============================== Arrange =============================== // ............................... Assert ................................. - assert.equal($.templates("#my_tmpl2").render(), isIE8 ? "\n' \" \\ \\' \\\"" : "' \" \\ \\' \\\"", "correct treatment of ' \" and ' in template declared in script block"); + assert.equal($.templates("#my_tmpl2").render(), "' \" \\ \\' \\\"", "correct treatment of ' \" and ' in template declared in script block"); assert.equal($.templates("' \" \\ \\' \\\"").render(), "' \" \\ \\' \\\"", "correct treatment of ' \" and ' in template compiled from string"); @@ -163,9 +161,7 @@ QUnit.test("templates", function(assert) { }); assert.equal($.templates.tmplFromString.fn.toString().indexOf("debugger;") > 0 && $.templates.scriptTmpl.fn.toString().indexOf("debugger;") > 0 - && $.templates.scriptTmpl({name: "Jo"}) + $.templates.tmplFromString({name: "Jo"}), isIE8 - ? "\nA_Jo_BX_Jo_Y" - : "A_Jo_BX_Jo_Y", + && $.templates.scriptTmpl({name: "Jo"}) + $.templates.tmplFromString({name: "Jo"}), "A_Jo_BX_Jo_Y", 'Debug a template: set debug:true on object'); // reset @@ -189,10 +185,10 @@ QUnit.test("render", function(assert) { assert.equal($.templates.my_tmpl5.tmpls[0].render(person), "innerJocontent", 'Nested template objects: $.templates.my_tmpl.tmpls'); $("#result").html(""); - assert.equal($("#tmpl").render([null,undefined,1], {foo:"foovalue"}, true), (isIE8 ? "\n" : "") + "Content012foovalue", 'render(array, helpers, true) renders an array without iteration, while passing in helpers'); + assert.equal($("#tmpl").render([null,undefined,1], {foo:"foovalue"}, true), "Content012foovalue", 'render(array, helpers, true) renders an array without iteration, while passing in helpers'); $("#result").html(""); - assert.equal($("#tmpl").render([null, undefined, 1], true), (isIE8 ? "\n" : "") + "Content012", 'render(array, true) renders an array without iteration'); + assert.equal($("#tmpl").render([null, undefined, 1], true), "Content012", 'render(array, true) renders an array without iteration'); $("#result").empty(); }); diff --git a/test/unit-tests/tests-jsviews-withIE.js b/test/unit-tests/tests-jsviews-withIE.js new file mode 100644 index 0000000..76255a2 --- /dev/null +++ b/test/unit-tests/tests-jsviews-withIE.js @@ -0,0 +1,23395 @@ +/*global test, equal, module, ok, _jsv, viewsAndBindings*/ +(function(global, $, undefined) { +"use strict"; + +/* Setup */ +var inputOrKeydownContentEditable, + isIE8 = window.attachEvent && !window.addEventListener, + isIE = window.navigator.userAgent, + useInput = "oninput" in document, + inputOrKeydown = useInput ? "input" : "keydown"; + + isIE = isIE.indexOf('MSIE ') > 0 || isIE.indexOf('Trident/') > 0; + inputOrKeydownContentEditable = isIE ? "keydown" : "input"; + +function keydown(elem) { + if (useInput) { + elem.trigger("input"); + } else { + elem.keydown(); + } +} + +// =============== Model =============== +function fullName(reverse, upper) { + var name = reverse ? (this.lastName + " " + this.firstName()) : this.firstName() + " " + this.lastName; + return upper ? name.toUpperCase() : name; +} + +fullName.depends = function(object) { // object is also the this pointer, so we could write function(this) below + return [ + "firstName", + function(object) { + return "lastName"; + } + ]; +}; + +fullName.set = function(val) { + val = val.split(" "); + $.observable(this).setProperty({ + lastName: val.pop(), + firstName: val.join(" ") + }); +}; + +var Person = function(first, last, home) { + this._firstName = first; + this.lastName = last; + this.home = home; +}, + + personProto = { + firstName: function() { + return settings.title + " " + this._firstName; + }, + fullName: fullName + }; + +personProto.firstName.set = function(val) { + this._firstName = val; +}; + +Person.prototype = personProto; + +function updown(val, lower) { + lower = this.tagCtx.props.lower !== undefined ? this.tagCtx.props.lower : lower; + val = person1.firstName() + (val || ""); + return (lower === true ? val.toLowerCase() : val.toUpperCase()) + settings.width + this.tagCtx.props.added; +} + +function sort(array) { + var ret = ""; + if (this.tagCtx.props.reverse) { + // Render in reverse order + if (arguments.length > 1) { + for (i = arguments.length; i; i--) { + ret += sort.call(this, arguments[i - 1]); + } + } else for (var i = array.length; i; i--) { + ret += this.tagCtx.render(array[i - 1]); + } + } else { + // Render in original order + ret += this.tagCtx.render(array); + } + return ret; +} + +// =============== DATA =============== + +var address1 = {street: "StreetOne", ZIP: "111"}, + address2 = {street: "StreetTwo", ZIP: "222"}, + home1 = {address: address1}, + home2 = {address: address2}, + homeOfOwner = {address: {street: "OwnerStreet"}}, + person1 = new Person("Jo", "One", home1), + person2 = new Person("Xavier", "Two", home2), + + settings = { + owner: new Person("Mr", "Owner", homeOfOwner), + width: 30, + reverse: true, + upper: updown, + title: "Mr" + }, + + model = { + person1: person1, + person2: person2, + things: [] + }, + + people = [person1, person2]; + +personProto.firstName.depends = [settings, "title"]; + +updown.depends = function() { + return [person1, "firstName", "~settings.width"]; +}; + +// =============== RESOURCES =============== + +var cancelChange = false, + noRenderOnUpdate = true, + renders = false, + cancelUpdate = false, + eventData = ""; + +$.views + .converters({ + upper_: updown, + cvtBack: function(val) { + return val; + } + }) + .helpers({ + settings: settings, + upper: updown + }) + .tags({ + tmplTag: { + template: "Name: {{:firstName()}}. Width: {{:~settings.width}}", + depends: ["firstName", "~settings.width"] + }, + fnTag: { + render: function() { + return "Name: " + this.tagCtx.view.data.firstName() + ". Width: " + this.ctxPrm("settings").width; + }, + depends: ["firstName", "~settings.width"] + }, + fnTagElNoInit: function() { + return "Name: " + this.tagCtx.view.data.firstName() + ". Width: " + this.ctxPrm("settings").width + ""; + }, + tmplTagEl: { + template: "Name: {{:firstName()}}. Width: {{:~settings.width}}", + depends: ["firstName", "~settings.width"] + }, + fnTagEl: { + render: function() { + return "Name: " + this.tagCtx.view.data.firstName() + ". Width: " + this.ctxPrm("settings").width + ""; + }, + depends: ["firstName", "~settings.width"] + }, + fnTagElCnt: { + render: function() { + return "
  • Name: " + this.tagCtx.view.data.firstName() + ". Width: " + this.ctxPrm("settings").width + "
  • "; + }, + depends: ["firstName", "~settings.width"] + }, + fnTagElCntNoInit: function() { + return "
  • Name: " + this.tagCtx.view.data.firstName() + ". Width: " + this.ctxPrm("settings").width + "
  • "; + }, + fnTagWithProps: { + render: function(data, val) { + return "Name: " + this.tagCtx.view.data.firstName() + ". Width: " + this.ctxPrm("settings").width + ". Value: " + val + + ". Prop theTitle: " + this.tagCtx.props.theTitle + ". Prop ~street: " + this.ctxPrm("street"); + }, + depends: ["firstName", "~settings.width"] + }, + tmplTagWithProps: { + render: function(val) { + this.ctxPrm("theTitle", this.tagCtx.props.theTitle); + }, + template: "Name: {{:firstName()}}. Width: {{:~settings.width}}. Value: {{:~settings.reverse}}. " + + "Prop theTitle: {{dbg:~theTitle}}. Prop ~street: {{:~street}}", + depends: ["firstName", "~settings.width"] + }, + twoWayTag: { + init: function(tagCtx, linkCtx, ctx) { + eventData += "init "; + if (this.inline && !tagCtx.content) { + this.template = ""; + } + }, + render: function(val) { + eventData += "render "; + return renders ? (val + ' rendered') : undefined; + }, + onAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onAfterLink "; + this.value = tagCtx.args[0]; + }, + onBeforeUpdateVal: function(ev, eventArgs) { + eventData += "onBeforeUpdateVal "; + return !cancelUpdate; + }, + onUpdate: function(ev, eventArgs, newTagCtxs) { + eventData += "onUpdate "; + return !noRenderOnUpdate; + }, + onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onBind "; + this.linkedElem = this.linkedElem || (this.inline ? this.contents("input,div") : $(linkCtx.elem)); + }, + onUnbind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + this.linkedElem = undefined; // remove, so newly rendered linkedElem gets created in onBind + eventData += "onUnbind "; + }, + onBeforeChange: function(ev, eventArgs) { + eventData += "onBeforeChange "; + return !cancelChange; + }, + onAfterChange: function(ev, eventArgs) { + eventData += "onAfterChange "; + }, + onDispose: function() { + eventData += "onDispose "; + } + } + }); + +var topData = {people: people}; +$.views.tags({ + myWrap: { + init: function(tc) { + var test = tc.props.val; + } + }, + myWrap2: {}, + mySimpleWrap: function(val) { + return this.tagCtx.render(val); + }, + myFlow: { + flow: true + }, + myFlow2: { + flow: true, + template: "flow2" + }, + myWrapElCnt: { + attr: "html", + render: function(val) { + return "" + this.tagCtx.render(val) + ""; + }, + onAfterLink: function() { + //debugger; + } + }, + myWrap2ElCnt: { + attr: "html", + render: function(val) { + return "" + this.tagCtx.render(val) + ""; + }, + onAfterLink: function() { + //debugger; + } + }, + myFlowElCnt: { + attr: "html", + flow: true, + render: function(val) { + return "" + this.tagCtx.render(val) + ""; + } + } +}); + +$.templates({ + + tmplHierarchy: + + '{{for people ~val=1}}' + + '{{if true ~index=#index}}' + + '{{myWrap val=1}}' + + '' + + 'a' + + '{{myWrap2}}' + + '{{if true}}xx{{/if}}' + + '{{/myWrap2}}' + + '{{if true}}' + + '{{myWrap2}}' + + '{{if true}}xx{{/if}}' + + '{{/myWrap2}}' + + '{{/if}}' + + '{{if true}}' + + 'yy' + + '{{/if}}' + + '{{myFlow}}' + + 'zz' + + '{{if true}}' + + '{{myFlow2/}}' + + '{{/if}}' + + '{{/myFlow}}' + + '' + + '{{/myWrap}}' + + '{{myWrap val=2/}}' + + '{{/if}}' + + 'www' + + '{{/for}}', + + tmplHierarchyElCnt: + + '{{for people ~val=1}}' + + '{{if true ~index=#index}}' + + '{{myWrapElCnt val=1}}' + + '' + + '{{myWrap2ElCnt}}' + + 'xx' + + '{{/myWrap2ElCnt}}' + + '{{if true}}' + + '{{myWrap2ElCnt}}' + + 'xx' + + '{{/myWrap2ElCnt}}' + + '{{/if}}' + + '{{if true}}' + + '' + + '{{/if}}' + + '{{myFlowElCnt}}' + + 'xx' + + '{{if true}}' + + '{{myFlow2/}}' + + '{{/if}}' + + '{{/myFlowElCnt}}' + + '' + + '{{/myWrapElCnt}}' + + '{{myWrapElCnt val=2/}}' + + '33' + + '{{/if}}' + + '{{/for}}
    yy
    ', + + boundTmplHierarchy: + + '{{for people ~val=1}}' + + '{{if true ~index=#index}}' + + 'aa{^{myWrap val=1}}inside' + + '' + + 'a' + + '{^{myWrap2}}' + + '{{if true}}xx{{/if}}' + + '{^{myFlow val=3}}xyz{{/myFlow}}' + + '{{/myWrap2}}' + + '{^{if true}}' + + '{^{myWrap2}}' + + '{{if true}}xx{{/if}}' + + '{^{myFlow val=3}}xyz{{/myFlow}}' + + '{{/myWrap2}}' + + '{{/if}}' + + '{{if true}}' + + 'yy' + + '{{/if}}' + + '{^{myFlow val=4}}' + + 'zz' + + '{{/myFlow}}' + + '' + + '{{/myWrap}}' + + 'bb{^{myWrap val=2/}}' + + 'cc{{myWrap val=3 "this is unbound"/}}' + + '{{/if}}' + + '
    ' + + '{^{mySimpleWrap val=5}}' + + '{^{mySimpleWrap val=6}}' + + '{^{myWrap2 val=7/}}' + + '{{/mySimpleWrap}}' + + '{{/mySimpleWrap}}' + + '' + + '{^{myWrap2 val=8/}}' + + '
    ' + + 'www' + + '{{/for}}', + + boundTmplHierarchyElCnt: + + '{{for people ~val=1}}' + + '{{if true ~index=#index}}' + + '{^{myWrapElCnt val=1}}' + + '' + + '{^{myWrap2ElCnt val=11}}' + + 'xx' + + '{^{myFlow val=3}}xyz{{/myFlow}}{^{mySimpleWrap val=5/}}' + + '{{/myWrap2ElCnt}}' + + '{^{if true}}' + + '{^{myWrap2ElCnt val=22}}' + + 'xx' + + '{^{myFlow val=3}}xyz{{/myFlow}}' + + '{{/myWrap2ElCnt}}' + + '{{/if}}' + + '{{if true}}' + + '' + + '{{/if}}' + + '{^{myFlowElCnt val=4}}' + + 'xx' + + '{{/myFlowElCnt}}' + + '' + + '{{/myWrapElCnt}}' + + '{^{myWrapElCnt val=2/}}' + + '{{myWrapElCnt "this is unbound"/}}' + + '{{/if}}' + + '' + + '{^{mySimpleWrap val=5}}' + + '{^{mySimpleWrap val=6}}' + + '{^{myWrap2 val=7/}}' + + '{{/mySimpleWrap}}' + + '{{/mySimpleWrap}}' + + '' + + '{^{myWrap2ElCnt val=8/}}' + + '' + + '{{/for}}
    yy
    ', + + boundTmplHierarchyElCntWithDataLink: '
    ', + + wrapCnt: '', + + innerWrap: 'xx' +}); + +// =============== INIT APP =============== + +var viewContent, before, after, lastEvData, lastEventArgs, listeners, handlersCount, elems, + res = "", + calls = 0; + +function reset() { + res = ""; + calls = 0; +} + +// End Setup + +//test("TEST", function() { +//}); +//return; +QUnit.module("Template structure"); + +QUnit.test("Template validation", function(assert) { + + $.views.settings.advanced({_jsv: true}); // For using window._jsv + + // =============================== Arrange =============================== + $.templates('
    {{if 1}}X{{:a}}{{/if}}
    ') + .link("#result", {a: "yes"}); + + // ............................... Assert ................................. + assert.ok($("#result div").text() === "Xyes" && $("#result div").prop("title") === "yes", "Tag markup works within element content, or within element markup, for non element-only elements (
    )"); + + // =============================== Arrange =============================== + $.templates('
    • {{if 1}}X{{:a}}{{/if}}
    ') + .link("#result", {a: "yes"}); + + // ............................... Assert ................................. + assert.ok($("#result ul").text() === "Xyes" && $("#result ul").prop("title") === "yes", "Tag markup works within element content, or within element markup, for element-only elements (
      )"); + + // =============================== Arrange =============================== + try { + $.templates('' + + 'xy' + + '
      xy{{:thing}}
      ') + .link("#result", {width: "3em", path: "M250 0 L75 200 L225 200 Z", thing: "egg"}); + res = $("#result").text(); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "xyxyegg", "Validation - self-closing tags are allowed within svg or math content (foreign elements)"); + res = ""; + + // =============================== Arrange =============================== + try { + var tmpl = $.templates('{{for things}}{{/for}}
      }{{:thing}}
      '); // throws syntax error + tmpl.link("#result", {things: [{thing: "Orig"}]}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Parent of must be "), 0, "Validation - missing closing tag"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
      {{:thing}}
      ') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\nMismatch: '
    '"), 0, "Validation - missing closing tag"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    {{:Thing}}
    ') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\nMismatch: ''"), 0, "Validation - missing opening tag"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('{{:Thing}}') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\nMismatch: ''"), 0, "Validation - extra closing tag"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('{{:Thing}}') + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\nMismatch: ''"), 0, "Validation - extra closing tag"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    {{:Thing}}
    ') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\n''"), 0, "Validation - self-closing tag is not a void element"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    {{:Thing}}') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\nMismatched ''"), 0, "Validation - missing closing tag"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    {{:Thing}}') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\nMismatch: ''"), 0, "Validation - missing opening tag"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    ') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\n''"), 0, "Validation - self-closing tag is not a void element"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    {{:Thing}}
    ') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res.indexOf("Syntax error\n''"), 0, "Validation - closing tag for a void element"); + res = ""; + + // =============================== Arrange =============================== + $.templates('prop:

    ' + + '{{if true}}{{/if}}
    ') + .link("#result", person1); + // ................................ Act .................................. + res = $("#result input")[0].value + $("#result input")[1].value; + + $.observable(person1).setProperty("lastName", "Two"); + res += $("#result input")[0].value + $("#result input")[1].value; + + // ............................... Assert ................................. + assert.equal(res, "OneOneTwoTwo", "Validation - void elements can have self-close slashes, or not..."); + res = ""; + + // =============================== Arrange =============================== + var markupData = {markup: ""}; + $.templates('{^{:markup}}') + .link("#result", markupData); + + // ................................ Act .................................. + res = "" + ($("#result").html().indexOf(isIE8 ? "": "")>60); + + $.observable(markupData).setProperty("markup", "

    "); + res += "|" + ($("#result").html().indexOf(isIE8 ? "

    ": "

    ")>60); + + // ............................... Assert ................................. + assert.equal(res, "true|true", "Validation - void elements inserted from data can have self-close slashes, or not..."); + res = ""; + + // =============================== Arrange =============================== + $.templates('') + .link("#result", {lastName: "Blow"}); + + // ............................... Assert ................................. + assert.equal($("#result #last").val(), "Blow", + "{{if}} is supported within markup even when data-linking"); + res = ""; + + // =============================== Arrange =============================== + $.templates(' {{else}}/>{{/if}}') + .link("#result", {lastName: "Blow"}); + + // ............................... Assert ................................. + assert.equal($("#result #last").val(), "Blow", + "{{if}} wrapping closing delimiter of markup is supported even when data-linking"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('') // throws syntax error + .link("#result", {lastName: "Blow"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "Syntax error\n{^{ within elem markup ( {{else}}/>{{/if}}') // throws syntax error + .link("#result", {lastName: "Blow"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "Syntax error\n{^{ within elem markup ( markup"); + + // =============================== Arrange =============================== + try { + $.templates('a') + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "Syntax error\n{^{ within elem markup ( markup"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    a
    ') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "Syntax error\n{^{ within elem markup (
    a
    ') // does not throw syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "", + "Validation - {{:...}} within element markup is OK"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('
    a
    ') // does not throw syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "", + "Validation - {{attr:...}} within element markup is OK"); + res = ""; + + // =============================== Arrange =============================== + try { + $.templates('') // throws syntax error + .link("#result", {thing: "Orig"}); + } catch (e) { + res = e.message; + } + + // ............................... Assert ................................. + assert.equal(res, "Syntax error\n{:foo:}- Remove target: value", + "Validation - value{:foo:}"); + res = ""; + + // ................................ Reset ................................ + + person1.lastName = "One"; + // The syntax error exceptions thrown above meant some views were not fully linked. + // We will 'force remove' them from the viewStore, the top view children, and the bindingStore. + var v, viewstore = $.view().views; + for (v in viewstore) { + delete viewstore[v]; + } + viewstore = _jsv.views; + for (v in viewstore) { + if (v !== "0") { + delete viewstore[v]; + } + } + viewstore = _jsv.bindings; + for (v in viewstore) { + delete viewstore[v]; + } + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.module("data-link scenarios"); + +QUnit.test("jQuery cleanData integration", function(assert) { + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + $("#result").html(''); + $.link("lastName", "#inner", person1); + $("#inner").on("click", function() {}); + + // ................................ Act .................................. + res = $("#inner").html(); + $.observable(person1).setProperty("lastName", "last2"); + res += "|" + $("#inner").html(); + $("#inner").off("click"); + $.observable(person1).setProperty("lastName", "last3"); + res += "|" + $("#inner").html(); + + // ............................... Assert ................................. + assert.equal(res, + 'One|last2|last3', + 'Removing jQuery handlers does not remove views. (Issue https://github.com/BorisMoore/jsviews/issues/249)'); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + $("#result").empty(); + + // =============================== Arrange =============================== + $("#result").html(''); + $.link("lastName", "#inner", person1); + + // ................................ Act .................................. + res = $("#inner").html(); + $.observable(person1).setProperty("lastName", "last2"); + res += "|" + $("#inner").html(); + $("#inner").data('foo', 'bar').removeData('foo'); + $.observable(person1).setProperty("lastName", "last3"); + res += "|" + $("#inner").html(); + + // ............................... Assert ................................. + assert.equal(res, + 'One|last2|last3', + 'Adding and removing jQuery data does not remove views. (Issue https://github.com/BorisMoore/jsviews/issues/249)'); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + $("#result").empty(); + + // =============================== Arrange =============================== + $("#result").html(''); + $.link("lastName", "#inner", person1); + + // ................................ Act .................................. + res = $("#inner").html(); + $.observable(person1).setProperty("lastName", "last2"); + res += "|" + $("#inner").html(); + $.observable(person1).setProperty("lastName", "last3"); + res += "|" + $("#inner").html(); + + // ............................... Assert ................................. + assert.equal(res, + 'One|last2|last3', + 'Calling dequeue does not remove views. (Issue https://github.com/BorisMoore/jsviews/issues/249)'); + + // =============================== Arrange =============================== +$.views.settings.trigger(false); + +var tmpl1 = $.templates( + '' + + '
    • click me
    ' + + '' + + '
      {^{for things}}
    • inserted
    • {{/for}}
    ' +); + +var tmpl2 = $.templates( + '
  • ' + + '
  • click me
  • ' + + '
  • ' + + '{^{for things}}
  • inserted
  • {{/for}}' +), + +data = {name:"Jo", things:[]}, +clicked = 0, +helpers = { + clicked: function() { + clicked += 1; + } +}; + +$("#result").html( + '
    ' + + '' + + '
    • click me
    ' + + '' + + '
      ' + + +'
      ' + + '
        ' ++ '
        ' +); + +$.link(true, "#toclone .toplevel", data, helpers); + +tmpl1.link("#toclone .result", data, helpers); +tmpl2.link("#toclone .result2", data, helpers); + +var inputs = $("#result input"), + buttons = $("#result button"), + lis = $("#result .clickLi"); + + // ................................ Act .................................. +var cloned = $("#toclone").clone().removeAttr( 'id' ); +cloned.empty(); + +var res = $("#result").text(); + +$.observable(data.things).insert(1); + +res += "|" + $("#result").text(); + +$.observable(data).setProperty("name", "Bob"); + +res += "|" + $("#result").text(); + +$(inputs[0]).val("n0").change(); + +res += "|" + $("#result").text(); + +$(inputs[1]).val("n1").change(); + +res += "|" + $("#result").text(); + +$(inputs[2]).val("n2").change(); + +res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, + 'JoJoJoJoJoJo|' + + 'JoJoinsertedJoJoinsertedJoJoinserted|' + + 'BobBobinsertedBobBobinsertedBobBobinserted|' + + 'n0n0insertedn0n0insertedn0n0inserted|' + + 'n1n1insertedn1n1insertedn1n1inserted|' + + 'n2n2insertedn2n2insertedn2n2inserted', + 'Cloning data-linked content then emptying clone does not remove original data bindings. (Issue https://github.com/BorisMoore/jsviews/issues/369)'); + + // ................................ Act .................................. + +res = "" + clicked; + +$(buttons[0]).click(); +$(buttons[1]).click(); +$(buttons[2]).click(); +$(lis[0]).click(); +$(lis[1]).click(); +$(lis[2]).click(); + + // ............................... Assert ................................. +res += "|" + clicked; + + assert.equal(res, + '0|6', + 'Cloning data-linked content then emptying clone does not remove click handlers. (Issue https://github.com/BorisMoore/jsviews/issues/369)'); + +$.views.settings.trigger(true); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + $.unlink(); +}); + +QUnit.module("API - data-link"); + +QUnit.test("Basic $.link(expression, container, data) and $.link(tmpl, container, data)", function(assert) { + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + home1.address = address1; // reset Prop + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + $("#result").html(''); + $.link("lastName 44 a=3", "#inner", person1); + + // ................................ Act .................................. + before = $("#inner").html(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#inner").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One|newLast', + '$.link("fieldName", "#target", data) links field to content of target element (equivalent to data-link="fieldName")'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html(''); + $.link("person1.lastName + ' ' + person1.home.address^street", "#inner", model); + + // ................................ Act .................................. + before = $("#inner").html(); + $.observable(person1).setProperty("lastName", "newLast"); + $.observable(person1.home).setProperty("address", address2); // Using deep observability + after = $("#inner").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One StreetOne|newLast StreetTwo', + '$.link(expression, "#target", data) links expression to target element (equivalent to data-link="expression")'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events && !$._data(person1.home).events, + "$(container).empty removes current listeners from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + home1.address = address1; // reset Prop + + // =============================== Arrange =============================== + + var tmpl = $.templates("{^{:lastName}}"); + $.link(tmpl, "#result", person1); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One|newLast', + '$.link(template, "#container", data) links template to content of container (equivalent to template.link(container, data)'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + tmpl = $.templates("{^{for #data}}{^{:lastName}}{{/for}}"); + $.link(tmpl, "#result", person1); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One|newLast', + '$.link(template, "#container", data) links template to content of container (equivalent to template.link(container, data). Example 2.'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes both views and current listeners from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + $.unlink(); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("Top-level linking", function(assert) { + $.views.settings.advanced({_jsv: true}); // For using cbBindings store + + // =============================== Arrange =============================== + + $.views.helpers("a", " A"); + $("#result").html("
        "); + + // ............................... Act ................................. + $.link(true, "#result", {name: "Jo"}, {b: " B"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "Jo A B", 'Passing in data to top-level linking'); + + // ............................... Act ................................. + $.link(true, "#result div", {name: "Jo2"}, {b: " newB"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "Jo2 A newB", 'Top-level linking directly to the linked element'); + + // ................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Top level bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + $.views.helpers("a", " A"); + $.templates("inner", "{^{:name + ~a + ~b}}"); + $("#result").html("
        "); + + // ............................... Act ................................. + var data = {name: "Jo"}; + $.link(true, "#result", data, {b: " B"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "Jo A B", 'Top-level data-link="{include tmpl=...}" passes in model and context'); + + // ............................... Act ................................. + $.observable(data).setProperty("name", "JoChanged"); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "JoChanged A B", 'Top-level data-link="{include tmpl=...}" binds correctly within {{include}} template'); + + // ............................... Act ................................. + data = {name: "Jo2"}; + $.link(true, "#result", data, {b: " newB"}); + + // ............................... Assert ................................. + assert.equal($("#result div").text(), "Jo2 A newB", 'Top-level linking directly to the linked element with data-link="{include... '); + + // ............................... Act ................................. + $.observable(data).setProperty("name", "Jo2Changed"); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "Jo2Changed A newB", 'Top-level linking directly to the linked element with data-link="{include... binds correctly within {{include}} template'); + + // ................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Top level bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + $.views.helpers("a", " A"); + $.templates({ + selectTmpl: "", + listTmpl: "
      • {{>name}}
      • " + }); + + $("#result").html("" + + "
          "); + + var count = 0, + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + $("#result").link(true, model); + + res = $("#result select option:selected").text() + "-" + $("#result ul").text(); + + var newName = "new" + count++; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += "|" + $("#result select option:selected").text() + "-" + $("#result ul").text(); + + $("#result").link(true, model); + // ............................... Assert ................................. + assert.equal(res, "Jim-BobJim|new0-BobJimnew0", + "Top level bindings with multiple targets on the same element work correctly: html{for people tmpl='selectTmpl'} {:selected:}"); + + // ................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Top level bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + $.templates({ + myTmpl: "{{>name}} lead:{^{>~team.lead}} - " + }); + + $("#result").html("
          "); + + model = { + lead: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + $("#result").link(true, model); + + res = $("#result").text(); + + $.observable(model.people).insert({ + name: "newName" + }); + + $.observable(model).setProperty("lead", "newName"); + + res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, (isIE8 ? "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName -newName lead:newName - " + : "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName - newName lead:newName - "), + "Top level bindings allow passing in new contextual parameters to template: data-link=\"{for people ~team=#data tmpl=..."); + + // ................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Top level bindings all removed when content removed from DOM"); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("$.link() and $().link() variants", function(assert) { + var done = assert.async(); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + home1.address = address1; // reset Prop + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + + $("#result").html(''); + var help = { + options: {bar: "BarA"} + }; + + $.link("~root.person1.lastName + ' ' + person1.home.address^street + ' ' + ~options.bar", "#inner", model, help); + + // ................................ Act .................................. + before = $("#inner").html(); + $.observable(person1).setProperty("lastName", "newLast"); + $.observable(person1.home).setProperty("address", address2); // Using deep observability + $.observable(help.options).setProperty("bar", "BarB"); // Modify helper + after = $("#inner").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One StreetOne BarA|newLast StreetTwo BarB', + '$.link(expression, "#target", data, helpers) links expression to target element (equivalent to data-link="expression")'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.ok(!viewsAndBindings() && !$._data(person1).events && !$._data(person1.home).events && !$._data(help.options).events, + "$(container).empty removes current listeners from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + home1.address = address1; // reset Prop + help.options.bar = "BarA"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html(''); + + $("#inner").link("person1.lastName + ' ' + person1.home.address^street + ' ' + ~options.bar", model, help); + + // ................................ Act .................................. + before = $("#inner").html(); + $.observable(person1).setProperty("lastName", "newLast"); + $.observable(person1.home).setProperty("address", address2); // Using deep observability + $.observable(help.options).setProperty("bar", "BarB"); // Modify helper + after = $("#inner").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One StreetOne BarA|newLast StreetTwo BarB', + '$("#target").link(expression, data, helpers) links expression to target element (equivalent to data-link="expression")'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + home1.address = address1; // reset Prop + help.options.bar = "BarA"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html('
          '); // multiple targets, same class + + $.link("person1.lastName", ".inner", model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val(); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'OneOneOne|newLastnewLastnewLast|modLastmodLastmodLast' + : 'One One One|newLast newLast newLast|modLast modLast modLast'), + '$.link(expression, ".target", data, helpers) links expression to multiple target elements, including two-way bindings (equivalent to data-link="expression" on each element)'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html('
          '); // multiple targets, same class + + $(".inner").link("person1.lastName", model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val(); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'OneOneOne|newLastnewLastnewLast|modLastmodLastmodLast' + : 'One One One|newLast newLast newLast|modLast modLast modLast'), + '$(".target").link(expression, data, helpers) links expression to multiple target elements, including two-way bindings (equivalent to data-link="expression" on each element)'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html('
          '); // multiple targets, same class + + help.options.tmpl = $.templates(" NAME: {^{:lastName}}"); + $.link("title{:person1.lastName} {include person1 tmpl=~options.tmpl}", "div.inner, span.inner", model, help); + $.link("{:person1.lastName:} title{:person1.lastName}", "input.inner", model, help); + + // ................................ Act .................................. + function getTitles(selector) { + var res = ""; + $(selector).each(function() { + res += " " + this.title; + }); + return res; + } + + before = $("#result").text() + $("#result input").val() + getTitles(".inner"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles(".inner"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles(".inner"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'NAME: OneNAME: OneOne One One One|' + + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + '$.link(expression, selector, data, helpers) links expression to multiple targets on multiple target elements, including two-way bindings'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html('
          '); // multiple targets, same class + + $("div.inner, span.inner").link("title{:person1.lastName} {include person1 ^tmpl=~options.tmpl}", model, help); + $("input.inner").link("title{:person1.lastName} {:person1.lastName:}", model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val() + getTitles(".inner"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles(".inner"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles(".inner"); + $.observable(help.options).setProperty("tmpl", $.templates(" NEWTMPLNAME: {^{:lastName}}")); // We dynamically change the template of {include ^tmpl=~tmpl} too + after += "|" + $("#result").text() + $("#result input").val() + getTitles(".inner"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'NAME: OneNAME: OneOne One One One|' + + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast|' + + 'NEWTMPLNAME: modLastNEWTMPLNAME: modLastmodLast modLast modLast modLast' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast|' + + ' NEWTMPLNAME: modLast NEWTMPLNAME: modLast modLast modLast modLast modLast'), + '$(selector).link(expression, data, helpers) links expression to multiple targets on multiple target elements, including binding to passed in templates'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + help.options.tmpl = $.templates(" NAME: {^{:lastName}}"); + + // =============================== Arrange =============================== + + $("#result").html('' + + '
          ' + + ' '); // multiple targets, same class + + $.link(true, ".inner", model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val() + getTitles(".inner"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles(".inner"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles(".inner"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'NAME: One NAME: OneOne One One One|' + + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + '$.link(true, ".inner", data, helpers) links multiple targets on multiple target elements, including two-way bindings'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html('' + + '
          ' + + ' '); // multiple targets, same class + + $(".inner").link(true, model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val() + getTitles(".inner"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles(".inner"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles(".inner"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'NAME: One NAME: OneOne One One One|' + + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + '$(".inner").link(true, data, helpers) links multiple targets on multiple target elements, including two-way bindings'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html('' + + '
          ' + + ' '); // multiple targets, same class + + $.link(true, "#result", model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'NAME: One NAME: OneOne One One One|' + + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + '$(container).link(true, data, helpers) links multiple targets on multiple target elements, including two-way bindings'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $("#result").html('' + + '
          ' + + ' '); + + $("#result").link(true, model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'NAME: One NAME: OneOne One One One|' + + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + '$(container).link(true, data, helpers) links multiple targets on multiple target elements, including two-way bindings'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('
          ').link("#result"); + // Rendered by template: multiple targets, same class + + $.link("title{:person1.lastName} {include person1 tmpl=~options.tmpl}", "div.inner, span.inner", model, help); + $.link("title{:person1.lastName} {:person1.lastName:}", "input.inner", model, help); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val() + getTitles(".inner"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles(".inner"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles(".inner"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'NAME: OneNAME: OneOne One One One|' + + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + '$.link(expression, selector, data, helpers) links correctly to multiple targets on multiple target elements within a linked rendered template'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + var data = {color: "green"}, + outerHelp = { + ob: { + val: "outerVal", + tmpl: $.templates("Inside {^{:~root.color}} {^{:~ob.val}} {^{:~foo}} NAME: {^{:lastName}}") + } + }; + help.foo = "Foo"; + + $.templates('{^{:~root.color}} {^{:~ob.val}} ').link("#result", data, outerHelp); + before = $("#result").text(); + + $.link("{include person1 tmpl=~ob.tmpl}", "span.inner", model, help); + + // ................................ Act .................................. + before += "|" + $("#result").text(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text(); + $.observable(data).setProperty("color", "red"); + after += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 ? 'green outerVal |' + + 'green outerVal Inside green outerVal Foo NAME: One|' + + 'green outerVal Inside green outerVal Foo NAME:newLast|' + + 'red outerVal Insidered outerVal Foo NAME:newLast' + : 'green outerVal |' + + 'green outerVal Inside green outerVal Foo NAME: One|' + + 'green outerVal Inside green outerVal Foo NAME: newLast|' + + 'red outerVal Inside red outerVal Foo NAME: newLast'), + '$.link(expression, selector, data, helpers) links correctly to target elements within a linked rendered template - and extends the context of the target view'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('' + + '
          ' + + ' ').link("#result", model, help); + // Rendered and linked by template: multiple targets + + var model2 = { + person1: { + lastName: "lastModel2Name" + } + }, + help2 = { + options: { + tmpl: $.templates(" NAMEModel2: {^{:lastName}}") + } + }; + + $.link(true, "#result", model2, help2); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after + " - Model1: " + model.person1.lastName + "- Model2: " + model2.person1.lastName, + (isIE8 + ? 'NAME: OneNAME: OneOne One One One|' + + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' + + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast' + + ' - Model1: modLast- Model2: lastModel2Name' + : ' NAME: One NAME: One One One One One|' + + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast' + + ' - Model1: modLast- Model2: lastModel2Name'), + '$.link(true, selector, data, helpers) is a no-op when targeting within a previously linked rendered template'); + + // ................................ Act .................................. + $.observable(model2.person1).setProperty("lastName", "newModel2Last"); + before = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + $.observable(model.person1).setProperty("lastName", "new_ORIGMOD_Last"); + after = $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + $.observable(help.options).setProperty("tmpl", $.templates(" NAME_ORIGMOD_NewTmpl: {^{:lastName}}")); + after += "|" + $("#result").text() + $("#result input").val() + getTitles("#result div, #result span, #result input"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + (isIE8 + ? 'NAME:modLastNAME:modLastmodLast modLast modLast modLast|' + + 'NAME:new_ORIGMOD_LastNAME:new_ORIGMOD_Lastnew_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last|' + + 'NAME:new_ORIGMOD_LastNAME_ORIGMOD_NewTmpl: new_ORIGMOD_Lastnew_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last' + : ' NAME: modLast NAME: modLast modLast modLast modLast modLast|' + + ' NAME: new_ORIGMOD_Last NAME: new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last|' + + ' NAME: new_ORIGMOD_Last NAME_ORIGMOD_NewTmpl: new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last'), + 'Continue: $.link(true, selector, data, helpers) is a no-op when targeting within a previously linked rendered template'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + model2.person1.lastName = "lastModel2Name"; // reset Prop + help2.options.tmpl = $.templates("Model2Tmpl: {^{:lastName}}"); + + // =============================== Arrange =============================== + + $.templates('
          ').link("#result", model, help); + + // ................................ Act .................................. + before = $("#result").text(); + $.link(true, "#inner", model2, help2); //NO-OP + after = $("#result").text(); + $.observable(model2.person1).setProperty("lastName", "newLast2"); + after += "|" + $("#result").text(); + keydown($("#result input").val("modLast")); + +setTimeout(function() { + after += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after + getTitles("#inner") + " - Model1: " + model.person1.lastName + "- Model2: " + model2.person1.lastName, + "One|One|One|modLast title:modLast - Model1: modLast- Model2: newLast2", + '$.link(true, selector, data, helpers) is a no-op when targeting within a previously linked rendered template'); + + // ................................ Act .................................. + before = $("#result").text() + getTitles("#inner"); + $.link("{include person1 ^tmpl=~options.tmpl} title{:\'title2:\' + person1.lastName}", "#inner", model2, help2); + after = $("#result").text() + getTitles("#inner"); + $.observable(model2.person1).setProperty("lastName", "last2B"); + after += "|" + $("#result").text() + getTitles("#inner"); + $.observable(model.person1).setProperty("lastName", "last1A"); + after += "|" + $("#result").text() + getTitles("#inner"); + keydown($("#result input").val("modMoreLast")); + +setTimeout(function() { + after += "|" + $("#result").text() + getTitles("#inner"); + $.observable(help2.options).setProperty("tmpl", $.templates("Model2NEWTmpl: {^{:lastName}}")); + after += "|" + $("#result").text() + getTitles("#inner"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after + " - Model1: " + model.person1.lastName + "- Model2: " + model2.person1.lastName, + isIE8 + ? "modLast title:modLast|" + + "Model2Tmpl: newLast2 title2:newLast2|" + + "Model2Tmpl:last2B title2:last2B|" + + "last1A title:last1A|" + + "modMoreLast title:modMoreLast|" + + "Model2NEWTmpl: last2B title:modMoreLast" + + " - Model1: modMoreLast- Model2: last2B" + : "modLast title:modLast|" + + "Model2Tmpl: newLast2 title2:newLast2|" + + "Model2Tmpl: last2B title2:last2B|" + + "last1A title:last1A|" + + "modMoreLast title:modMoreLast|" + + "Model2NEWTmpl: last2B title:modMoreLast" + + " - Model1: modMoreLast- Model2: last2B", + '$.link(expression, selector, data, helpers) links content correctly, including within a previously linked rendered template - leading to dual two-way binding to both models and contexts'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + model2.person1.lastName = "lastModel2Name"; // reset Prop + help2.options.tmpl = $.templates("Model2Tmpl: {^{:lastName}}"); + + // =============================== Arrange =============================== + + $.templates('
          ').link("#result", model, help); + + // ................................ Act .................................. + before = $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + + $.observable(model.person1).setProperty("lastName", "newLast3"); + + after = $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + + keydown($("#result input").val("modLast4")); + +setTimeout(function() { + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val() + " data:" + model.person1.lastName; + + $("#inner").unlink(); + + $.observable(model.person1).setProperty("lastName", "newLast5"); + + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + + keydown($("#result input").val("modLast6")); + +setTimeout(function() { + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val() + " data:" + model.person1.lastName; + + $("#result input").unlink(); + + $.observable(model.person1).setProperty("lastName", "newLast7"); + + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + +setTimeout(function() { + keydown($("#result input").val("modLast8")); + + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val() + " data:" + model.person1.lastName; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "One title:One val:One|" + + "newLast3 title:newLast3 val:newLast3|" + + "modLast4 title:modLast4 val:modLast4 data:modLast4|" + + "modLast4 title:modLast4 val:newLast5|" + + "modLast4 title:modLast4 val:modLast6 data:modLast6|" + + "modLast4 title:modLast4 val:modLast6|" + + "modLast4 title:modLast4 val:modLast8 data:newLast7", + '$(selector).unlink() removes data binding on target element, including both directions of binding on two-way data-linking'); + + // ............................... Assert ................................. + assert.ok(viewsAndBindings().split(" ").length === 7 && !$._data(model.person1).events, + '$(selector).unlink() removes data binding, and the "link" views, for target elements'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + model2.person1.lastName = "lastModel2Name"; // reset Prop + help2.options.tmpl = $.templates("Model2Tmpl: {^{:lastName}}"); + + // =============================== Arrange =============================== + + $.templates('
          ').link("#result", model, help); + + // ................................ Act .................................. + before = $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + + $.observable(model.person1).setProperty("lastName", "newLast3"); + + after = $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + + keydown($("#result input").val("modLast4")); + +setTimeout(function() { + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val() + " data:" + model.person1.lastName; + + $.unlink("#inner"); + + $.observable(model.person1).setProperty("lastName", "newLast5"); + + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + + keydown($("#result input").val("modLast6")); + +setTimeout(function() { + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val() + " data:" + model.person1.lastName; + + $.unlink("#result input"); + + $.observable(model.person1).setProperty("lastName", "newLast7"); + + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val(); + + keydown($("#result input").val("modLast8")); + +setTimeout(function() { + after += "|" + $("#result").text() + getTitles("#inner") + " val:" + $("#result input").val() + " data:" + model.person1.lastName; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "One title:One val:One|" + + "newLast3 title:newLast3 val:newLast3|" + + "modLast4 title:modLast4 val:modLast4 data:modLast4|" + + "modLast4 title:modLast4 val:newLast5|" + + "modLast4 title:modLast4 val:modLast6 data:modLast6|" + + "modLast4 title:modLast4 val:modLast6|" + + "modLast4 title:modLast4 val:modLast8 data:newLast7", + '$.unlink(selector) removes data binding on target element, including both directions of binding on two-way data-linking'); + + // ............................... Assert ................................. + assert.ok(viewsAndBindings().split(" ").length === 7 && !$._data(model.person1).events, + '$.unlink(selector) removes data binding, and the "link" views, for target elements'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes current listeners and two-way bindings from that content"); + + // ................................ Reset ................................ + $.views.settings.advanced({_jsv: false}); + +done(); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}); + +QUnit.module("template.link()"); + +QUnit.test("Helper overriding", function(assert) { +var done = assert.async(); + +// ................................ Reset ................................ + home1.address = address1; // reset Prop + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + + // =============================== Arrange =============================== + $.views.helpers("a", "globalHelper"); + + var tmpl = $.templates({ + markup: "{{:~a}} {{:~b}} {{:~c}}", + helpers: { + b: "templateHelper" + } + }); + + tmpl.link("#result", {}, {c: "optionHelper"}); + $.views.helpers("a", null); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "globalHelper templateHelper optionHelper", 'Passing in helpers - global, template or option'); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: "{{:~a}}", + helpers: { + a: "templateHelper" + } + }); + + tmpl.link("#result", {}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "templateHelper", 'template helper overrides global helper'); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: "{{:~a}}" + }); + + tmpl.link("#result", {}, {a: "optionHelper"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "optionHelper", 'option helper overrides global helper'); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: "{{:~b}}", + helpers: { + b: "templateHelper" + } + }); + + tmpl.link("#result", {}, {b: "optionHelper"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "templateHelper", 'template helper overrides option helper'); + + // =============================== Arrange =============================== + $.views.helpers("a", "globalHelper"); + + $("#result").html("
          "); + + $.link(true, "#result", {}, {b: "optionHelper"}); + $.views.helpers("a", null); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "globalHelperoptionHelper", 'Passing in helpers to top-level linking - global or option'); + + // =============================== Arrange =============================== + $.views.helpers("a", "globalHelper"); + + $("#result").html("
          "); + + $.link(true, "#result", {}, {a: "optionHelper"}); + $.views.helpers("a", null); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "optionHelper", 'Passing in helpers to top-level linking - option overrides global'); + + // =============================== Arrange =============================== + $.views.helpers({ + onBeforeChange: function(ev, eventArgs) { + res += "globalBeforeChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterChange: function(ev, eventArgs) { + res += "globalAfterChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterCreate: function(view) { + res += "globalAfterCreate "; + } + }); + res = ''; + + var pson = {name: "Jo"}; + + tmpl = $.templates({ + markup: " {^{:name}}" + }); + + tmpl.link("#result", pson); + + $.observable(pson).setProperty("name", "name3"); + + // ............................... Assert ................................. + assert.equal(res, "globalAfterCreate globalBeforeChange|set|INPUT globalAfterChange|set|INPUT globalBeforeChange|set|: globalAfterChange|set|: ", + 'Global onAfterCreate, onBeforeChange, onAfterChange - setProperty'); + + res = ''; + + keydown($("#result input").val("editedName")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(res, "globalBeforeChange|set|INPUT globalAfterChange|set|INPUT globalBeforeChange|set|: globalAfterChange|set|: ", + 'Global onAfterCreate, onBeforeChange, onAfterChange - elemChange'); + + res = ''; + + // =============================== Arrange =============================== + tmpl.link("#result", pson, { + onBeforeChange: function(ev, eventArgs) { + res += "optionsBeforeChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterChange: function(ev, eventArgs) { + res += "optionsAfterChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterCreate: function(view) { + res += "optionsAfterCreate "; + } + }); + + $.observable(pson).setProperty("name", "name2"); + + // ............................... Assert ................................. + assert.equal(res, "optionsAfterCreate optionsBeforeChange|set|INPUT optionsAfterChange|set|INPUT optionsBeforeChange|set|: optionsAfterChange|set|: ", + 'options helper overrides global helper'); + + res = ''; + + keydown($("#result input").val("editedName")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(res, "optionsBeforeChange|set|INPUT optionsAfterChange|set|INPUT optionsBeforeChange|set|: optionsAfterChange|set|: ", + 'options helper overrides global helper'); + + res = ''; + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: " {^{:name}}", + helpers: { + onBeforeChange: function(ev, eventArgs) { + res += "templateBeforeChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterChange: function(ev, eventArgs) { + res += "templateAfterChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterCreate: function(view) { + res += "templateAfterCreate "; + } + } + }); + + tmpl.link("#result", pson, { + onBeforeChange: function(ev, eventArgs) { + res += "optionsBeforeChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterChange: function(ev, eventArgs) { + res += "optionsAfterChange|" + eventArgs.change + "|" + (this.tagName || this.elem.tagName) + " "; + }, + onAfterCreate: function(view) { + res += "optionsAfterCreate "; + } + }); + + $.observable(pson).setProperty("name", "name4"); + + // ............................... Assert ................................. + assert.equal(res, "templateAfterCreate templateBeforeChange|set|INPUT templateAfterChange|set|INPUT templateBeforeChange|set|: templateAfterChange|set|: ", + 'template helper overrides options helper'); + + res = ''; + + keydown($("#result input").val("editedName")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(res, "templateBeforeChange|set|INPUT templateAfterChange|set|INPUT" + + " templateBeforeChange|set|: templateAfterChange|set|: ", + 'template helper overrides options helper'); + + res = ''; + + $.views.helpers({ + onBeforeChange: null, + onAfterChange: null, + onAfterCreate: null + }); + $("#result").empty(); + +done(); +}, 0); +}, 0); +}, 0); +}); + +QUnit.test('data-link="expression"', function(assert) { +var done = assert.async(); + +// ................................ Reset ................................ + home1.address = address1; // reset Prop + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One|newLast', + 'Data link using: '); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#last").val(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#last").val(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One|newLast', + 'Data link using: binds from data'); + + // ................................ Act .................................. + keydown($("#result input").val("editedName")); + +setTimeout(function() { + after = $("#result").html() + $("#last").val(); + + // ............................... Assert ................................. + assert.equal(person1.lastName, "editedName", + 'Data link using: does two-way binding'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).setProperty("lastName", "newLast"); + $.observable(person1.home).setProperty("address", address2); // Using deep observability + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One StreetOne|newLast StreetTwo', + 'Data link using: '); + + // ................................ Act .................................. + $("#result").empty(); + before = $("#result").html(); + + // ............................... Assert ................................. + assert.ok(!viewsAndBindings() && !$._data(person1).events && !$._data(home1).events && !$._data(address2).events, + "$(container).empty removes both views and current listeners from that content - including after swapping data on deep paths"); + + person1.lastName = "One"; // reset Prop + home1.address = address1; // reset Prop + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty("title", "Sir"); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Mr Jo One|Sir newFirst newLast', + 'data-link="fullName()"'); + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", { + foo: function(val) { + return {b: val}; + } + }); + + // ............................... Assert ................................. + var html = $("#result span")[0].outerHTML; + assert.equal(html, + isIE8 + ? "x\\x', + 'Escaping of characters: data-link="foo(\'x\\x\').b"'); + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", model); + + // ................................ Act .................................. + elems = $("#result span"); + before = elems[0].innerHTML + elems[1].innerHTML; + $.observable(address1).setProperty("street", "newStreetOne"); + $.observable(person1).setProperty("home", home2); + elems = $("#result span"); + after = elems[0].innerHTML + elems[1].innerHTML; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'StreetOneStreetOne|newStreetOneStreetTwo', + 'person1.home.address.street binds only to the leaf, but person1.home^address.street does deep binding'); + + // ................................ Reset ................................ + $("#result").empty(); + address1.street = "StreetOne"; + person1.home = home1; + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", 1, {model: model}); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(address1).setProperty("street", "newStreetOne"); + $.observable(person1).setProperty("home", home2); + $.observable(address2).setProperty("street", address2.street + "+"); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'StreetOne|StreetTwo+', + '~a.b^c does deep binding'); + + // ................................ Reset ................................ + $("#result").empty(); + address1.street = "StreetOne"; + person1.home = home1; + address2.street = "StreetTwo"; + + // =============================== Arrange =============================== + + var util1 = {getVal: function(val) { return "getVal1 = " + val; }}; + var util2 = {getVal: function(val) { return "getVal2 = " + val; }}; + var appHelpers = {util: util1}; + + $.templates('') + .link("#result", 22, {app: appHelpers}); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(appHelpers).setProperty("util", util2); + after = $("#result span").html(); + $.observable(util2).setProperty("getVal", function(val) { return "getNewVal = " + val; }); + after += "|" + $("#result span").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'getVal1 = 22|getVal2 = 22|getNewVal = 22', + '~a.b.helperFunction() does deep binding even for functions'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + var foobar = { + foo: { + bar: "initial " + } + }; + + $.views.converters({ + noop: function(val) { + return val; + } + }); + + $.templates('1 {^{:foo^bar}} 2 {^{:foo^bar}} 3 ' + + ' 4 5 6 ' + + ' INPUTS ' + + '' + + '') + .link("#result", foobar); + + // ................................ Act .................................. + $.observable(foobar).setProperty("foo", {bar: "new "}); + res = $("#result").text(); + $("input.linked").each(function(i, el) { res += el.value; }); + + // ............................... Assert ................................. + assert.equal(res, + isIE8 ? "1new 2new 3 new 4 new 5 new 6 new INPUTS new new new new new new new new " + : "1 new 2 new 3 new 4 new 5 new 6 new INPUTS new new new new new new new new ", + 'Duplicate paths bind correctly (https://github.com/BorisMoore/jsviews/issues/250)'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + var data = {name: "Jo"}; + res = ""; + + // ................................ Act .................................. + res = + $.templates('{{:#data}}') + .render(["aa", 22, 0, false, "", true]); + + // ............................... Assert ................................. + assert.equal(res, + "aa220falsetrue", + '{{:#data}} renders correctly for different data types'); + + // ................................ Act .................................. + res = + $.templates('{{for items}}{{:#index}} {{:#data}} {{/for}}') + .render({items: ["aa", 22, 0, false, "", true]}); + + // ............................... Assert ................................. + assert.equal(res, + "0 aa 1 22 2 0 3 false 4 5 true ", + '{{:#data}} within {{for}} is correct for different data types'); + + // ................................ Act .................................. + + res = + $.templates('{{:#data}}') + .link("#result", ["aa", 22, 0, false, "", true]).text(); + + // ............................... Assert ................................. + assert.equal(res, + "aa220falsetrue", + 'With link, {{:#data}} renders correctly for different data types'); + + // ................................ Act .................................. + res = + $.templates('{{for items}}{{:#index}} {{:#data}} {{/for}}') + .link("#result", {items: ["aa", 22, 0, false, "", true]}).text(); + + // ............................... Assert ................................. + assert.equal(res, + isIE8 ? "0 aa 1 22 2 0 3 false 4 5 true " + : "0 aa 1 22 2 0 3 false 4 5 true ", + 'with link, {{:#data}} within {{for}} is correct for different data types'); + + // ................................ Act .................................. + res = + $.templates('{^{:#data}}') + .link("#result", ["aa", 22, 0, false, "", true]).text(); + + // ............................... Assert ................................. + assert.equal(res, + "aa220falsetrue", + 'With link, {^{:#data}} renders correctly for different data types'); + + // ................................ Act .................................. + res = + $.templates('{^{for items}}{{:#index}} {^{:#data}} {{/for}}') + .link("#result", {items: ["aa", 22, 0, false, "", true]}).text(); + + // ............................... Assert ................................. + assert.equal(res, + isIE8 ? "0 aa 1 22 2 0 3 false 4 5 true " + : "0 aa 1 22 2 0 3 false 4 5 true ", + 'with link, {^{:#data}} within {^{for}} is correct for different data types'); + + // ................................ Act .................................. + data = {name: "Jo"}; + res = ""; + + $.templates( + '{{for "some string" ~item=#data}}' + + '' + + '{{/for}}' + + '{{for 22 ~item=#data}}' + + '' + + '{{/for}}' + + '{{for 0 ~item=#data}}' + + '' + + '{{/for}}' + + '{{for false ~item=#data}}' + + '' + + '{{/for}}' + + '{{for "" ~item=#data}}' + + '' + + '{{/for}}' + + '{{for true ~item=#data}}' + + '' + + '{{/for}}' + ) + .link("#result", data); + + $("#result input").each(function(i, el) { + res += el.value + " | "; + }); + + $.observable(data).setProperty("name", "new"); + + $("#result input").each(function(i, el) { + res += el.value + " | "; + }); + + // ............................... Assert ................................. + assert.equal(res, + "Josome string | Jo22 | Jo0 | Jofalse | Jo | Jotrue | newsome string | new22 | new0 | newfalse | new | newtrue | ", + 'data-linking inside {{for sometype}} works correctly even when #data is not an object'); + + // ................................ Reset ................................ + $("#result").empty(); + + // ................................ Act .................................. + data = {name: "Jo"}; + res = ""; + + $.templates( + '{^{for "some string" ~item=#data}}' + + '' + + '{{/for}}' + + '{^{for 22 ~item=#data}}' + + '' + + '{{/for}}' + + '{^{for 0 ~item=#data}}' + + '' + + '{{/for}}' + + '{^{for false ~item=#data}}' + + '' + + '{{/for}}' + + '{^{for "" ~item=#data}}' + + '' + + '{{/for}}' + + '{^{for true ~item=#data}}' + + '' + + '{{/for}}' + ) + .link("#result", data); + + $("#result input").each(function(i, el) { + res += el.value + " | "; + }); + + $.observable(data).setProperty("name", "new"); + + $("#result input").each(function(i, el) { + res += el.value + " | "; + }); + + // ............................... Assert ................................. + assert.equal(res, + "Josome string | Jo22 | Jo0 | Jofalse | Jo | Jotrue | newsome string | new22 | new0 | newfalse | new | newtrue | ", + 'data-linking inside {^{for sometype}} works correctly even when #data is not an object'); + + // ................................ Reset ................................ + $("#result").empty(); + res = ""; + + $.views.settings.advanced({_jsv: false}); + +done(); +}, 0); +}); + +QUnit.test('data-link="attr{:expression}"', function(assert) { + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].className; + $.observable(person1).setProperty("lastName", "xxx"); + after = $("#result span")[0].className; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One|xxx', + 'Data link using: , and setting lastName to "xxx" - sets className to "xxx"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span").attr("title"); + $.observable(person1).setProperty("lastName", "xxx"); + after = $("#result span").attr("title"); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'One|xxx', + 'Data link using: , and setting lastName to "xxx" - sets title to "xxx"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + $.observable(person1).setProperty("lastName", ""); + after = $("#result span")[0].getAttribute("title"); + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === "", + 'Data link using: , and setting lastName to "" - sets title to ""'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + $.observable(person1).setProperty("lastName", null); + after = $("#result span")[0].getAttribute("title"); + var html = $("#result span")[0].outerHTML; + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === null && html === (isIE8 ? (""), + 'Data link using: , and setting lastName to null - removes title attribute'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + $.observable(person1).setProperty("lastName", undefined); + after = $("#result span")[0].getAttribute("title"); + var html = $("#result span")[0].outerHTML; + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === null && html === (isIE8 ? (""), + 'Data link using: , and setting lastName to undefined - removes title attribute'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).setProperty("lastName", null); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === "", + 'Data link using: , and setting lastName to null - sets content to empty string'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates("prop: ") + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).setProperty("lastName", null); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === "", + "Data link using: , and setting lastName to null - sets content to empty string"); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + $.observable(person1).removeProperty("lastName"); + after = $("#result span")[0].getAttribute("title"); + var html = $("#result span")[0].outerHTML; + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === null && html === (isIE8 ? (""), + 'Data link using: , and removing lastName - removes title attribute'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).removeProperty("lastName"); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === "", + 'Data link using: , and removing lastName - sets content to empty string'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates("prop: ") + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).removeProperty("lastName"); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === "", + "Data link using: , and removing lastName - sets content to empty string"); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + person1.lastName = ""; // initialize + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + + // ............................... Assert ................................. + assert.ok(before === "", + 'Data link using: , with lastName "" - initializes with title attribute set to ""'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + person1.lastName = undefined; // initialize + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + + // ............................... Assert ................................. + assert.ok(before === null, + 'Data link using: , with lastName undefined - initializes with title attribute null'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + person1.lastName = null; // initialize + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + + // ............................... Assert ................................. + assert.ok(before === null, + 'Data link using: , with lastName null - initializes with title attribute null'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("title"); + $.observable(person1).setProperty("lastName", false); + after = $("#result span")[0].getAttribute("title"); + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === "false", + 'Data link using: , and string lastName to false - sets title to "false"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("data-foo"); + var beforeVal = $("#result span").data("foo"); + $.observable(person1).setProperty("lastName", "Two"); + after = $("#result span")[0].getAttribute("data-foo"); + var afterVal = $("#result span").data("foo"); + + // ............................... Assert ................................. + assert.ok(before === 'One' && before === beforeVal && after === "Two" && after === afterVal, + 'Data link using: sets data-foo attribute to lastName value and sets $(elem).data("foo") to the same value'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + var originalAddress = person1.home.address; + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("data-foo"); + beforeVal = $("#result span").data("foo"); + var crazyAddress = [1,2]; + $.observable(person1.home).setProperty("address", crazyAddress); + after = $("#result span")[0].getAttribute("data-foo"); + afterVal = $("#result span").data("foo"); + + // ............................... Assert ................................. + assert.ok(before === originalAddress.toString() && beforeVal === originalAddress && after === crazyAddress.toString() && afterVal === crazyAddress, + 'Data link using: sets data-foo attribute to address.toString() value and sets $(elem).data("foo") to address'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + person1.home.address = originalAddress; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + var el = $("#result span")[0]; + before = el.getAttribute("data-foo") + el.getAttribute("data-foo-bar") + el.getAttribute("a-b-c") + el.getAttribute("a_b_c-d-e"); + $.observable(person1).setProperty("lastName", "Two"); + after = el.getAttribute("data-foo") + el.getAttribute("data-foo-bar") + el.getAttribute("a-b-c") + el.getAttribute("a_b_c-d-e"); + + // ............................... Assert ................................. + assert.ok(before === 'OneOneOneOne' && after === "TwoTwoTwoTwo", + 'Data link using: data-link="data-foo{:lastName} data-foo-bar{:lastName} a-b-c{:lastName} a_b_c-d-e{:lastName}" sets attributes to lastName value'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].getAttribute("a-b_foo"); + $.observable(person1).setProperty("lastName", "Two"); + after = $("#result span")[0].getAttribute("a-b_foo"); + + // ............................... Assert ................................. + assert.ok(before === 'One' && after === "Two", + 'Data link using: sets a-b_foo attribute to lastName value'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", ""); + after = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.ok(before === "inline" && after === "none", + 'Data link using: , and string lastName to "" - sets display to "none"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", null); + after = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.ok(before === "inline" && after === "none", + 'Data link using: , and string lastName to null - sets display to "none"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", undefined); + after = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.ok(before === "inline" && after === "none", + 'Data link using: , and string lastName to undefined - sets display to "none"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", false); + after = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.ok(before === "inline" && after === "none", + 'Data link using: , and string lastName to false - sets display to "none"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", ""); + after = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", "One"); + var reset = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + reset, "inline|none|inline", + 'Data link using: , and toggling string lastName to "" and back - sets display to "inline"'); + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", ""); + after = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", "One"); + reset = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + reset, "inline-block|none|inline-block", + 'Data link using: , and toggling lastName - sets display to "inline-block"'); + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", ""); + after = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", "One"); + reset = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + reset, "inline|none|inline", + 'Data link using: , and toggling lastName - sets display to "inline"'); + + // =============================== Arrange =============================== + + $.templates('prop:
          ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result div")[0].style.display; + $.observable(person1).setProperty("missing", "foo"); + after = $("#result div")[0].style.display; + $.observable(person1).setProperty("missing", ""); + reset = $("#result div")[0].style.display; + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + reset, "none|block|none", + 'Data link using:
          , and toggling lastName - sets display to "block"'); + + // ................................ Reset ................................ + delete person1.missing; + + // =============================== Arrange =============================== + + $.templates('prop:
          ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result div")[0].style.display; + $.observable(person1).setProperty("lastName", ""); + after = $("#result div")[0].style.display; + $.observable(person1).setProperty("lastName", "One"); + reset = $("#result div")[0].style.display; + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + reset, "block|none|block", + 'Repeat (block style for div is now cached) data link using:' + + '
          , and toggling lastName - sets display to "block"'); + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result [style]")[0].style.display; + $.observable(person1).setProperty("missing", "foo"); + after = $("#result [style]")[0].style.display; + $.observable(person1).setProperty("missing", ""); + reset = $("#result [style]")[0].style.display; + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + reset, "none|block|none", + 'Data link using: , and toggling lastName - sets display to "block"'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.views.converters({ + not: function(val) { + return !val; + } + }); + + $.templates('prop: No name') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", ""); + after = $("#result span")[0].style.display; + $.observable(person1).setProperty("lastName", "One"); + reset = $("#result span")[0].style.display; + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + reset, "none|inline|none", + 'Data link using: , and toggling lastName - sets display to "inline" if lastName is ""'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.views.tags({ + chooseAttr: { + init: function(tagCtx, linkCtx, ctx) { + if (this.tagCtx.props.tagAttr) { + this.attr = this.tagCtx.props.tagAttr; + } + if (this.tagCtx.props.linkCtxAttr) { + linkCtx.attr = this.tagCtx.props.linkCtxAttr; + } + }, + render: function(val) { + return val.name ? val.name + "
          " : ""; + }, + attr: "text", + depends: "name" + } + }); + + var thing = {name: "box"}; + + function divProps() { + var div = $("#result div")[0]; + return "title: " + div.title + " - innerHTML: " + div.innerHTML.replace(isIE8 ? /\r\n<\/SCRIPT>|\r\n/g : /<\/script>/g, "") + " - display: " + div.style.display; + } + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: box<br/> - display: ", + "{chooseAttr} has target 'text'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: box
          - innerHTML: xx - display: ", + "{chooseAttr tagAttr=\'title\'} overrides tag.attr, and has target 'title'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
          " : "box
          ") + " - display: ", + "{chooseAttr tagAttr=\'html\'} overrides tag.attr, and has target 'html'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: box
          - innerHTML: xx - display: ", + "{chooseAttr linkCtxAttr=\'title\' tagAttr=\'html\'} overrides linkCtx.attr, and has target 'title'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
          " : "box
          ") + " - display: ", + "html{chooseAttr} has target 'html'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
          " : "box
          ") + " - display: ", + "html{chooseAttr tagAttr =\'title\'} overrides tag.attr, but still has target 'html'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: box
          - innerHTML: xx - display: ", + "html{chooseAttr tagAttr =\'html\' linkCtxAttr=\'title\'} overrides tag.attr and linkCtx.attr, and has target 'title'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: xx - display: block", + "visible{chooseAttr} has display 'block'"); + + // ................................ Act .................................. + $.observable(thing).removeProperty("name"); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: xx - display: none", + "visible{chooseAttr} has display 'none' if {chooseAttr} returns ''"); + + // ................................ Act .................................. + thing.name = "box"; + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: xx - display: block", + "visible{chooseAttr tagAttr=\'title\'} overrides tag.attr, but still has target 'visible' and has display 'block'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
          " : "box
          ") + " - display: ", + "visible{chooseAttr tagAttr=\'title\' linkCtxAttr=\'html\'} overrides tag.attr and linkCtx.attr, and has target 'html'"); + + // ................................ Act .................................. + $.templates('
          xx
          ') + .link("#result", thing); + + // ............................... Assert ................................. + assert.equal(divProps(), "title: box
          - innerHTML: xx - display: ", + "visible{chooseAttr tagAttr=\'html\' linkCtxAttr=\'title\'} overrides tag.attr and linkCtx.attr, and has target 'title'"); + + // ................................ Reset ................................ + $("#result").empty(); + res = ""; +}); + +QUnit.test('data-link="{cvt:expression:cvtBack}"', function(assert) { + +var done = assert.async(); + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + person2._firstName = "Xavier"; // reset Prop + person2.lastName = "Two"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person2); + + // ................................ Act .................................. + before = $("#result span").html(); + $.observable(person1).setProperty({firstName: "newOneFirst", lastName: "newOneLast"}); + $.observable(person2).setProperty({firstName: "newTwoFirst", lastName: "newTwoLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + after = $("#result span").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "mr jotwo30Mr Xavier|sir newonefirstnewtwolast40Sir newTwoFirst", + 'Data link using: - with declared dependencies for converter'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + person2._firstName = "Xavier"; // reset Prop + person2.lastName = "Two"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + $.views + .converters({ + from: function(val) { + return val + "from" + this.tagCtx.props.frst; + }, + to: function(val) { + return val + "to" + this.tagCtx.props.frst; + } + }); + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + var value = $("#twoWay").val(); + keydown($("#twoWay").val(value + "+")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(person1.lastName, + "One+toMr Jo", + 'Data link using: with no convert. - convertBack called with tag as this pointer.'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + value = $("#twoWay").val(); + keydown($("#twoWay").val(value + "+")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(person1.lastName + $("#twoWay").data().foo, + "One+23", + 'Data link using: with no convert. - convertBack called with tag as this pointer.'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop: ') + .link("#result", person1); + + // ................................ Act .................................. + value = $("#twoWay").val(); + keydown($("#twoWay").val(value + "+")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(person1.lastName, + "OnefromMr Jo+toMr Jo", + 'Data link using: - convert and convertBack called with tag as this pointer.'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + var tmpl = $.templates('prop: ' + + '{{for true}}prop: {{/for}}'); + + $.views + .converters({ + from: function(val) { + return val + "from" + this.tagCtx.props.frst; + }, + to: function(val) { + return val + "to" + this.tagCtx.props.frst; + } + }, tmpl); + + // =============================== Arrange =============================== + + tmpl.link("#result", person1); + + // ................................ Act .................................. + value = $("#twoWay").val(); + keydown($("#twoWay").val(value + "+")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(person1.lastName, + "OnefromMr Jo+toMr Jo", + 'Data link using: - with converters local to template: convert and convertBack called with tag as this pointer.'); + + // ................................ Act .................................. + value = $("#twoWayInner").val(); + keydown($("#twoWayInner").val(value + "+")); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(person1.lastName, + "OnefromMr Jo+toMr JofromMr Jo+toMr Jo", + 'Data link using: in nested block - with converters local to template: convert and convertBack called with tag as this pointer.'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + +done(); + +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}); + +QUnit.test('Two-way binding', function(assert) { + +var done = assert.async(); + // =============================== Arrange =============================== + var tmpl = $.templates('
          '); + + var model = { + address: {street: "First St"} + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result").text() + " | "; + + keydown($("#result input").val('1st Ave')); + +setTimeout(function() { + res += $("#result").text() + " | " + model.address.street; + + // ............................... Assert ................................. + assert.equal(res, "First St | 1st Ave | 1st Ave", + ''); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + function getSelection() { + return model.selected + ":" + ($("#result select option:selected").text()||"-") + "(" + $("#result select")[0].selectedIndex + ")|"; + } + + tmpl = $.templates(''); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + } + var newName = "new"; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += getSelection(); + + $.observable(model.people).remove(2); + + res += getSelection(); + + $("#result select").val('Jim').change(); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "Jim:Jim(1)|new:new(2)|new:-(-1)|Jim:Jim(1)|", + '{^{for people}}{{/for}}'); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += getSelection(); + + $.observable(model.people).remove(2); + + res += getSelection(); + + $("#result select").val('Jim').change(); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "Jim:JIM(1)|new:NEW(2)|new:-(-1)|Jim:JIM(1)|", + '{^{for people}}{{/for}}'); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += getSelection(); + + $.observable(model.people).remove(2); + + res += getSelection(); + + $("#result select").val('Jim').change(); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "Jim:Jim(1)|new:new(2)|new:-(-1)|Jim:Jim(1)|", + '{^{for people}}{{/for}}'); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += getSelection(); + + $.observable(model.people).remove(2); + + res += getSelection(); + + $("#result select").val('Jim').change(); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "Jim:JIM(1)|new:NEW(2)|new:-(-1)|Jim:JIM(1)|", + '{^{for people}}{{/for}}'); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += getSelection(); + + $.observable(model.people).remove(2); + + res += getSelection(); + + $("#result select").val('Jim').change(); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "Jim:JIM(1)|new:NEW(2)|new:-(-1)|Jim:JIM(1)|", + '{^{for items}}{{/for}}', + converters: { + cvt: function (value) { + return value + } + } + }); + + model = { + selected: 4, + items: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.items).insert(0, [4,5,6]); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "4:-(-1)|4:4(0)|", + '{^{for items}}{{/for}}', + converters: { + cvt: function (value) { + return value + } + } + }); + + model = { + selected: 4, + items: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.items).insert(0, [4,5,6]); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "4:-(-1)|4:4(0)|", + '{^{for items}}{{/for}}', + converters: { + cvt: function (value) { + return value + } + } + }); + + model = { + selected: 4, + items: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.items).insert(0, [4,5,6]); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "4:-(-1)|4:4(0)|", + '{^{for items}}{{/for}}', + converters: { + cvt: function (value) { + return value + } + } + }); + + model = { + selected: 4, + items: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model.items).insert(0, [4,5,6]); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "4:-(-1)|4:4(0)|", + '{^{for items}}{{/for}}'); + + model = { + selected: 4, + items: [1,2,3], + items2: [4,5,6] +}; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = getSelection(); + + $.observable(model).setProperty('items', model.items2); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "4:-(-1)|4:4(0)|", + '{^{for people}}{{/for}}'); + + model = { + selected: ["Jim","Bob"], + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result select")[0].multiple + getSelection(); + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", [newName, "Bob"]); + + res += getSelection(); + + $.observable(model.people).remove(2); + + res += getSelection(); + + $.observable(model.people).insert([ + { + name: "Pete" + }, + { + name: "Jo" + } + ]); + + $("#result select").val(['Jo']).change(); + + res += getSelection(); + + $("#result select").val([]).change(); + + res += getSelection(); + + $("#result select").val(["Bob", "Pete", "Jim"]).change(); + + res += getSelection(); + + $.observable(model).setProperty("selected", "Bob"); + + res += getSelection(); + + // ............................... Assert ................................. + assert.equal(res, "trueJim,Bob:BOBJIM(0)|new,Bob:BOBNEW(0)|new,Bob:BOB(0)|Jo:JO(3)|:-(-1)|Bob,Jim,Pete:BOBJIMPETE(0)|Bob:BOB(0)|", + 'Multiselect with {^{for people}}{{/for}}'); + + model = { + selected: "J", + people: [ + {name: "Bob", id: "B"}, + {name: "Noone", id: ""}, + {name: "Jim", id: "J"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result select")[0].multiple + $("#result select option:selected").text() + ":" + $("#result select")[0].selectedIndex + "|"; + + $.observable(model).setProperty("selected", ["", "J"]); + + res += $("#result select option:selected").text() + ":" + $("#result select")[0].selectedIndex + "|"; + + $.observable(model).setProperty("selected", "B"); + + res += $("#result select option:selected").text() + ":" + $("#result select")[0].selectedIndex + "|"; + + $.observable(model).setProperty("selected", []); + + res += $("#result select option:selected").text() + ":" + $("#result select")[0].selectedIndex + "|"; + + $.observable(model).setProperty("selected", ""); + + res += $("#result select option:selected").text() + ":" + $("#result select")[0].selectedIndex + "|"; + + $.observable(model).setProperty("selected", ["J"]); + + res += $("#result select option:selected").text() + ":" + $("#result select")[0].selectedIndex + "|"; + + $.observable(model).setProperty("selected", null); + + res += $("#result select")[0].multiple + $("#result select option:selected").text() + ":" + $("#result select")[0].selectedIndex + "|"; + + // ............................... Assert ................................. + assert.equal(res, "trueJim:2|NooneJim:1|Bob:0|:-1|Noone:1|Jim:2|trueNoone:1|", + 'Multiselect with \ +\ +\ +\ +{^{:foo}}\ +{^{:#data.foo}}\ +{^{:#view.data.foo}}'); + + // ............................... Act ................................. + tmpl.link("#result", {foo:"F"}); + + var cnt = 0; + res = ""; + getContent(); + + $("#result input").each(function() { + keydown($("#result input").val(cnt++)); + }); + +setTimeout(function() { + getContent(); + + assert.equal(res, "FFFFFF|222222|", + 'Two-way binding to foo, #data.foo #view.data.foo'); + + // ................................ Reset ................................ + $("#result").empty(); + +done(); +}, 0); +}, 0); + +}); + +QUnit.test('data-link="{radiogroup}"', function(assert) { + + // =============================== Arrange =============================== + + var top = + '
          ' + + '' + + '' + + '
          ' ++ '
          ' + + '' + + '' + + '
          '; + + $("#result").html(top); + + // ............................... Act ................................. + + var model = { + selected: "Jim" + }; + + $.link(true, "#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model).setProperty("selected", "Bob"); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").eq(1).prop("checked", true).change(); // Check second radio button + + res += $("#result input:checked").parent().text() + "|" + model.selected; + + // ............................... Assert ................................. + assert.equal(res, ":Jim:Jim|:Bob:Bob|:Jim:Jim|Jim", + 'data-link="{radiogroup selected}" top-level'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + var top = + '
          ' + + '
          ', + + tmpl = $.templates(''), + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }, + + newName = "new"; + + $("#result").html(top); + + // ............................... Act ................................. + $.link(true, "#result", model, {itemTmpl: tmpl}); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").eq(1).prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":Jim:Jim|:new:new||Jim-:Jim:Jim|", + 'data-link="{radiogroup selected}" ... {^{for ...}}...'); + + // =============================== Arrange =============================== + tmpl = $.templates( + '
          ' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }, + newName = "new"; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":Jim|:new||Bob-:Bob|", + 'data-link="{radiogroup selected}" ... {^{for ...}}...'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '
          ' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":JIM|:NEW||None-:NONE|", + 'data-link="{radiogroup selected}" ... ...{^{for ...}}...'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED|jimUpdated-:JIMUPDATED|", + 'data-link="{radiogroup selected}" ... {^{for ...}}... - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates({markup: + '
          ' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ', + converters: { + upper: function(val) { + return val.toUpperCase(); + } + } + }); + + model = { + selected: "JIM", + people: [ + {name: "bob"}, + {name: "jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + model.selectedOut + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":jim|:new||new-NONE-:none|", + 'data-link="{radiogroup selected convert=... convertBack=... linkTo=...}"'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + model.selectedOut + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":none:bob:jimUpdated|new-JIMUPDATED-:jimUpdated|", + 'data-link="{radiogroup selected convert=... convertBack=... linkTo=...}" - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '
          ' + + ':' + + '{^{for people}}' + + ':' + + '{{/for}}' + + '
          ' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, "JIM|NEW||None-NONE|", + 'data-link="{radiogroup selected}" with labels by for/id'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED|jimUpdated-JIMUPDATED|", + 'data-link="{radiogroup selected}" with labels by for/id - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '
          ' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + + '
          ' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":JIM:JIM|:NEW:NEW||None-:NONE:NONE|", + 'data-link="{radiogroup selected}" - two radiogroups with same selected bindings'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED:NONE:BOB:JIMUPDATED|jimUpdated-:JIMUPDATED:JIMUPDATED|", + 'data-link="{radiogroup selected}" - two radiogroups with same selected bindings - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '
          ' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + + '
          ' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + ); + + model = { + selected: "Jim", + people: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert([{name: "Bob"},{name: "Jim"},{name: "newName"}]); + + res += $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":NONE||:BOB:JIM:NEWNAME:NONE:BOB:JIM:NEWNAME|:JIM:JIM|||Bob-:BOB:BOB|", + 'data-link="{radiogroup selected}" - two radiogroups with same selected bindings - starting out with no items, so no radio buttons'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '
          ' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + + '
          ' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + + '
          ' + ); + + model = { + selected: "Jim", + people: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert([{name: "Bob"},{name: "Jim"},{name: "newName"}]); + + res += $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|" + $("#result input:checked")[0].name + "|" + $("#result input:checked")[1].name; + + // ............................... Assert ................................. + assert.equal(res, ":NONE||:BOB:JIM:NEWNAME:NONE:BOB:JIM:NEWNAME|:JIM:JIM|||Bob-:BOB:BOB|rad1|rad2", + 'data-link="{radiogroup selected}" - name for group can be specified rather than auto-generated - on item or on radiogroup tag'); + + // ................................ Reset ................................ + $("#result").empty(); + +}); + +QUnit.test('data-link="{tag...}"', function(assert) { + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + $.views.tags({ + norendernotemplate: {}, + voidrender: function() {}, + emptyrender: function() { return ""; }, + emptytemplate: { + template: "" + }, + templatereturnsempty: { + template: "{{:a}}" + } + }); + + // ............................... Assert ................................. + $.templates('ab').link("#result", 1); + assert.equal($("#result").text(), "ab", + "non-rendering tag (no template, no render function) renders empty string"); + + $.templates('ab').link("#result", 1); + assert.equal($("#result").text(), "ab", + "non-rendering tag (no template, no return from render function) renders empty string"); + + $.templates('ab').link("#result", 1); + assert.equal($("#result").text(), "ab", + "non-rendering tag (no template, empty string returned from render function) renders empty string"); + + $.templates('ab').link("#result", 1); + assert.equal($("#result").text(), "ab", + "non-rendering tag (template has no content, no render function) renders empty string"); + + $.templates('ab').link("#result", 1); + assert.equal($("#result").text(), "ab", + "non-rendering tag (template returns empty string, no render function) renders empty string"); + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result span").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result span").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link using: '); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result span").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result span").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link using: '); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('
          ') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result div").html(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result div").html(); + + // ............................... Assert ................................. + assert.equal((before + "|" + after).replace(isIE8 ? /\r\n<\/SCRIPT>|\r\n/g : /<\/script>/g, ""), + isIE8 ? 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40' : 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link fnTagEl rendering , using:
          '); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('
            ') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result ul li").html(); // The innerHTML will be "
          • Name: Mr Jo. Width: 30
          • " + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result ul li").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link fnTagElCnt rendering
          • , using:
              '); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('
                ') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result ul li").html(); // The innerHTML will be "
              • Name: Mr Jo. Width: 30
              • " + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result ul li").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link fnTagElCntNoInit rendering
              • , using:
                  '); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result span").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast", "home.address.street": "newStreet"}); + $.observable(settings).setProperty({title: "Sir", width: 40, reverse: false}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result span").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30. Value: true. Prop theTitle: Mr. Prop ~street: StreetOne|Name: Sir compFirst. Width: 40. Value: false.' + + ' Prop theTitle: Sir. Prop ~street: newStreet', + 'Data link using: updates correctly when data changes'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + settings.reverse = true; // reset Prop + address1.street = "StreetOne"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result span").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast", "home.address.street": "newStreet"}); + $.observable(settings).setProperty({title: "Sir", width: 40, reverse: false}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result span").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30. Value: true. Prop theTitle: Mr. Prop ~street: StreetOne|Name: Sir compFirst. Width: 40. Value: false.' + + ' Prop theTitle: Sir. Prop ~street: newStreet', + 'Data link using: updates correctly when data changes'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + settings.reverse = true; // reset Prop + address1.street = "StreetOne"; // reset Prop + +}); + +QUnit.test("Computed observables in paths", function(assert) { + $.views.settings.advanced({_jsv: true}); // For using cbBindings store + + // =============================== Arrange =============================== + var app = { + items: [ + { + name: "one", + row: "1", + expanded: false + }, + { + name: "two", + row: "2", + expanded: false + }, + { + name: "three", + row: "3", + expanded: false + } + ] + }; + + function testTemplate(message, template) { + $.templates(template) + .link("#result", app, { + getItems: function(exp) { + return exp ? ["a", "b"] : []; + } + }); + + // ................................ Act .................................. + var ret = $("#result").text() + "|"; + $.view("#result .groupdata").refresh(); + + $.observable(app.items[0]).setProperty("expanded", true); + ret += $("#result").text() + "|"; + + $.observable(app.items[0]).setProperty("expanded", false); + ret += $("#result").text() + "|"; + + $.observable(app.items[1]).setProperty("expanded", true); + ret += $("#result").text() + "|"; + + $.observable(app.items[1]).setProperty("expanded", false); + ret += $("#result").text() + "|"; + + $.observable(app.items).insert(0, { + name: "added", + row: "+", + expanded: false + }); + ret += $("#result").text() + "|"; + $.observable(app.items).remove(0); + ret += $("#result").text() + "|"; + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(ret, "onetwothree|one1a1btwothree|onetwothree|onetwo2a2bthree|onetwothree|addedonetwothree|onetwothree|", + "Interplay of view and tag refresh in deep content: " + message); + } + + // ............................... Assert ................................. + testTemplate("div", + "{^{for items}}" + + "{{:name}}" + + "{^{for ~getItems(expanded) ~row=row}}" + + "
                  {{:~row}}{{:#data}}
                  " + + "{{/for}}" + + "{{/for}}"); + + // ............................... Assert ................................. + testTemplate("deep div", + "{^{for items}}" + + "{{:name}}" + + "
                  {^{for ~getItems(expanded) ~row=row}}" + + "" + + "{{:~row}}{{:#data}}" + + "{{/for}}
                  " + + "{{/for}}"); + + // ............................... Assert ................................. + testTemplate("deep div2", + "{^{for items}}" + + "{{:name}}" + + "
                  {^{for ~getItems(expanded) ~row=row}}" + + "" + + "{{:~row}}{{:#data}}" + + "{{/for}}
                  " + + "{{/for}}"); + + // ............................... Assert ................................. + testTemplate("li", + "
                    {^{for items}}" + + "
                  • {{:name}}
                  • " + + "
                    • {^{for ~getItems(expanded) ~row=row ~item=#data}}" + + "
                    • " + + "
                    • {{:~row}}{{:#data}}
                    • " + + "{{/for}}
                  • " + + "{{/for}}
                  "); + + // ............................... Assert ................................. + testTemplate("table", + "{^{for items}}" + + "" + + "{^{for ~getItems(expanded) ~row=row}}" + + "" + + "" + + "" + + "{{/for}}" + + " {{/for}}
                  {{:name}}
                  {{:~row}}{{:#data}}
                  "); + + // ............................... Assert ................................. + testTemplate("deep table", + "{^{for items}}" + + "" + + "" + + "{^{for ~getItems(expanded) ~row=row}}" + + "" + + "" + + "" + + "{{/for}}" + + "" + + " {{/for}}
                  {{:name}}
                  {{:~row}}{{:#data}}
                  "); + + // =============================== Arrange =============================== + var ret = "", + people1 = [{address: {street: "1 first street"}}], + people2 = [{address: {street: "1 second street"}}, {address: {street: "2 second street"}}], + data1 = {value: "data1", people: people1}, + data2 = {value: "data2", people: people2}; + app = { + alt: false, + index: 1, + getPeople: getPeople, + getData: getData, + options: { + getWidth: function() { + return "33"; + } + } + }; + + function getPeople(type) { + return this.alt ? people2 : people1; + } + + getPeople.depends = function() { + return [this, "alt"]; // this is app + }; + + function getData(type) { + return this.alt ? data2 : data1; + } + + getData.depends = function(data) { + return [data, "alt"]; // data === this === app + }; + + // ................................ Act .................................. + $.templates("{^{for (getPeople()[index]||{})^address}}{^{:street}}{{/for}}").link("#result", app); + + ret = "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(app).setProperty("index", 0); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(people1[0].address).setProperty("street", "1 first streetB"); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(people1[0]).setProperty("address", {street: "1 first swappedstreet"}); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(app).setProperty("alt", true); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(app).setProperty("index", 1); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(people2[1]).setProperty("address", {street: "2 second swappedstreet"}); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(people2[1].address).setProperty("street", "2 second swappedstreetB"); + ret += "|" + $("#result").text(); + + // ................................ Assert .................................. + assert.equal(ret, "||1 first street|1 first streetB|1 first swappedstreet|1 second street|2 second street|2 second swappedstreet|2 second swappedstreetB", + "deep paths with computed observables bind correctly to rest of path after computed returns new array"); + $("#result").empty(); + + app.alt = false; + app.index = 0; + people1 = [{address: {street: "1 first street"}}, {address: {street: "2 first street"}}]; + people2 = [{address: {street: "1 second street"}}, {address: {street: "2 second street"}}]; + data1 = {value: "data1", people: people1}; + data2 = {value: "data2", people: people2}; + + // ................................ Act .................................. + $.templates("{^{:(getData()^people[index]).address^street}}").link("#result", app); + + ret = $("#result").text(); + + $.observable(app).setProperty("index", 1); + ret += "|" + $("#result").text(); + + $.observable(app).setProperty("index", 0); + ret += "|" + $("#result").text(); + + $.observable(people1[0].address).setProperty("street", "1 first streetB"); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(people1[0]).setProperty("address", {street: "1 first swappedstreet"}); + ret += "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(app).setProperty("alt", true); + ret += "|" + $("#result").text(); + + $.observable(app).setProperty("index", 1); + ret += "|" + $("#result").text(); + + $.observable(people2[1]).setProperty("address", {street: "2 second swappedstreet"}); + ret += "|" + $("#result").text(); + + $.observable(people2[1].address).setProperty("street", "2 second swappedstreetB"); + ret += "|" + $("#result").text(); + + // ................................ Assert .................................. + assert.equal(ret, "1 first street|2 first street|1 first street|1 first streetB|1 first swappedstreet|1 second street|2 second street|2 second swappedstreet|2 second swappedstreetB", + "deep paths with computed observables bind correctly to rest of path after computed returns new object"); + + // ................................ Reset ................................ + $("#result").empty(); + + //TODO allow the following to work by declaring getPeople as depending on collection change of app.alt ? people2 : people; + //$.observable(people2).insert(1, {address:{street: "99 new street"}}) + //ret += "|" + $("#result").text(); + + // =============================== Arrange =============================== + function getValue(a) { + return this.value + "_" + a; + } + function switchAlt() { + $.observable(app).setProperty("alt", !app.alt); + } + + app.alt = false; + app.index = 0; + people1 = [{address: {street: "1 first street"}}]; + people2 = [{address: {street: "1 second street"}}, {address: {street: "2 second street"}}]; + data1 = {value: "val1", people: people1, getValue: getValue}; + data2 = {value: "val2", people: people2, getValue: getValue}; + + // ................................ Act .................................. + $.templates("{^{:getData()^getValue(22)}}").link("#result", app); + + // ................................ Act .................................. + $.observable(app).setProperty("alt", true); + ret = "|A: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |A: val2_22--val1_22 + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{for (getPeople())}}{^{:address.street}}{{/for}}").link("#result", app); + ret += "|B: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |B: 1 first street--1 second street2 second street + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{for getPeople()}}{^{:address.street}}{{/for}}").link("#result", app); + ret += "|C: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |C: 1 second street2 second street--1 first street + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{:(getData()^getValue(22))}}").link("#result", app); + ret += "|D: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |D: val1_22--val2_22 + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{:getData()^getValue((getData()^getValue(33)))}}").link("#result", app); + ret += "|E: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // E: val2_val2_33--val1_val1_33 + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{:getData(getPeople(getData(alt || 2)^getValue())^length)^value}}").link("#result", app); + ret += "|F: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |F: val1--val2 + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{for (getPeople()[index]||{})^address}}{^{:street}}{{/for}}").link("#result", app); + ret += "|G: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |G: 1 second street--1 first street + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{:(((getData())^people[0])^address.street)}}").link("#result", app); + ret += "|H: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |H: 1 first street--1 second street + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{:'b'+((getData()^value) + ('a'+getData()^value)) + getData()^getValue(55)}}").link("#result", app); + ret += "|I: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |I: bval2aval2val2_55--bval1aval1val1_55 + $("#result").empty(); + + // ................................ Act .................................. + $.templates("{^{:'a' + getData()^value}}").link("#result", app); + ret += "|J: " + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); // |J: aval1--aval2 + $("#result").empty(); + + // =============================== Arrange =============================== + getValue.depends = "value"; + + // ................................ Act .................................. + $.templates("{^{:getData()^getValue((getData()^getValue(33)))}}").link("#result", app); + ret += "|K: " + $("#result").text(); + $.observable(data2).setProperty("value", "newVal1"); + ret += "--" + $("#result").text(); + switchAlt(); + ret += "--" + $("#result").text(); + $.observable(data1).setProperty("value", "newVal2"); + ret += "--" + $("#result").text(); // |K: val2_val2_33--newVal1_newVal1_33--val1_val1_33--newVal2_newVal2_33 + + // ................................ Act .................................. + $("#result").empty(); + ret += "|L: " + !!$._data(data1).events + " " + !!$._data(data1).events + " " + (JSON.stringify(_jsv.cbBindings) === "{}"); + // |L: false false true + // ................................ Assert .................................. + assert.equal(ret, + "|A: val2_22--val1_22|" + + "B: 1 first street--1 second street2 second street|" + + "C: 1 second street2 second street--1 first street|" + + "D: val1_22--val2_22|" + + "E: val2_val2_33--val1_val1_33|" + + "F: val1--val2|" + + "G: 1 second street--1 first street|" + + "H: 1 first street--1 second street|" + + "I: bval2aval2val2_55--bval1aval1val1_55|" + + "J: aval1--aval2|" + + "K: val2_val2_33--newVal1_newVal1_33--val1_val1_33--newVal2_newVal2_33|" + + "L: false false true", + "deep paths with computed observables bind correctly to rest of path after computed returns new object or array, including complex expressions, wrapped in parens etc."); + + // =============================== Arrange =============================== + + ret = ""; + var model = { + enabled: function(val) { + if (!arguments.length) { + return this._enabled + this._selected + this._colored; + } + this._enabled = val; + }, + selected: function(val) { + if (!arguments.length) { + return this._selected; + } + this._selected = val; + }, + colored: function(val) { + if (!arguments.length) { + return this._colored; + } + this._colored = val; + }, + _colored: "C", + _enabled: "E", + _selected: "S" + }; + + model.selected.set = model.colored.set = model.enabled.set = true; + + model.enabled.depends = [,"selected"]; + + $.templates('
                  ').link("#result", model); + + // ................................ Act .................................. + + ret = $._data(model).events.propertyChange.length + "_"; + + $.observable(model).setProperty("selected", "s2"); + + ret += $("#result").text(); + + assert.equal(ret, "1_ESC", 'Computed function with depends = [undefined,"selected"] - no listener added'); + + // ................................ Reset ................................ + model.selected("S"); + $("#result").empty(); + + // =============================== Arrange =============================== + + model.enabled.depends = [,"selected", model, "colored"]; + + $.templates('
                  ').link("#result", model); + + // ................................ Act .................................. + + ret = $._data(model).events.propertyChange.length + "_"; + + $.observable(model).setProperty("selected", "s2"); + + ret += $("#result").text() + "_"; + + $.observable(model).setProperty("colored", "c3"); + + ret += $("#result").text(); + + assert.equal(ret, "2_ESC_Es2c3", 'Computed function with depends = [undefined,"selected", model, "colored"] - has listener for "colored" only'); + + // ................................ Reset ................................ + model.selected("S"); + model.colored("C"); + $("#result").empty(); + + // =============================== Arrange =============================== + + model.enabled.depends = ["enabled"]; + + $.templates('
                  ').link("#result", model); + + // ................................ Act .................................. + + ret = $._data(model).events.propertyChange.length + "_"; + + $.observable(model).setProperty("enabled", "e2"); + + ret += $("#result").text(); + + assert.equal(ret, "1_e2SC", "Computed function with circular depends - no stack overflow - handler skipped"); + + // ................................ Reset ................................ + $("#result").empty(); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("Computed observables in $.link() expressions", function(assert) { + + (function() { + // =============================== Arrange =============================== + var res = ""; + + $("#result").html(''); + + function ob() { + return helpers.alt ? this._obB : this._obA; + } + + ob.depends = "~helpers.alt"; + + function address() { + return this._address; + } + + function setAddress(val) { + this._address = val; + } + + address.set = setAddress; + + var helpers = {alt: false}; + + var person = { + changeAlt: changeAlt, + changeHome: changeHome, + changeObtype: changeObtype, + changeAddress: changeAddress, + changeStreet: changeStreet, + ob: ob, + _obA: { + home: { + _address: { + street: "A" + }, + address: address + }, + obtype: "a" + }, + _obB: { + home: { + _address: { + street: "B" + }, + address: address + }, + obtype: "b" + } + }; + + function changeHome(label) { + $.observable(person.ob()).setProperty("home", { + _address: { + street: person.ob().home.address().street + "$" + }, + address: address + }); + } + + function changeAlt(label) { + $.observable(helpers).setProperty("alt", !helpers.alt); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeObtype(label) { + $.observable(person.ob()).setProperty("obtype", person.ob().obtype + "@"); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeAddress(label) { + $.observable(person.ob().home).setProperty("address", {street: person.ob().home.address().street + "+"}); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeStreet(label) { + $.observable(person.ob().home.address()).setProperty("street", person.ob().home.address().street + ">"); + res += " |" + label + ": " + $("#inner").text(); + } + + $.link("ob()^obtype", "#inner", person, {helpers: helpers}); + + // ................................ Act .................................. + + changeAlt(1); + changeObtype(2); + changeAlt(3); + changeObtype(4); + changeAlt(5); + + // ............................... Assert ................................. + assert.equal(res, " |1: b |2: b@ |3: a |4: a@ |5: b@", "complex"); + + // ................................ Reset ................................ + $("#result").empty(); + })(); + + (function() { + // =============================== Arrange =============================== + var res = ""; + + $("#result").html(''); + + function ob(alt) { + return alt ? this._obB : this._obA; + } + + function address() { + return this._address; + } + + function setAddress(val) { + this._address = val; + } + + address.set = setAddress; + + var helpers = {alt: false}; + + var person = { + changeAlt: changeAlt, + changeHome: changeHome, + changeObtype: changeObtype, + changeAddress: changeAddress, + changeStreet: changeStreet, + ob: ob, + _obA: { + home: { + _address: { + street: "A" + }, + address: address + }, + obtype: "a" + }, + _obB: { + home: { + _address: { + street: "B" + }, + address: address + }, + obtype: "b" + } + }; + + function changeHome(label) { + $.observable(person.ob(helpers.alt)).setProperty("home", { + _address: { + street: person.ob(helpers.alt).home.address().street + "$" + }, + address: address + }); + } + + function changeAlt(label) { + $.observable(helpers).setProperty("alt", !helpers.alt); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeObtype(label) { + $.observable(person.ob(helpers.alt)).setProperty("obtype", person.ob(helpers.alt).obtype + "@"); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeAddress(label) { + $.observable(person.ob(helpers.alt).home).setProperty("address", {street: person.ob(helpers.alt).home.address().street + "+"}); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeStreet(label) { + $.observable(person.ob(helpers.alt).home.address()).setProperty("street", person.ob(helpers.alt).home.address().street + ">"); + res += " |" + label + ": " + $("#inner").text(); + } + + $.link("ob(~helpers.alt)^home.address().street", "#inner", person, {helpers: helpers}); + + // ................................ Act .................................. + + changeAddress(1); + changeStreet(2); + changeAddress(3); + changeStreet(4); + changeAlt(5); + changeAddress(6); + changeStreet(7); + changeAddress(8); + changeStreet(9); + changeAlt(10); + changeStreet(11); + changeAddress(12); + changeStreet(13); + changeAddress(14); + changeAlt(15); + + // ............................... Assert ................................. + assert.equal(res, " |1: A+ |2: A+> |3: A+>+ |4: A+>+> |5: B |6: B+ |7: B+> |8: B+>+ |9: B+>+> |10: A+>+> |11: A+>+>> |12: A+>+>>+ |13: A+>+>>+> |14: A+>+>>+>+ |15: B+>+>", "complex"); + + // ................................ Reset ................................ + $("#result").empty(); + })(); + + (function() { + // =============================== Arrange =============================== + var res = ""; + + $("#result").html(''); + + function ob() { + return helpers.alt ? this._obB : this._obA; + } + ob.depends = "~helpers.alt"; + + function address(val) { + if (!arguments.length) { + return helpers.alt ? this._address2 : this._address; + } + if (helpers.alt) { + this._address2 = val; + } else { + this._address = val; + } + } + address.set = true; + + address.depends = "~helpers.alt"; + + var helpers = {alt: false}; + + var person = { + changeAlt: changeAlt, + changeHome: changeHome, + changeObtype: changeObtype, + changeAddress: changeAddress, + changeStreet: changeStreet, + ob: ob, + _obA: { + home: { + _address: { + street: "A" + }, + _address2: { + street: "A2" + }, + address: address + }, + obtype: "a" + }, + _obB: { + home: { + _address: { + street: "B" + }, + _address2: { + street: "B2" + }, + address: address + }, + obtype: "b" + } + }; + + function changeHome(label) { + $.observable(person.ob()).setProperty("home", { + _address: { + street: person.ob().home.address().street + "$" + }, + address: address + }); + } + + function changeAlt(label) { + $.observable(helpers).setProperty("alt", !helpers.alt); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeObtype(label) { + $.observable(person.ob()).setProperty("obtype", person.ob().obtype + "@"); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeAddress(label) { + $.observable(person.ob().home).setProperty("address", {street: person.ob().home.address().street + "+"}); + res += " |" + label + ": " + $("#inner").text(); + } + + function changeStreet(label) { + $.observable(person.ob().home.address()).setProperty("street", person.ob().home.address().street + ">"); + res += " |" + label + ": " + $("#inner").text(); + } + + $.link("ob()^home.address().street", "#inner", person, {helpers: helpers}); + + // ................................ Act .................................. + + changeAddress(1); + changeStreet(2); + changeAddress(3); + changeStreet(4); + changeAlt(5); + changeAddress(6); + changeStreet(7); + changeAddress(8); + changeStreet(9); + changeAlt(10); + changeStreet(11); + changeAddress(12); + changeStreet(13); + changeAddress(14); + changeAlt(15); + + // ............................... Assert ................................. + assert.equal(res, " |1: A+ |2: A+> |3: A+>+ |4: A+>+> |5: B2 |6: B2+ |7: B2+> |8: B2+>+ |9: B2+>+> |10: A+>+> |11: A+>+>> |12: A+>+>>+ |13: A+>+>>+> |14: A+>+>>+>+ |15: B2+>+>", "complex"); + + // ................................ Reset ................................ + $("#result").empty(); + })(); + +}); + +QUnit.test("Computed observables in two-way binding", function(assert) { +var done = assert.async(); + + // =============================== Arrange =============================== + var fullName = function(reversed) { + return reversed + ? this.lastName + " " + this.firstName + : this.firstName + " " + this.lastName; + }; + + var person = { + firstName: "Jeff", + lastName: "Smith", + fullName: fullName + }; + + fullName.depends = "*"; + + fullName.set = function(val) { + val = val.split(" "); + $.observable(this).setProperty({ + lastName: val.pop(), + firstName: val.join(" ") + }); + }; + + $.templates('{^{:firstName}} {^{:lastName}} {^{:fullName()}} {^{:fullName(true)}} ') + .link("#result", person); + + // ................................ Act .................................. + var res = $("#result").text() + $("#full").val(); + + $.observable(person).setProperty({firstName: "newFirst", lastName: "newLast"}); + + res += "|" + $("#result").text() + $("#full").val(); + + $.observable(person).setProperty({fullName: "compFirst compLast"}); + + res += "|" + $("#result").text() + $("#full").val(); + + keydown($("#full").val("2wayFirst 2wayLast")); + +setTimeout(function() { + res += "|" + $("#result").text() + $("#full").val(); + + // ............................... Assert ................................. + assert.equal(res, + isIE8 + ? "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirstnewLastnewFirst newLastnewLast newFirst newFirst newLast|compFirstcompLastcompFirst" + + " compLastcompLast compFirst compFirst compLast|2wayFirst2wayLast2wayFirst 2wayLast2wayLast 2wayFirst 2wayFirst 2wayLast" + : "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirst newLast newFirst newLast newLast newFirst newFirst newLast|compFirst compLast compFirst" + + " compLast compLast compFirst compFirst compLast|2wayFirst 2wayLast 2wayFirst 2wayLast 2wayLast 2wayFirst 2wayFirst 2wayLast", + 'Two-way binding to a computed observable data property correctly calls the setter'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + fullName = function(reversed) { + return reversed + ? this.lastName + " " + this.firstName() + : this.firstName() + " " + this.lastName; + }; + + fullName.depends = ["firstName", "lastName"]; + + fullName.set = function(val) { + val = val.split(" "); + $.observable(this).setProperty({ + lastName: val.pop(), + firstName: val.join(" ") + }); + }; + + // Constructor + var Person = function(first, last) { + this._firstName = first; + this.lastName = last; + }, + + // Prototype + personProto = { + // Computed firstName + firstName: function() { + return this._firstName; + }, + // Computed fullName + fullName: fullName + }; + + personProto.firstName.set = function(val) { + this._firstName = val; + }; + + Person.prototype = personProto; + + var person = new Person("Jeff", "Smith"); + + $.templates('{^{:firstName()}} {^{:lastName}} {^{:fullName()}} {^{:fullName(true)}} ') + .link("#result", person); + + // ................................ Act .................................. + res = $("#result").text() + $("#full").val(); + + $.observable(person).setProperty({firstName: "newFirst", lastName: "newLast"}); + + res += "|" + $("#result").text() + $("#full").val(); + + $.observable(person).setProperty({fullName: "compFirst compLast"}); + + res += "|" + $("#result").text() + $("#full").val(); + + keydown($("#full").val("2wayFirst 2wayLast")); + +setTimeout(function() { + res += "|" + $("#result").text() + $("#full").val(); + + // ............................... Assert ................................. + assert.equal(res, + isIE8 + ? "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirstnewLastnewFirst newLastnewLast newFirst newFirst newLast|compFirstcompLastcompFirst" + + " compLastcompLast compFirst compFirst compLast|2wayFirst2wayLast2wayFirst 2wayLast2wayLast 2wayFirst 2wayFirst 2wayLast" + : "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirst newLast newFirst newLast newLast newFirst newFirst newLast|compFirst compLast compFirst" + + " compLast compLast compFirst compFirst compLast|2wayFirst 2wayLast 2wayFirst 2wayLast 2wayLast 2wayFirst 2wayFirst 2wayLast", + 'Two-way binding to a computed observable data property defined on the prototype correctly calls the setter'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + fullName = function(reverse) { + var person = this.data; // this pointer is the view + return reverse + ? person.lastName + " " + person.firstName + : person.firstName + " " + person.lastName; + } + + fullName.depends = function(data) { + return [this, "firstName", data, "lastName"]; // this and data are both contextual data object + }; + + fullName.set = function(val) { + val = val.split(" "); + var person = this.data; // this pointer is the view + $.observable(person).setProperty({ + lastName: val.pop(), + firstName: val.join(" ") + }); + }; + + var people = [ + { + firstName: "Jeff", + lastName: "Friedman" + }, + { + firstName: "Rose", + lastName: "Lee" + } + ]; + + $.templates('{^{:firstName}} {^{:lastName}} {^{:~fullName()}} {^{:~fullName(true)}} ') + .link("#result", people, {fullName: fullName}); + + // ................................ Act .................................. + res = $("#result").text() + ":" + $("#full0").val(); + + $.observable(people[0]).setProperty({firstName: "newFirst", lastName: "newLast"}); + + res += "|" + $("#result").text() + ":" + $("#full0").val(); + + keydown($("#full0").val("2wayFirst 2wayLast")); + +setTimeout(function() { + res += "|" + $("#result").text() + ":" + $("#full0").val(); + + // ............................... Assert ................................. + assert.equal(res, + isIE8 + ? "Jeff Friedman Jeff Friedman Friedman Jeff Rose Lee Rose Lee Lee Rose :Jeff Friedman|" + + "newFirstnewLastnewFirst newLastnewLast newFirst Rose LeeRose LeeLee Rose :newFirst newLast|" + + "2wayFirst2wayLast2wayFirst 2wayLast2wayLast 2wayFirst Rose LeeRose LeeLee Rose :2wayFirst 2wayLast" + : "Jeff Friedman Jeff Friedman Friedman Jeff Rose Lee Rose Lee Lee Rose :Jeff Friedman|" + + "newFirst newLast newFirst newLast newLast newFirst Rose Lee Rose Lee Lee Rose :newFirst newLast|" + + "2wayFirst 2wayLast 2wayFirst 2wayLast 2wayLast 2wayFirst Rose Lee Rose Lee Lee Rose :2wayFirst 2wayLast", + 'Two-way binding to a computed observable data property passed in as helper calls the setter'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + // See https://github.com/BorisMoore/jsviews/issues/287 + // From Paul Martin pull request: https://github.com/Paul-Martin/jsviews.com/commit/10d716ccd0d6478dea042faeeca64bf44e4642ed + + function getsetA(val) { + if (!arguments.length) { + return this._a; + } + this._a = val; + } + getsetA.set = true; + + function getsetB(val) { + if (!arguments.length) { + return this._b; + } + this._b = val; + } + getsetB.set = true; + + function Root(a) { + this._a = a; + this.a = getsetA; + } + + function A(b) { + this._b = b; + this.b = getsetB; + } + + var o1 = new Root(new A('one')), + o2 = new Root(new A('two')), + + tmpl = $.templates(''); + + $("#result").html("
                  "); + + tmpl.link('#one', o1); + tmpl.link('#two', o2); + + // ................................ Act .................................. + res = ""; + var input1 = $("#one input"), + input2 = $("#two input"), + span1 = $("#one span"), + span2 = $("#two span"), + + getResult = function() { + res += input1.val() + " " + span1.text() + " " + input2.val() + " " + span2.text() + "|"; + }; + + getResult(); + + keydown(input1.val('onechange')); + +setTimeout(function() { + getResult(); + + keydown(input2.val('twochange')); + +setTimeout(function() { + getResult(); + + $.observable(o1.a()).setProperty('b', 'oneupdate'); + + getResult(); + + $.observable(o2.a()).setProperty('b', 'twoupdate'); + + getResult(); + + // ............................... Assert ................................. + assert.equal(res, + "one one two two|" + + "onechange onechange two two|" + + "onechange onechange twochange twochange|" + + "oneupdate oneupdate twochange twochange|" + + "oneupdate oneupdate twoupdate twoupdate|", + 'Two-way bindings with chained computed observables remain independent when same template links to multiple target elements'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + people = [ + { + name: "n0", + _address: { + street: "s0" + }, + ob: function() { return this; }, + address: function() { + return this._address; + } + }, + { + name: "n1", + _address: { + street: "s1" + }, + ob: function() { return this; }, + address: function() { + return this._address; + } + } + ]; + + tmpl = $.templates( + "
                  " + + " {^{:ob().name}}" + + " {^{:ob().address().street}}" + + "
                  "); + + tmpl.link("#result", people); + + // ................................ Act .................................. + res = ""; + var nameInput0 = $("#result .person0 input.name"), + nameSpan0 = $("#result .person0 span.name"), + streetInput0 = $("#result .person0 input.street"), + streetSpan0 = $("#result .person0 span.street"), + nameInput1 = $("#result .person1 input.name"), + nameSpan1 = $("#result .person1 span.name"), + streetInput1 = $("#result .person1 input.street"), + streetSpan1 = $("#result .person1 span.street"); + + getResult = function() { + res += nameInput0.val() + " " + nameSpan0.text() + " " + streetInput0.val() + " " + streetSpan0.text() + " " + nameInput1.val() + " " + nameSpan1.text() + " " + streetInput1.val() + " " + streetSpan1.text() + "|"; + } + + getResult(); + + keydown(nameInput0.val('n0new')); + +setTimeout(function() { + getResult(); + + keydown(nameInput1.val('n1new')); + +setTimeout(function() { + getResult(); + + keydown(streetInput0.val('s0new')); + +setTimeout(function() { + getResult(); + + keydown(streetInput1.val('s1new')); + +setTimeout(function() { + getResult(); + + $.observable(people[0]).setProperty('name', 'n0update'); + + getResult(); + + $.observable(people[0].address()).setProperty('street', 's0update'); + + getResult(); + + $.observable(people[1]).setProperty('name', 'n1update'); + + getResult(); + + $.observable(people[1].address()).setProperty('street', 's1update'); + + getResult(); + + $.observable(people).remove(1); + + $.observable(people).insert({ + name: "n1inserted", + _address: { + street: "s1inserted", + address: function() { + return this; + } + }, + ob: function() { return this; }, + address: function() { + return this._address; + } + }); + + nameInput1 = $("#result .person1 input.name"); + nameSpan1 = $("#result .person1 span.name"); + streetInput1 = $("#result .person1 input.street"); + streetSpan1 = $("#result .person1 span.street"); + + getResult(); + + // ............................... Assert ................................. + assert.equal(res, + "n0 n0 s0 s0 n1 n1 s1 s1|" + + "n0new n0new s0 s0 n1 n1 s1 s1|" + + "n0new n0new s0 s0 n1new n1new s1 s1|" + + "n0new n0new s0new s0new n1new n1new s1 s1|" + + "n0new n0new s0new s0new n1new n1new s1new s1new|" + + "n0update n0update s0new s0new n1new n1new s1new s1new|" + + "n0update n0update s0update s0update n1new n1new s1new s1new|" + + "n0update n0update s0update s0update n1update n1update s1new s1new|" + + "n0update n0update s0update s0update n1update n1update s1update s1update|" + + "n0update n0update s0update s0update n1inserted n1inserted s1inserted s1inserted|", + 'Two-way bindings with chained computed observables remain independent when same template links different elements of an array'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + people = [ + { + name: "n0", + _address: { + street: "s0" + }, + ob: function() { return this; }, + address: function() { + return this._address; + } + }, + { + name: "n1", + _address: { + street: "s1" + }, + ob: function() { return this; }, + address: function() { + return this._address; + } + } + ]; + + tmpl = $.templates( + "{^{for people}}
                  " + + " {^{:ob().name}}" + + " {^{:ob().address().street}}" + + "
                  {{/for}}"); + + tmpl.link("#result", {people: people}); + + // ................................ Act .................................. + res = ""; + nameInput0 = $("#result .person0 input.name"); + nameSpan0 = $("#result .person0 span.name"); + streetInput0 = $("#result .person0 input.street"); + streetSpan0 = $("#result .person0 span.street"); + nameInput1 = $("#result .person1 input.name"); + nameSpan1 = $("#result .person1 span.name"); + streetInput1 = $("#result .person1 input.street"); + streetSpan1 = $("#result .person1 span.street"); + + getResult = function() { + res += nameInput0.val() + " " + nameSpan0.text() + " " + streetInput0.val() + " " + streetSpan0.text() + " " + nameInput1.val() + " " + nameSpan1.text() + " " + streetInput1.val() + " " + streetSpan1.text() + "|"; + }; + + getResult(); + + keydown(nameInput0.val('n0new')); + +setTimeout(function() { + getResult(); + + keydown(nameInput1.val('n1new')); + +setTimeout(function() { + getResult(); + + keydown(streetInput0.val('s0new')); + +setTimeout(function() { + getResult(); + + keydown(streetInput1.val('s1new')); + +setTimeout(function() { + getResult(); + + $.observable(people[0]).setProperty('name', 'n0update'); + + getResult(); + + $.observable(people[0].address()).setProperty('street', 's0update'); + + getResult(); + + $.observable(people[1]).setProperty('name', 'n1update'); + + getResult(); + + $.observable(people[1].address()).setProperty('street', 's1update'); + + getResult(); + + $.observable(people).remove(1); + + $.observable(people).insert({ + name: "n1inserted", + _address: { + street: "s1inserted" + }, + ob: function() {return this; }, + address: function() { + return this._address; + } + }); + + nameInput1 = $("#result .person1 input.name"); + nameSpan1 = $("#result .person1 span.name"); + streetInput1 = $("#result .person1 input.street"); + streetSpan1 = $("#result .person1 span.street"); + + getResult(); + + // ............................... Assert ................................. + assert.equal(res, + "n0 n0 s0 s0 n1 n1 s1 s1|" + + "n0new n0new s0 s0 n1 n1 s1 s1|" + + "n0new n0new s0 s0 n1new n1new s1 s1|" + + "n0new n0new s0new s0new n1new n1new s1 s1|" + + "n0new n0new s0new s0new n1new n1new s1new s1new|" + + "n0update n0update s0new s0new n1new n1new s1new s1new|" + + "n0update n0update s0update s0update n1new n1new s1new s1new|" + + "n0update n0update s0update s0update n1update n1update s1new s1new|" + + "n0update n0update s0update s0update n1update n1update s1update s1update|" + + "n0update n0update s0update s0update n1inserted n1inserted s1inserted s1inserted|", + 'Two-way bindings with chained computed observables remain independent when same {{for}} block links different elements of an array'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + people = [ + { + name: "n0", + _address: { + street: "s0" + }, + ob: function() { return this; }, + address: function() { + return this._address; + } + }, + { + name: "n1", + _address: { + street: "s1" + }, + ob: function() { return this; }, + address: function() { + return this._address; + } + } + ]; + + tmpl = $.templates( + "
                  " + + " {^{:ob().name}}" + + " {^{:ob().address().street}}" + + "
                  "); + + tmpl.link("#result", people); + + // ................................ Act .................................. + res = ""; + nameInput0 = $("#result .person0 input.name"); + nameSpan0 = $("#result .person0 span.name"); + streetInput0 = $("#result .person0 input.street"); + streetSpan0 = $("#result .person0 span.street"); + nameInput1 = $("#result .person1 input.name"); + nameSpan1 = $("#result .person1 span.name"); + streetInput1 = $("#result .person1 input.street"); + streetSpan1 = $("#result .person1 span.street"); + + getResult = function() { + res += nameInput0.val() + " " + nameSpan0.text() + " " + streetInput0.val() + " " + streetSpan0.text() + " " + nameInput1.val() + " " + nameSpan1.text() + " " + streetInput1.val() + " " + streetSpan1.text() + "|"; + }; + + getResult(); + + keydown(nameInput0.val('n0new')); + +setTimeout(function() { + getResult(); + + keydown(nameInput1.val('n1new')); + +setTimeout(function() { + getResult(); + + keydown(streetInput0.val('s0new')); + +setTimeout(function() { + getResult(); + + keydown(streetInput1.val('s1new')); + +setTimeout(function() { + getResult(); + + // ............................... Assert ................................. + assert.equal(res, + "n0 n0 s0 s0 n1 n1 s1 s1|" + + "n0new n0 n0new n0new n1 n1 s1 s1|" + + "n0new n0 n0new n0new n1new n1 n1new n1new|" + + "s0new s0new s0new n0new n1new n1 n1new n1new|" + + "s0new s0new s0new n0new s1new s1new s1new n1new|", + 'Two-way bindings with chained computed observables using linkTo remain independent when same template links different elements of an array'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + function ob() { + return this.alt ? this._obB : this._obA; + } + ob.depends = "alt"; + + function change() { + $.observable(this._address).setProperty("street", this._address.street + "+"); + } + + function switchAlt() { + $.observable(this).setProperty("alt", !this.alt); + } + + people = [ + { + alt: false, + ob: ob, + switchAlt: switchAlt, + _obA: { + change: change, + _address: { + street: "A0" + }, + address: function() { + return this._address; + } + }, + _obB: { + change: change, + _address: { + street: "B0" + }, + address: function() { + return this._address; + } + } + }, + { + alt: false, + ob: ob, + switchAlt: switchAlt, + _obA: { + change: change, + _address: { + street: "A1" + }, + address: function() { + return this._address; + } + }, + _obB: { + change: change, + _address: { + street: "B1" + }, + address: function() { + return this._address; + } + } + } + ]; + + tmpl = $.templates( + "
                  " + + "" + + "" + + "" + + "" + + " " + + " " + + "" + + "" + + "" + + "
                  "); + + tmpl.link("#result", people); + + // ................................ Act .................................. + res = ""; + var toStreet1_0 = $("#result .person0 input.toStreet1"), + toStreet2_0 = $("#result .person0 input.toStreet2"), + toStreetA_0 = $("#result .person0 input.toStreetA"), + toStreetB_0 = $("#result .person0 input.toStreetB"), + spanStreet1_0 = $("#result .person0 span.street1"), + spanStreet2_0 = $("#result .person0 span.street2"), + street1_0 = $("#result .person0 input.street1"), + street2_0 = $("#result .person0 input.street2"), + streetA_0 = $("#result .person0 input.streetA"), + streetB_0 = $("#result .person0 input.streetB"), + + toStreet1_1 = $("#result .person1 input.toStreet1"), + toStreet2_1 = $("#result .person1 input.toStreet2"), + toStreetA_1 = $("#result .person1 input.toStreetA"), + toStreetB_1 = $("#result .person1 input.toStreetB"), + spanStreet1_1 = $("#result .person1 span.street1"), + spanStreet2_1 = $("#result .person1 span.street2"), + street1_1 = $("#result .person1 input.street1"), + street2_1 = $("#result .person1 input.street2"), + streetA_1 = $("#result .person1 input.streetA"), + streetB_1 = $("#result .person1 input.streetB"); + + getResult = function(name) { + res += name + ":" + spanStreet1_0.text() + " " + spanStreet2_0.text() + " " + street1_0.val() + " " + street2_0.val() + " " + streetA_0.val() + " " + streetB_0.val() + + " " + spanStreet1_1.text() + " " + spanStreet2_1.text() + " " + street1_1.val() + " " + street2_1.val() + " " + streetA_1.val() + " " + streetB_1.val() + "|"; + }; + + getResult(1); + + people[0]._obA.change(); + people[0]._obB.change(); + getResult(2); + + people[0].switchAlt(); + + getResult(3); + + people[0]._obA.change(); + people[0]._obB.change(); + getResult(4); + + people[0].switchAlt(); + getResult(5); + + people[1].ob().change(); + getResult(6); + + people[1].switchAlt(); + getResult(7); + + people[1].ob().change(); + getResult(8); + + keydown(toStreet1_0.val("new1")); + +setTimeout(function() { + getResult(9); + + keydown(toStreet2_0.val("new2")); + +setTimeout(function() { + getResult(10); + + keydown(toStreetA_0.val("new3")); + +setTimeout(function() { + getResult(11); + + keydown(toStreetB_0.val("new4")); + +setTimeout(function() { + getResult(12); + + keydown(toStreet1_1.val("new5")); + +setTimeout(function() { + getResult(13); + + keydown(toStreet2_1.val("new6")); + +setTimeout(function() { + getResult(14); + + keydown(toStreetA_1.val("new7")); + +setTimeout(function() { + getResult(15); + + keydown(toStreetB_1.val("new8")); + +setTimeout(function() { + getResult(16); + + // ............................... Assert ................................. + assert.equal(res, + "1:A0 A0 A0 A0 A0 B0 A1 A1 A1 A1 A1 B1|" + + "2:A0+ A0+ A0+ A0+ A0+ B0+ A1 A1 A1 A1 A1 B1|" + + "3:B0+ B0+ B0+ B0+ A0+ B0+ A1 A1 A1 A1 A1 B1|" + + "4:B0++ B0++ B0++ B0++ A0++ B0++ A1 A1 A1 A1 A1 B1|" + + "5:A0++ A0++ A0++ A0++ A0++ B0++ A1 A1 A1 A1 A1 B1|" + + "6:A0++ A0++ A0++ A0++ A0++ B0++ A1+ A1+ A1+ A1+ A1+ B1|" + + "7:A0++ A0++ A0++ A0++ A0++ B0++ B1 B1 B1 B1 A1+ B1|" + + "8:A0++ A0++ A0++ A0++ A0++ B0++ B1+ B1+ B1+ B1+ A1+ B1+|" + + "9:new1 new1 new1 new1 new1 B0++ B1+ B1+ B1+ B1+ A1+ B1+|" + + "10:new2 new2 new2 new2 new2 B0++ B1+ B1+ B1+ B1+ A1+ B1+|" + + "11:new3 new3 new3 new3 new3 B0++ B1+ B1+ B1+ B1+ A1+ B1+|" + + "12:new3 new3 new3 new3 new3 new4 B1+ B1+ B1+ B1+ A1+ B1+|" + + "13:new3 new3 new3 new3 new3 new4 new5 new5 new5 new5 A1+ new5|" + + "14:new3 new3 new3 new3 new3 new4 new6 new6 new6 new6 A1+ new6|" + + "15:new3 new3 new3 new3 new3 new4 new6 new6 new6 new6 new7 new6|" + + "16:new3 new3 new3 new3 new3 new4 new8 new8 new8 new8 new7 new8|", + 'Two-way bindings with chained computed observables with or without linkTo remain independent when multiple bindings in same tag block use same path expression'); + + // ................................ Reset ................................ + $("#result").empty(); + +done(); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}); + +QUnit.test("Chained computed observables in template expressions", function(assert) { + + (function() { + // =============================== Arrange =============================== + function ob() { + return helpers.alt ? this._obB : this._obA; + } + + ob.depends = "~helpers.alt"; + + ob.set = function(val) { + if (helpers.alt) { + this._obB = val; + } else { + this._obA = val; + } + }; + + function address() { + return this._address; + } + + function setAddress(val) { + this._address = val; + } + + address.set = setAddress; + + var res, resCount, helpers, ch, person, person2, data; + + function setData() { + res = ""; + resCount = 1; + ch = 0; + + helpers = {alt: false}; + + person = { + ob: ob, + _obA: { + home: { + _address: { + street: "A" + }, + _address2: { + street: "A2" + }, + address: address + } + }, + _obB: { + home: { + _address: { + street: "B" + }, + _address2: { + street: "B2" + }, + address: address + } + } + }; + person2 = { + ob: ob, + _obA: { + home: { + _address: { + street: "xA" + }, + _address2: { + street: "xA2" + }, + address: address + } + }, + _obB: { + home: { + _address: { + street: "xB" + }, + _address2: { + street: "xB2" + }, + address: address + } + } + }; + data = {person: person}; + } + + function swapPerson() { + $.observable(data).setProperty("person", data.person === person ? person2 : person); + } + + function changeAlt() { + $.observable(helpers).setProperty("alt", !helpers.alt); + } + + function changeOb() { + $.observable(data.person).setProperty("ob", { + home: { + _address: { + street: data.person.ob().home._address.street + ch++ + }, + _address2: { + street: data.person.ob().home._address2.street + ch + }, + address: address + } + }); + } + + function changeHome() { + $.observable(data.person.ob()).setProperty("home", { + _address: { + street: data.person.ob().home._address.street + "$" + }, + _address2: { + street: data.person.ob().home._address2.street + "$" + }, + address: address + }); + } + + function changeAddress() { + $.observable(data.person.ob().home).setProperty("address", {street: data.person.ob().home.address().street + "+"}); + } + + function changeStreet() { + $.observable(data.person.ob().home.address()).setProperty("street", data.person.ob().home.address().street + ">"); + } + + function getResult(name) { + res += (name||resCount++) + ": " + $("#result").text() + " |"; + } + + var tmpl = $.templates(""); + + setData(); + + tmpl.link("#result", data, {helpers: helpers}); + + // ................................ Act .................................. + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeOb(); + getResult("Ob"); + + changeAlt(); + getResult("Alt"); + + changeHome(); + getResult("Home"); + + changeAddress(); + getResult("Address"); + + changeStreet(); + getResult("Street"); + + swapPerson(); + getResult("Person"); + + changeHome(); + getResult("Home"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeOb(); + getResult("Ob"); + + changeHome(); + getResult("Home"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + // ............................... Assert ................................. + assert.equal(res, "None: A |Street: A> |Address: A>+ |Home: A>+$ |Ob: A>+$0 |Alt: B |Home: B$ |Address: B$+ |Street: B$+> |Person: xB |" + + "Home: xB$ |Street: xB$> |Address: xB$>+ |Ob: xB$>+1 |Home: xB$>+1$ |Street: xB$>+1$> |Address: xB$>+1$>+ |", + "Deep path with chained observables, binding to full depth: person^ob().home.address().street"); + + // ................................ Reset ................................ + $("#result").empty(); + setData(); + + // =============================== Arrange =============================== + tmpl = $.templates(""); + + tmpl.link("#result", data, {helpers: helpers}); + + // ................................ Act .................................. + + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeOb(); + getResult("Ob"); + + changeAlt(); + getResult("Alt"); + + changeHome(); + getResult("Home"); + + changeAddress(); + getResult("Address"); + + changeStreet(); + getResult("Street"); + + swapPerson(); + getResult("Person"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeOb(); + getResult("Ob"); + + changeAlt(); + getResult("Alt"); + + // ............................... Assert ................................. + assert.equal(res, "None: A |Street: A> |Address: A>+ |Home: A>+$ |Ob: A>+$0 |Alt: B |Home: B$ |Address: B$+ |Street: B$+> |Person: B$+> |Street: B$+> |Address: B$+> |Home: B$+> |Ob: B$+> |Alt: xA |", + "Deep path with chained observables, binding to full depth - 1: person.ob()^home.address().street"); + + // ................................ Reset ................................ + $("#result").empty(); + setData(); + + // =============================== Arrange =============================== + tmpl = $.templates(""); + + tmpl.link("#result", data, {helpers: helpers}); + + // ................................ Act .................................. + + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeOb(); + getResult("Ob"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeAlt(); + getResult("Alt"); + + // ............................... Assert ................................. + assert.equal(res, "None: A |Street: A> |Address: A>+ |Home: A>+$ |Ob: A>+$ |Street: A>+$ |Address: A>+$ |Home: A>+$ |Alt: A>+$ |", + "Deep path with chained observables, binding to leaf depth + 2: person.ob().home^address().street"); + + // ................................ Reset ................................ + $("#result").empty(); + setData(); + + // =============================== Arrange =============================== + tmpl = $.templates(""); + + tmpl.link("#result", data, {helpers: helpers}); + + // ................................ Act .................................. + + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeAlt(); + getResult("Alt"); + + // ............................... Assert ................................. + assert.equal(res, "None: A |Street: A> |Address: A>+ |Home: A>+ |Street: A>+ |Address: A>+ |Alt: A>+ |", + "Deep path with chained observables, binding to leaf depth plus 1: person.ob().home.address()^street"); + + // ................................ Reset ................................ + $("#result").empty(); + setData(); + + // =============================== Arrange =============================== + tmpl = $.templates(""); + + tmpl.link("#result", data, {helpers: helpers}); + + // ................................ Act .................................. + + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeStreet(); + getResult("Street"); + + changeAlt(); + getResult("Alt"); + + // ............................... Assert ................................. + assert.equal(res, "None: A |Street: A> |Address: A> |Street: A> |Alt: A> |", + "Deep path with chained observables, binding to leaf only: person.ob().home.address().street"); + + })(); + + (function() { + // =============================== Arrange =============================== + function ob() { + return this._ob; + } + + ob.set = function(val) { + this._ob = val; + }; + + var res, resCount, helpers, ch, person, person2, data; + + function setData() { + res = ""; + resCount = 1; + ch = 0; + + person = { + ob: { + street: "A", + type: "T" + } + }; + person2 = { + ob: { + street: "A2", + type: "T2" + } + }; + data = {person: person}; + } + + function swapPerson() { + $.observable(data).setProperty("person", data.person === person ? person2 : person); + } + + function changeStreet() { + $.observable(data.person.ob).setProperty("street", data.person.ob.street + ">"); + } + + function changeType() { + $.observable(data.person.ob).setProperty("type", data.person.ob.type + "$"); + } + + function getResult(name) { + res += (name||resCount++) + ": " + $("#result").text() + " |"; + } + + var tmpl = $.templates(""); + + setData(); + + tmpl.link("#result", data); + + // ................................ Act .................................. + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeType(); + getResult("Type"); + + swapPerson(); + getResult("Person"); + + changeType(); + getResult("Type"); + + changeStreet(); + getResult("Street"); + + // ............................... Assert ................................. + assert.equal(res, "None: TA |Street: TA> |Type: T$A> |Person: T2A2 |Type: T2$A2 |Street: T2$A2> |", + "Adjacent deep paths in expression: person^ob.type + person^ob.street"); + + // ................................ Reset ................................ + $("#result").empty(); + + })(); + + (function() { + // =============================== Arrange =============================== + function ob() { + return this._ob; + } + + ob.set = function(val) { + this._ob = val; + }; + + var res, person, data; + + function setData() { + res = ""; + + person = { + ob: ob, + _ob: { + street: "A", + type: "T" + } + }; + data = {person: person}; + } + + function changeOb() { + $.observable(data.person).setProperty("ob", { + street: data.person._ob.street + "+", + type: data.person._ob.type + "+" + }); + } + + function changeStreet() { + $.observable(data.person.ob()).setProperty("street", data.person.ob().street + ">"); + } + + function changeType() { + $.observable(data.person.ob()).setProperty("type", data.person.ob().type + "$"); + } + + function getResult(name) { + res += name + ": " + $("#result").text() + " |"; + } + + var tmpl = $.templates(""); + + setData(); + + tmpl.link("#result", data); + + // ................................ Act .................................. + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeType(); + getResult("Type"); + + changeOb(); + getResult("Ob"); + + changeType(); + getResult("Type"); + + changeStreet(); + getResult("Street"); + + // ............................... Assert ................................. + assert.equal(res, "None: AT |Street: A>T |Type: A>T$ |Ob: A>+T$+ |Type: A>+T$+$ |Street: A>+>T$+$ |", + "Adjacent terms in expression with paths with observables: person^ob().street + person^ob().type"); + + // ................................ Reset ................................ + $("#result").empty(); + + })(); + + (function() { + // =============================== Arrange =============================== + function ob(alt, a, b) { + var _ob = alt ? this._obB : this._obA; + if (a) { + _ob.t = [a,b,a+b+2]; + } + return _ob; + } + + ob.set = function(val) { + if (helpers.alt) { + this._obB = val; + } else { + this._obA = val; + } + }; + + function address(c, d) { + if (c) { + this._address.t = c + d; + } + return this._address; + } + + function setAddress(val) { + this._address = val; + } + + address.set = setAddress; + + var res, resCount, helpers, ch, person, person2, data; + + function setData() { + res = ""; + resCount = 1; + ch = 0; + + helpers = { + index: 1, + a: 2, + b: 1, + c: 3, + d: 4, + alt: false + }; + + person = { + ob: ob, + _obA: { + home: { + _address: { + street: "A" + }, + _address2: { + street: "A2" + }, + address: address + } + }, + _obB: { + home: { + _address: { + street: "B" + }, + _address2: { + street: "B2" + }, + address: address + } + } + }; + person2 = { + ob: ob, + _obA: { + home: { + _address: { + street: "xA" + }, + _address2: { + street: "xA2" + }, + address: address + } + }, + _obB: { + home: { + _address: { + street: "xB" + }, + _address2: { + street: "xB2" + }, + address: address + } + } + }; + data = {person: person}; + } + + function swapPerson() { + $.observable(data).setProperty("person", data.person === person ? person2 : person); + } + + function changeAlt() { + $.observable(helpers).setProperty("alt", !helpers.alt); + } + + function changeA() { + $.observable(helpers).setProperty("a", helpers.a + 1); + } + + function changeD() { + $.observable(helpers).setProperty("d", helpers.d + 1); + } + + function changeIndex(val) { + $.observable(helpers).setProperty("index", val); + } + + function changeOb() { + $.observable(data.person).setProperty("ob", { + home: { + _address: { + street: data.person.ob(helpers.alt).home._address.street + ch++ + }, + _address2: { + street: data.person.ob(helpers.alt).home._address2.street + ch + }, + address: address + } + }); + } + + function changeHome() { + $.observable(data.person.ob(helpers.alt)).setProperty("home", { + _address: { + street: data.person.ob(helpers.alt).home._address.street + "$" + }, + _address2: { + street: data.person.ob(helpers.alt).home._address2.street + "$" + }, + address: address + }); + } + + function changeAddress() { + $.observable(data.person.ob(helpers.alt).home).setProperty("address", {street: data.person.ob(helpers.alt).home.address().street + "+"}); + } + + function changeStreet() { + $.observable(data.person.ob(helpers.alt).home.address()).setProperty("street", data.person.ob(helpers.alt).home.address().street + ">"); + } + + function getResult(name) { + res += (name||resCount++) + ": " + $("#result").text() + " |"; + } + + var tmpl = $.templates(""); + + setData(); + + tmpl.link("#result", data, {helpers: helpers}); + + // ................................ Act .................................. + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeD(); + getResult("D"); + + changeIndex(3); + getResult("Index3"); + + changeA(); + getResult("A"); + + changeIndex(2); + getResult("Index2"); + + changeOb(); + getResult("Ob"); + + changeAlt(); + getResult("Alt"); + + changeHome(); + getResult("Home"); + + changeAddress(); + getResult("Address"); + + changeStreet(); + getResult("Street"); + + swapPerson(); + getResult("Person"); + + changeHome(); + getResult("Home"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeOb(); + getResult("Ob"); + + changeHome(); + getResult("Home"); + + changeIndex(1); + getResult("Index1"); + + changeA(); + getResult("A"); + + changeD(); + getResult("D"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + // ............................... Assert ................................. + assert.equal(res, "None: 46A |Street: 46A> |Address: 46A>+ |Home: 46A>+$ |D: 52A>+$ |Index3: 58A>+$ |A: 60A>+$ |Index2: 50A>+$ |Ob: 50A>+$0 |Alt: 50B |Home: 50B$ |Address: 50B$+ |Street: 50B$+> |Person: 50xB |Home: 50xB$ |Street: 50xB$> |Address: 50xB$>+ |Ob: 50xB$>+1 |Home: 50xB$>+1$ |Index1: 54xB$>+1$ |A: 56xB$>+1$ |D: 62xB$>+1$ |Street: 62xB$>+1$> |Address: 62xB$>+1$>+ |", + "Complex expression with multiple adjacent paths, with nested () and [] paren expressions, chained observables, arithmetic expressions etc."); + + // ................................ Reset ................................ + $("#result").empty(); + + })(); + + (function() { + // =============================== Arrange =============================== + function getResult(name) { + res += (name||resCount++) + ": " + $("#result").text() + " |"; + } + + var res = "", + resCount = 1, + data = { + type: 't', + sectionTypes: { + t: { + types: [22, 33] + }, + n: { + types: [66, 77] + } + } + }, + helpers = { + mode: "m" + }, + tmpl = $.templates({ + markup: "{^{section 'A' ~mode ~sectionTypes=~root.sectionTypes[type].types/}}", + tags: { + section: function(setting, mode) { + return setting + mode + this.ctxPrm("sectionTypes")[0]; + } + } + }); + + // ................................ Act .................................. + tmpl.link("#result", data, helpers); + + getResult("None"); + + $.observable(data).setProperty("type", "n"); + + getResult("type"); + + // ............................... Assert ................................. + assert.equal(res, "None: Am22 |type: Am22 |", + "Complex unbound expression with [] paren expressions etc."); + + // ................................ Reset ................................ + $("#result").empty(); + + })(); + + (function() { + // =============================== Arrange =============================== + function getResult(name) { + res += (name||resCount++) + ": " + $("#result").text() + " |"; + } + + var res = "", + resCount = 1, + data = { + type: 't', + sectionTypes: { + t: { + types: [22, 33] + }, + n: { + types: [66, 77] + } + } + }, + helpers = { + mode: "m" + }, + + tmpl = $.templates({ + markup: "{^{section 'A' ~mode ^~sectionTypes=~root.sectionTypes[type].types/}}", + tags: { + section: function(setting, mode) { + return setting + mode + this.ctxPrm("sectionTypes")[0]; + } + } + }); + + // ................................ Act .................................. + tmpl.link("#result", data, helpers); + + getResult("None"); + + $.observable(data).setProperty("type", "n"); + + getResult("type"); + + // ............................... Assert ................................. + assert.equal(res, "None: Am22 |type: Am66 |", + "Complex bound expression with [] paren expressions etc."); + + // ................................ Reset ................................ + $("#result").empty(); + + })(); + + (function() { + // =============================== Arrange =============================== + function ob(alt, a, b) { + var _ob = alt ? this._obB : this._obA; + if (a) { + _ob.t = [a,b,a+b+2]; + } + return _ob; + } + + ob.set = function(val) { + if (helpers.alt) { + this._obB = val; + } else { + this._obA = val; + } + }; + + function address(c, d) { + if (c) { + this._address.t = c + d; + } + return this._address; + } + + function setAddress(val) { + this._address = val; + } + + address.set = setAddress; + + var res, resCount, helpers, ch, person, person2, data; + + function setData() { + res = ""; + resCount = 1; + ch = 0; + + helpers = { + index: 1, + a: 2, + b: 1, + c: 3, + d: 4, + alt: false + }; + + person = { + ob: ob, + _obA: { + home: { + _address: { + street: "A" + }, + _address2: { + street: "A2" + }, + address: address + } + }, + _obB: { + home: { + _address: { + street: "B" + }, + _address2: { + street: "B2" + }, + address: address + } + } + }; + person2 = { + ob: ob, + _obA: { + home: { + _address: { + street: "xA" + }, + _address2: { + street: "xA2" + }, + address: address + } + }, + _obB: { + home: { + _address: { + street: "xB" + }, + _address2: { + street: "xB2" + }, + address: address + } + } + }; + data = {person: person}; + } + + function swapPerson() { + $.observable(data).setProperty("person", data.person === person ? person2 : person); + } + + function changeAlt() { + $.observable(helpers).setProperty("alt", !helpers.alt); + } + + function changeA() { + $.observable(helpers).setProperty("a", helpers.a + 1); + } + + function changeD() { + $.observable(helpers).setProperty("d", helpers.d + 1); + } + + function changeIndex(val) { + $.observable(helpers).setProperty("index", val); + } + + function changeOb() { + $.observable(data.person).setProperty("ob", { + home: { + _address: { + street: data.person.ob(helpers.alt).home._address.street + ch++ + }, + _address2: { + street: data.person.ob(helpers.alt).home._address2.street + ch + }, + address: address + } + }); + } + + function changeHome() { + $.observable(data.person.ob(helpers.alt)).setProperty("home", { + _address: { + street: data.person.ob(helpers.alt).home._address.street + "$" + }, + _address2: { + street: data.person.ob(helpers.alt).home._address2.street + "$" + }, + address: address + }); + } + + function changeAddress() { + $.observable(data.person.ob(helpers.alt).home).setProperty("address", {street: data.person.ob(helpers.alt).home.address().street + "+"}); + } + + function changeStreet() { + $.observable(data.person.ob(helpers.alt).home.address()).setProperty("street", data.person.ob(helpers.alt).home.address().street + ">"); + } + + function getResult(name) { + res += (name||resCount++) + ": " + $("#result").text() + " |"; + } + + var tmpl = $.templates({ + markup: "{^{mytag ^myprop=((person^ob(~helpers.alt).home.address(~helpers.c, ~helpers.d).t*3) + person^ob(~helpers.alt, ~helpers.a, ~helpers.b).t[(~helpers.index + 1) - 2])*2 + person^ob(~helpers.alt).home.address().street}}{{/mytag}}", + tags: { + mytag: function() { + return this.tagCtx.props.myprop; + } + } + }); + + setData(); + + tmpl.link("#result", data, {helpers: helpers}); + + // ................................ Act .................................. + getResult("None"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeHome(); + getResult("Home"); + + changeD(); + getResult("D"); + + changeIndex(3); + getResult("Index3"); + + changeA(); + getResult("A"); + + changeIndex(2); + getResult("Index2"); + + changeOb(); + getResult("Ob"); + + changeAlt(); + getResult("Alt"); + + changeHome(); + getResult("Home"); + + changeAddress(); + getResult("Address"); + + changeStreet(); + getResult("Street"); + + swapPerson(); + getResult("Person"); + + changeHome(); + getResult("Home"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + changeOb(); + getResult("Ob"); + + changeHome(); + getResult("Home"); + + changeIndex(1); + getResult("Index1"); + + changeA(); + getResult("A"); + + changeD(); + getResult("D"); + + changeStreet(); + getResult("Street"); + + changeAddress(); + getResult("Address"); + + // ............................... Assert ................................. + assert.equal(res, "None: 46A |Street: 46A> |Address: 46A>+ |Home: 46A>+$ |D: 52A>+$ |Index3: 58A>+$ |A: 60A>+$ |Index2: 50A>+$ |Ob: 50A>+$0 |Alt: 50B |Home: 50B$ |Address: 50B$+ |Street: 50B$+> |Person: 50xB |Home: 50xB$ |Street: 50xB$> |Address: 50xB$>+ |Ob: 50xB$>+1 |Home: 50xB$>+1$ |Index1: 54xB$>+1$ |A: 56xB$>+1$ |D: 62xB$>+1$ |Street: 62xB$>+1$> |Address: 62xB$>+1$>+ |", + "Complex expression on bound tag property, with multiple adjacent paths, with nested () and [] paren expressions, chained observables, arithmetic expressions etc."); + + // ................................ Reset ................................ + $("#result").empty(); + + })(); + + (function() { + // =============================== Arrange =============================== + function setData() { + res = ""; + + theB = { + a: "a" + }; + + theC = { + _b: theB, + b: function() { + return this._b; + } + }; + + theD = { + _c: theC, + c: function() { + return this._c; + } + }; + + theE = { + _d: theD, + d: function() { + return this._d; + } + }; + + theF = { + _e: theE, + e: function() { + return this._e; + } + }; + + theC.b.set = function(val) { + this._b = val; + }; + + theD.c.set = function(val) { + this._c = val; + }; + + theE.d.set = function(val) { + this._d = val; + }; + + theF.e.set = function(val) { + this._e = val; + }; + + data = { + f: theF, + e: theE, + d: theD, + c: theC, + b: theB + }; + } + + function getResult(name) { + res += (name||resCount++) + ": " + $("#result").text() + " |"; + } + + var theB, theC, theD, theE, theF, data, res, + resCount = 1, + tmpl = $.templates('{^{:f.e().d().c().b().a}} {^{:f.e().d().c().b()^a}} {^{:f.e().d().c()^b().a}} {^{:f.e().d()^c().b().a}} {^{:f.e()^d().c().b().a}} {^{:f^e().d().c().b().a}}'); + + setData(); + + tmpl.link("#result", data); + + getResult("None"); + + // ................................ Act .................................. + $.observable(theB).setProperty("a", "A"); + + getResult("Change a"); + + $.observable(theC).setProperty("b", {a: "B"}); + + getResult("Change b"); + + $.observable(theD).setProperty("c", { + _b: {a: "C"}, + b: function() { + return this._b; + } + }); + + getResult("Change c"); + + $.observable(theE).setProperty("d", { + _c: { + _b: {a: "D"}, + b: function() { + return this._b; + } + }, + c: function() { + return this._c; + } + }); + + getResult("Change d"); + + $.observable(theF).setProperty("e", { + _d: { + _c: { + _b: {a: "E"}, + b: function() { + return this._b; + } + }, + c: function() { + return this._c; + } + }, + d: function() { + return this._d; + } + }); + + getResult("Change e"); + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "None: a a a a a a |Change a: AAAAAA |Change b: ABBBBB |Change c: ABCCCC |Change d: ABCDDD |Change e: ABCDEE |" + : "None: a a a a a a |Change a: A A A A A A |Change b: A B B B B B |Change c: A B C C C C |Change d: A B C D D D |Change e: A B C D E E |", + "{{: ...}} expressions with deeply chained computed observables"); + // =============================== Arrange =============================== + + function setData2() { + res = ""; + + theB = { + a1: { + a: "a" + } + }; + + theC = { + b1: { + _b: theB, + b: function() { + return this._b; + } + } + }; + + theD = { + c1: { + _c: theC, + c: function() { + return this._c; + } + } + }; + + theE = { + d1: { + _d: theD, + d: function() { + return this._d; + } + } + }; + + theF = { + e1: { + _e: theE, + e: function() { + return this._e; + } + } + }; + + theC.b1.b.set = function(val) { + this._b = val; + }; + + theD.c1.c.set = function(val) { + this._c = val; + }; + + theE.d1.d.set = function(val) { + this._d = val; + }; + + theF.e1.e.set = function(val) { + this._e = val; + }; + } + + tmpl = $.templates('{^{:e1.e().d1.d().c1.c().b1.b().a1.a}} {^{:e1.e().d1.d().c1.c().b1.b().a1^a}} {^{:e1.e().d1.d().c1.c().b1.b()^a1.a}} {^{:e1.e().d1.d().c1.c().b1^b().a1.a}} {^{:e1.e().d1.d().c1.c()^b1.b().a1.a}} {^{:e1.e().d1.d().c1^c().b1.b().a1.a}} {^{:e1.e().d1.d()^c1.c().b1.b().a1.a}} {^{:e1.e().d1^d().c1.c().b1.b().a1.a}} {^{:e1.e()^d1.d().c1.c().b1.b().a1.a}} {^{:e1^e().d1.d().c1.c().b1.b().a1.a}}'); + + setData2(); + + tmpl.link("#result", theF); + + getResult("None"); + + // ................................ Act .................................. + + $.observable(theB.a1).setProperty("a", "A"); + + getResult("Change a"); + + $.observable(theB).setProperty("a1", { + a: "A1" + }); + + getResult("Change a1"); + + $.observable(theC.b1).setProperty("b", { + a1: { + a: "B" + } + }); + + getResult("Change b"); + + $.observable(theC).setProperty("b1", { + _b: { + a1: { + a: "B1" + } + }, + b: function() { + return this._b; + } + }); + + getResult("Change b1"); + + $.observable(theD.c1).setProperty("c", { + b1: { + _b: { + a1: { + a: "C" + } + }, + b: function() { + return this._b; + } + } + }); + + getResult("Change c"); + + $.observable(theD).setProperty("c1", { + _c: { + b1: { + _b: { + a1: { + a: "C1" + } + }, + b: function() { + return this._b; + } + } + }, + c: function() { + return this._c; + } + }); + + getResult("Change c1"); + + $.observable(theE.d1).setProperty("d", { + c1: { + _c: { + b1: { + _b: { + a1: { + a: "D" + } + }, + b: function() { + return this._b; + } + } + }, + c: function() { + return this._c; + } + } + }); + + getResult("Change d"); + + $.observable(theE).setProperty("d1", { + _d: { + c1: { + _c: { + b1: { + _b: { + a1: { + a: "D1" + } + }, + b: function() { + return this._b; + } + } + }, + c: function() { + return this._c; + } + } + }, + d: function() { + return this._d; + } + }); + + getResult("Change d1"); + + $.observable(theF.e1).setProperty("e", { + d1: { + _d: { + c1: { + _c: { + b1: { + _b: { + a1: { + a: "E" + } + }, + b: function() { + return this._b; + } + } + }, + c: function() { + return this._c; + } + } + }, + d: function() { + return this._d; + } + } + }); + + getResult("Change e"); + + $.observable(theF).setProperty("e1", { + _e: { + d1: { + _d: { + c1: { + _c: { + b1: { + _b: { + a1: { + a: "E1" + } + }, + b: function() { + return this._b; + } + } + }, + c: function() { + return this._c; + } + } + }, + d: function() { + return this._d; + } + } + }, + e: function() { + return this._e; + } + }); + + getResult("Change e1"); + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "None: a a a a a a a a a a |Change a: AAAAAAAAAA |Change a1: AA1A1A1A1A1A1A1A1A1 |Change b: AA1BBBBBBBB |Change b1: AA1BB1B1B1B1B1B1B1 |Change c: AA1BB1CCCCCC |Change c1: AA1BB1CC1C1C1C1C1 |Change d: AA1BB1CC1DDDD |Change d1: AA1BB1CC1DD1D1D1 |Change e: AA1BB1CC1DD1EE |Change e1: AA1BB1CC1DD1EE1 |" + : "None: a a a a a a a a a a |Change a: A A A A A A A A A A |Change a1: A A1 A1 A1 A1 A1 A1 A1 A1 A1 |Change b: A A1 B B B B B B B B |Change b1: A A1 B B1 B1 B1 B1 B1 B1 B1 |Change c: A A1 B B1 C C C C C C |Change c1: A A1 B B1 C C1 C1 C1 C1 C1 |Change d: A A1 B B1 C C1 D D D D |Change d1: A A1 B B1 C C1 D D1 D1 D1 |Change e: A A1 B B1 C C1 D D1 E E |Change e1: A A1 B B1 C C1 D D1 E E1 |", + "{{: ...}} expressions with deeply chained computed observables (variant)"); + + // =============================== Arrange =============================== + tmpl = $.templates('{^{for f.e().d().c().b()}}{^{:a}}{{/for}} {^{for f.e().d().c()^b()}}{^{:a}}{{/for}} {^{for f.e().d()^c().b()}}{^{:a}}{{/for}} {^{for f.e()^d().c().b()}}{^{:a}}{{/for}} {^{for f^e().d().c().b()}}{^{:a}}{{/for}}'); + + setData(); + + tmpl.link("#result", data); + + getResult("None"); + + // ................................ Act .................................. + + $.observable(theB).setProperty("a", "A"); + + getResult("Change a"); + + $.observable(theC).setProperty("b", {a: "B"}); + + getResult("Change b"); + + $.observable(theD).setProperty("c", { + _b: {a: "C"}, + b: function() { + return this._b; + } + }); + + getResult("Change c"); + + $.observable(theE).setProperty("d", { + _c: { + _b: {a: "D"}, + b: function() { + return this._b; + } + }, + c: function() { + return this._c; + } + }); + + getResult("Change d"); + + $.observable(theF).setProperty("e", { + _d: { + _c: { + _b: {a: "E"}, + b: function() { + return this._b; + } + }, + c: function() { + return this._c; + } + }, + d: function() { + return this._d; + } + }); + + getResult("Change e"); + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "None: a a a a a |Change a: AAAAA |Change b: BBBBB |Change c: BCCCC |Change d: BCDDD |Change e: BCDEE |" + : "None: a a a a a |Change a: A A A A A |Change b: B B B B B |Change c: B C C C C |Change d: B C D D D |Change e: B C D E E |", + "{{for ...}} expressions with deeply chained computed observables"); + + // =============================== Arrange =============================== + tmpl = $.templates('{^{:f.e().d().c().b().a + " " + e.d().c().b().a + " " + d.c().b().a + " " + c.b().a + " " + b.a}} | {^{:f.e()^d().c().b().a + " " + e.d()^c().b().a + " " + d.c()^b().a + " " + c.b()^a + " " + b.a}}'); + + setData(); + + tmpl.link("#result", data); + + getResult("None"); + + // ................................ Act .................................. + + $.observable(theB).setProperty("a", "A"); + + getResult("Change a"); + + $.observable(theC).setProperty("b", {a: "B"}); + + getResult("Change b"); + + $.observable(theD).setProperty("c", { + _b: {a: "C"}, + b: function() { + return this._b; + } + }); + + getResult("Change c"); + + $.observable(theE).setProperty("d", { + _c: { + _b: {a: "D"}, + b: function() { + return this._b; + } + }, + c: function() { + return this._c; + } + }); + + getResult("Change d"); + + $.observable(theF).setProperty("e", { + _d: { + _c: { + _b: {a: "E"}, + b: function() { + return this._b; + } + }, + c: function() { + return this._c; + } + }, + d: function() { + return this._d; + } + }); + + getResult("Change e"); + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "None: a a a a a | a a a a a |Change a: A A A A A |A A A A A |Change b: A A A A A |B B B B A |Change c: A A A A A |C C C B A |Change d: A A A A A |D D C B A |Change e: A A A A A |E D C B A |" + : "None: a a a a a | a a a a a |Change a: A A A A A | A A A A A |Change b: A A A A A | B B B B A |Change c: A A A A A | C C C B A |Change d: A A A A A | D D C B A |Change e: A A A A A | E D C B A |", + "Sibling {{: ...}} expressions with deeply chained computed observables"); + + // ................................ Reset ................................ + $("#result").empty(); + + })(); +}); + +QUnit.test("replace mode and link=false mode", function(assert) { + + (function() { + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + $("#result").html("
                  "); + + var tmpl = $.templates('{^{include}}{^{for people}}{^{:name}}{{/for}}{{/include}}'), + data = {people: [ + {name: "Jo"}, + {name: "Pete"} + ]}, + result = ""; + + // ................................ Act .................................. + + tmpl.link("#result .content", data); + + res = $("#result").text() + "(" + $("#result .content script").length + ") "; + + $.observable(data.people[0]).setProperty("name", "Bob"); + $.observable(data.people).insert({name: "Jane"}); + + res += $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "JoPete(18) BobPeteJane", + 'tmpl.link(container, data) renders and data-links'); + + // ................................ Act .................................. + $("#result .content").empty(); + + // ............................... Assert ................................. + assert.ok(!viewsAndBindings() && JSON.stringify(_jsv.cbBindings) === "{}", + "$(container).empty removes both views and current listeners from that content"); + + // ................................ Act .................................. + data = {people: [ + {name: "Jo"}, + {name: "Pete"} + ]}; + + tmpl.link("#result .content", data, {link: false}); + + res = $("#result").text() + "(" + $("#result .content script").length + ") "; + + $.observable(data.people[0]).setProperty("name", "Bob"); + $.observable(data.people).insert({name: "Jane"}); + + res += $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "JoPete(4) JoPete", + 'tmpl.link(container, data, {link: false}) renders but does not data-link, and does not insert script node markers'); + + // ................................ Act .................................. + $("#result .content").empty(); + + // ............................... Assert ................................. + assert.ok(!viewsAndBindings() && JSON.stringify(_jsv.cbBindings) === "{}", + "$(container).empty removes both views and current listeners from that content"); + + // ................................ Act .................................. + data = {people: [ + {name: "Jo"}, + {name: "Pete"} + ]}; + + tmpl.link("#result .content", data, {target: "replace"}); + + res = $("#result .content").length + " - " + $("#result").text() + "(" + $("#result script").length + ") "; + + $.observable(data.people[0]).setProperty("name", "Bob"); + $.observable(data.people).insert({name: "Jane"}); + + res += $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "0 - JoPete(18) BobPeteJane", + 'tmpl.link(container, data, {target: "replace"}) replaces the target "container" by rendered content, and data-links'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.ok(!viewsAndBindings() && JSON.stringify(_jsv.cbBindings) === "{}", + "$(container).empty removes both views and current listeners from that content"); + + // =============================== Arrange =============================== + $("#result").html("
                  "); + + // ................................ Act .................................. + data = {people: [ + {name: "Jo"}, + {name: "Pete"} + ]}; + + tmpl.link("#result .content", data, {target: "replace", link: false}); + + res = $("#result .content").length + " - " + $("#result").text() + "(" + $("#result script").length + ") "; + + $.observable(data.people[0]).setProperty("name", "Bob"); + $.observable(data.people).insert({name: "Jane"}); + + res += $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "0 - JoPete(4) JoPete", + 'tmpl.link(container, data, {target: "replace", link: false}) replaces the target "container" by rendered content, and does not data-link'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.ok(!viewsAndBindings() && JSON.stringify(_jsv.cbBindings) === "{}", + "$(container).empty removes both views and current listeners from that content"); + + // =============================== Arrange =============================== + $("#result").html("
                  "); + + tmpl = $.templates('{^{include link=false}}{^{for people}}{^{:name}}{{/for}}{{/include}}'); + + // ................................ Act .................................. + data = {people: [ + {name: "Jo"}, + {name: "Pete"} + ]}; + + tmpl.link("#result .content", data); + + res = $("#result").text() + "(" + $("#result .content script").length + ") "; + + $.observable(data.people[0]).setProperty("name", "Bob"); + $.observable(data.people).insert({name: "Jane"}); + + res += $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "JoPete(8) JoPete", + 'link=false on a block tag (e.g. {^{include link=false}}...) renders, but does not data-link, the content'); + + // ................................ Act .................................. + $("#result .content").empty(); + + // ............................... Assert ................................. + assert.ok(!viewsAndBindings() && JSON.stringify(_jsv.cbBindings) === "{}", + "$(container).empty removes both views and current listeners from that content"); + + $.views.settings.advanced({_jsv: false}); // For using viewsAndBindings() + })(); +}); + + +QUnit.module("API - data-bound tags"); + +QUnit.test("{^{:expression}}", function(assert) { + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + + $.templates('prop:{^{:lastName}}') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'prop:One|prop:newLast', + 'Data link using: {^{:lastName}}'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes both views and current listeners from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop:{^{:wasUndefined}}') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty("wasUndefined", "newLast"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'prop:|prop:newLast', + 'Data link using: {^{:wasUndefined}} - renders to empty string when undefined, and still binds correctly for subsequent modifications'); + + // ................................ Reset ................................ + $("#result").empty(); + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + var tmpl = $.templates("{^{:#data.person1.home.address.street}}{^{:person1.home^address.street}}"); + $.link(tmpl, "#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(address1).setProperty("street", "newStreetOne"); + $.observable(person1).setProperty("home", home2); // Deep change + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "StreetOneStreetOne|newStreetOneStreetTwo", + '#data.person1.home.address.street binds only to the leaf, but person1.home^address.street does deep binding'); + + // ................................ Reset ................................ + $("#result").empty(); + address1.street = "StreetOne"; + person1.home = home1; + + // =============================== Arrange =============================== + + var count = 0, + data = { + last: "Smith", + other: "Other", + a: function() { return this; } + }; + + $.views.tags({ + textbox: { + onAfterLink: function() { + // Find input in contents, if not already found + this.linkedElem = this.linkedElem || this.contents("input"); + }, + onUpdate: false, + template: "{^{:~tagCtx.props.label}}
                  " + } + }); + + tmpl = $.templates( + '' + + '' + + + '' + + '' + + + '{^{:convert=~upper last a().other}}' + + '{^{:a().other last convert=~upper}}' + + + '{^{textbox a().other last convert=~upper convertBack=~lower/}}' + + '{^{textbox convert=~upper convertBack=~lower last a().other/}}'); + +$.views.settings.trigger(false); + $.link(tmpl, "#result", data, { + upper: function(val) { + return val.toUpperCase(); + }, + lower: function(val) { + return val.toLowerCase(); + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result input").each(function() { + before += this.value; + }); + $.observable(data).setProperty("last", "newLast"); + $.observable(data).setProperty("other", "newOther"); + $("#result input").each(function() { + var last = data.last; + this.value += count++; + $(this).change(); + }); + after = $("#result").text(); + $("#result input").each(function() { + after += this.value; + }); + +$.views.settings.trigger(true); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "SMITHOTHEROTHERSMITHOtherSmithOTHERSMITH|NEWLAST135NEWOTHER024NEWOTHER024NEWLAST135newother024newlast135NEWOTHER024NEWLAST135", + 'Binding correctly to and from first argument, even with multiple args and props and with objects in paths, and with converters'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + var ob = {text: "aBc"}; + $.link("~upper(~ob.text) + ~lower(~ob.text)", "#result", undefined, { + upper: function(val) { return val.toUpperCase(); }, + lower: function(val) { return val.toLowerCase(); }, + ob: ob + }); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(ob).setProperty("text", "DeF"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "ABCabc|DEFdef", + '$.link(expression, selector, undefined, helpers) - without passing data, data-links correctly to helpers'); + + // ................................ Reset ................................ + $("#result").empty(); + $.unlink("#result"); + + // =============================== Arrange =============================== + + ob = {text: "aBc"}; + $.views.helpers({ + upper: function(val) { return val.toUpperCase(); }, + lower: function(val) { return val.toLowerCase(); }, + ob: ob + }); + $.link("~upper(~ob.text) + ~lower(~ob.text)", "#result"); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(ob).setProperty("text", "DeF"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "ABCabc|DEFdef", + '$.link(expression, selector) - without passing data, data-links correctly to helpers'); + + // ................................ Reset ................................ + $.unlink("#result"); + $("#result").empty(); + + // =============================== Arrange =============================== + + tmpl = $.templates("{^{:~upper(~ob.text)}}{^{:~lower(~ob.text)}}"); + $.views.helpers.ob = ob = {text: "aBc"}; + $.link(tmpl, "#result"); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(ob).setProperty("text", "DeF"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "ABCabc|DEFdef", + '$.link(template, selector) - without passing data, data-links correctly to helpers'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + $.views.helpers.ob = ob = {text: "aBc"}; + tmpl.link("#result"); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(ob).setProperty("text", "DeF"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "ABCabc|DEFdef", + 'template.link(selector) - without passing data, data-links correctly to helpers'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + $.views.helpers.ob = ob = {text: "aBc"}; + $("#result").link(tmpl); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(ob).setProperty("text", "DeF"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "ABCabc|DEFdef", + '$(selector).link(template) - without passing data, data-links correctly to helpers'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + $.views.helpers.ob = ob = {text: "aBc"}; + $("#result").link("~upper(~ob.text) + ~lower(~ob.text)"); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(ob).setProperty("text", "DeF"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "ABCabc|DEFdef", + '$(selector).link(expression) - without passing data, data-links correctly to helpers'); + + // ................................ Reset ................................ + $.unlink("#result"); + $("#result").empty(); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("{^{>expression}}", function(assert) { + + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + + $.templates('prop:{^{>lastName + "
                  "}}') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty("lastName", "newLast"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'prop:One
                  |prop:newLast
                  ', + 'Data link using: {^{:lastName}}'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events, + "$(container).empty removes both views and current listeners from that content"); + + // ................................ Reset ................................ + person1.lastName = "One"; // reset Prop + + // =============================== Arrange =============================== + + var tmpl = $.templates("{^{>#data.person1.home.address.street}}{^{>person1.home^address.street}}"); + $.link(tmpl, "#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(address1).setProperty("street", "newStreetOne"); + $.observable(person1).setProperty("home", home2); // Deep change + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "StreetOneStreetOne|newStreetOneStreetTwo", + '#data.person1.home.address.street binds only to the leaf, but person1.home^address.street does deep binding'); + + // ................................ Reset ................................ + $("#result").empty(); + address1.street = "StreetOne"; + person1.home = home1; + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("{^{tag}}", function(assert) { + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + $.views.tags({ + norendernotemplate: {}, + voidrender: function() {}, + emptyrender: function() { return ""; }, + emptytemplate: { + template: "" + }, + templatereturnsempty: { + template: "{{:a}}" + } + }); + + // ............................... Assert ................................. + $.templates("a{{norendernotemplate/}}b{^{norendernotemplate/}}c{{norendernotemplate}}{{/norendernotemplate}}d{^{norendernotemplate}}{{/norendernotemplate}}e").link("#result", 1); + assert.equal($("#result").text(), "abcde", + "non-rendering tag (no template, no render function) renders empty string"); + + $.templates("a{{voidrender/}}b{^{voidrender/}}c{{voidrender}}{{/voidrender}}d{^{voidrender}}{{/voidrender}}e").link("#result", 1); + assert.equal($("#result").text(), "abcde", + "non-rendering tag (no template, no return from render function) renders empty string"); + + $.templates("a{{emptyrender/}}b{^{emptyrender/}}c{{emptyrender}}{{/emptyrender}}d{^{emptyrender}}{{/emptyrender}}e").link("#result", 1); + assert.equal($("#result").text(), "abcde", + "non-rendering tag (no template, empty string returned from render function) renders empty string"); + + $.templates("a{{emptytemplate/}}b{^{emptytemplate/}}c{{emptytemplate}}{{/emptytemplate}}d{^{emptytemplate}}{{/emptytemplate}}e").link("#result", 1); + assert.equal($("#result").text(), "abcde", + "non-rendering tag (template has no content, no render function) renders empty string"); + + $.templates("a{{templatereturnsempty/}}b{^{templatereturnsempty/}}c{{templatereturnsempty}}{{/templatereturnsempty}}d{^{templatereturnsempty}}{{/templatereturnsempty}}e").link("#result", 1); + assert.equal($("#result").text(), "abcde", + "non-rendering tag (template returns empty string, no render function) renders empty string"); + + // =============================== Arrange =============================== + + $.templates('{^{tmplTag/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link with: {^{tmplTag/}} updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{{tmplTag/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.ok(before === 'Name: Mr Jo. Width: 30' && before === after && !$._data(person1).events && !$._data(settings).events, + 'Data link with: {{tmplTag/}} does nothing'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{^{fnTag/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link with: {^{fnTag/}} updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{{fnTag/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.ok(before === 'Name: Mr Jo. Width: 30' && before === after && !$._data(person1).events && !$._data(settings).events, + 'Data link with: {{fnTag/}} does nothing'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('
                  {^{fnTagEl/}}
                  ') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result div span")[0].outerHTML; // The innerHTML will be Name: Sir compFirst. Width: 40 + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result div span")[0].outerHTML; + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40' : 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link with: {^{fnTagEl/}} rendering , updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + $.templates('
                  {^{fnTagElNoInit firstName ~settings.width/}}
                  ') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result div span").html(); // The innerHTML will be ""
                • Name: Mr Jo. Width: 30
                • " + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result div span").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link with {^{fnTagElNoInit}} rendering , updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('
                    {^{fnTagElCnt/}}
                  ') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result ul li").html(); // The innerHTML will be ""
                • Name: Mr Jo. Width: 30
                • " + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result ul li").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link with {^{fnTagElCnt}} rendering
                • , updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('
                    {^{fnTagElCntNoInit firstName ~settings.width/}}
                  ') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result ul li").html(); // The innerHTML will be ""
                • Name: Mr Jo. Width: 30
                • " + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result ul li").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Data link with {^{fnTagElCntNoInit}} rendering
                • , updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{^{tmplTagWithProps #data ~settings.reverse theTitle=~settings.title ~street=home.address.street/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast", "home.address.street": "newStreet"}); + $.observable(settings).setProperty({title: "Sir", width: 40, reverse: false}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'Name: Mr Jo. Width: 30. Value: true. Prop theTitle: Mr. Prop ~street: StreetOne|Name: Sir compFirst. Width: 40. Value: false. Prop theTitle: Sir. Prop ~street: newStreet', + 'Data link with: {^{tmplTagWithProps ~some.path foo=~other.path ~bar=another.path/}} updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + settings.reverse = true; // reset Prop + address1.street = "StreetOne"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{{tmplTagWithProps #data ~settings.reverse theTitle=~settings.title ~street=home.address.street/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast", "home.address.street": "newStreet"}); + $.observable(settings).setProperty({title: "Sir", width: 40, reverse: false}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.ok(before === 'Name: Mr Jo. Width: 30. Value: true. Prop theTitle: Mr. Prop ~street: StreetOne' && before === after && !$._data(person1).events && !$._data(settings).events, + 'Data link with: {{tmplTagWithProps ~some.path foo=~other.path ~bar=another.path/}} does nothing'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + settings.reverse = true; // reset Prop + address1.street = "StreetOne"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{^{fnTagWithProps #data ~settings.reverse theTitle=~settings.title ~street=home.address.street/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast", "home.address.street": "newStreet"}); + $.observable(settings).setProperty({title: "Sir", width: 40, reverse: false}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'Name: Mr Jo. Width: 30. Value: true. Prop theTitle: Mr. Prop ~street: StreetOne|Name: Sir compFirst. Width: 40. Value: false. Prop theTitle: Sir. Prop ~street: newStreet', + 'Data link with: {^{fnTagWithProps ~some.path foo=~other.path ~bar=another.path/}} updates when dependant object paths change'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + settings.reverse = true; // reset Prop + address1.street = "StreetOne"; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{{fnTagWithProps #data ~settings.reverse theTitle=~settings.title ~street=home.address.street/}}') + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast", "home.address.street": "newStreet"}); + $.observable(settings).setProperty({title: "Sir", width: 40, reverse: false}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.ok(before === 'Name: Mr Jo. Width: 30. Value: true. Prop theTitle: Mr. Prop ~street: StreetOne' && before === after && !$._data(person1).events && !$._data(settings).events, + 'Data link with: {{fnTagWithProps ~some.path foo=~other.path ~bar=another.path/}} does nothing'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + settings.reverse = true; // reset Prop + address1.street = "StreetOne"; // reset Prop + + // =============================== Arrange =============================== + $.views.tags({ + mytag: { + template: "{{:~tagCtx.args[0]}}", + attr: "html" + } + }); + + $.templates("{^{mytag foo(\"w\\x\'y\").b/}}
                  ") + .link("#result", { + foo: function(val) { + return { b: val}; + } + }); + + // ............................... Assert ................................. + assert.equal($("#result span")[0].outerHTML, isIE8 ? "w\\x\'y" : "w\\x\'y", + "{^{mytag foo(\"w\\x\'y\").b/}} - correct compilation and output of quotes and backslash, with object returned in path (so nested compilation)"); + assert.equal($("#result span")[1].outerHTML, isIE8 ? "w\\x" : "w\\x", + "
                  - correct compilation and output of quotes and backslash, with object returned in path (so nested compilation)"); + + // ................................ Reset ................................ + $("#result").empty(); + res = ""; +}); + +QUnit.test("{^{for}}", function(assert) { + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + model.things = []; // reset Prop + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + + model.things = [{thing: "box"}]; // reset Prop + $.templates('{^{for things}}{{:thing}}{{/for}}') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'box|treebox', + '{^{for things}} binds to array changes on leaf array'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: [{thing: "triangle"}, {thing: "circle"}]}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircle', + '{^{for things}} binds to property change on path'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: {thing: "square"}}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'square', + '{^{for things}} binds to property change on path - swapping from array to singleton object'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: [{thing: "triangle2"}, {thing: "circle2"}]}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'triangle2circle2', + '{^{for things}} binds to property change on path - swapping from singleton back to array'); + + // ................................ Act .................................. + $.observable(model.things).insert([{thing: "oblong"}, {thing: "pentagon"}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'triangle2circle2oblongpentagon', + '{^{for things}} binds to array change on array after swapping from singleton back to array'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + var things1 = [{thing: "box"}], + things2 = [{thing: "triangle"}, {thing: "circle"}], + square = {thing: "square"}; + + model.things = things1; // reset Prop + + $.templates('{^{for things}}{{:thing}}{{/for}}') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things1).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'box|treebox', + '{^{for things}} binds to array changes on leaf array'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: things2}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircle', + '{^{for things}} binds to property change on path'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: square}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'square', + '{^{for things}} binds to property change on path - swapping from array to singleton object'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: things2}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircle', + '{^{for things}} binds to property change on path - swapping from singleton back to previous array'); + + // ................................ Act .................................. + $.observable(things2).insert([{thing: "oblong"}, {thing: "pentagon"}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircleoblongpentagon', + '{^{for things}} binds to array change on array after swapping from singleton back to array'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + things1 = [{thing: "box"}]; + things2 = [{thing: "triangle"}, {thing: "circle"}]; + square = {thing: "square"}; + + model.things = things1; // reset Prop + + $.templates('
                    {^{for things}}
                  • {{:thing}}
                  • {{/for}}
                  ') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things1).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'box|treebox', + '{^{for things}} in element content binds to array changes on leaf array'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: things2}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircle', + '{^{for things}} binds to property change on path'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: square}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'square', + '{^{for things}} binds to property change on path - swapping from array to singleton object'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: things2}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircle', + '{^{for things}} binds to property change on path - swapping from singleton back to previous array'); + + // ................................ Act .................................. + $.observable(things2).insert([{thing: "oblong"}, {thing: "pentagon"}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircleoblongpentagon', + '{^{for things}} binds to array change on array after swapping from singleton back to array'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + model.things = [{thing: "box"}, {thing: "table"}]; // reset Prop + + $.templates('{^{:length}} {^{for #data}}{{:thing}}{{/for}}') + .link("#result", model.things, null, true); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, isIE8 ? "2 boxtable|3tree boxtable" : "2 boxtable|3 treeboxtable", + '{^{for #data}} when #data is an array binds to array changes on #data'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + model.things = [{thing: "box"}, {thing: "table"}]; // reset Prop + + $.templates('{^{:length}} {^{for}}{{:thing}}{{/for}}') + .link("#result", model.things, null, true); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, isIE8 ? "2 boxtable|3tree boxtable" : "2 boxtable|3 treeboxtable", + '{^{for}} when #data is an array binds to array changes on #data'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + +var ret = ""; + +var listData = {nodes: {list: ["A "]}}; + +$.templates('Plain: {^{for nodes^list}}{{:}}{{/for}}\ +|SpanWithNext: {^{for nodes^list}}{{:}}{{/for}}nextElem\ +|UlWithNext:
                    {^{for nodes^list}}
                  • {{:}}
                  • {{/for}}
                  • nextElem
                  \ +|Ul:
                    {^{for nodes^list}}
                  • {{:}}
                  • {{/for}}
                  ') + .link('#result', listData); //"Plain: A |SpanWithNext: A nextElem|UlWithNext: A nextElem|Ul: A " + + // ................................ Act .................................. +ret += "|1 " + $("#result").text() + " " + $._data(listData.nodes.list).events.arrayChange.length; + +$.observable(listData).setProperty("nodes", {list: []}); + +ret += "|2 " + $("#result").text() + " " + $._data(listData.nodes.list).events.arrayChange.length; + +$.observable(listData.nodes.list).insert("C "); + +ret += "|3 " + $("#result").text() + " " + $._data(listData.nodes.list).events.arrayChange.length; + +$.observable(listData.nodes).setProperty("list", []); +ret += "|4 " + $("#result").text() + " " + $._data(listData.nodes.list).events.arrayChange.length; + +$.observable(listData.nodes.list).insert("C2 "); + +ret += "|5 " + $("#result").text() + " " + $._data(listData.nodes.list).events.arrayChange.length; + + // ............................... Assert ................................. + assert.equal(ret, isIE8 + ? "|1 Plain: A |SpanWithNext: A nextElem|UlWithNext: AnextElem|Ul: A 4" + + "|2 Plain: |SpanWithNext:nextElem|UlWithNext: nextElem|Ul: 4" + + "|3 Plain:C |SpanWithNext:C nextElem|UlWithNext: CnextElem|Ul: C 4" + + "|4 Plain: |SpanWithNext:nextElem|UlWithNext: nextElem|Ul: 4|" + + "5 Plain:C2 |SpanWithNext:C2 nextElem|UlWithNext: C2nextElem|Ul: C2 4" + : "|1 Plain: A |SpanWithNext: A nextElem|UlWithNext: AnextElem|Ul: A 4" + + "|2 Plain: |SpanWithNext: nextElem|UlWithNext: nextElem|Ul: 4" + + "|3 Plain: C |SpanWithNext: C nextElem|UlWithNext: CnextElem|Ul: C 4" + + "|4 Plain: |SpanWithNext: nextElem|UlWithNext: nextElem|Ul: 4" + + "|5 Plain: C2 |SpanWithNext: C2 nextElem|UlWithNext: C2nextElem|Ul: C2 4", + "Deep observable updates of array path on {^{for}} does not create additional array bindings"); + // =============================== Arrange =============================== + + model.things = []; // reset Prop + + $.templates('{^{if things.length}}X {^{for things}}{{:thing}}{{/for}}{{/if}}') + .link("#result", model); + + // ................................ Act .................................. + after = $("#result").text(); + $.observable(model.things).insert({thing: "box "}); + after += "|" + $("#result").text(); + $.observable(model.things).insert({thing: "table "}); + after += "|" + $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree "}); + after += "|" + $("#result").text(); + $.observable(model.things).remove(); + after += "|" + $("#result").text(); + $.observable(model.things).remove(0); + after += "|" + $("#result").text(); + $.observable(model.things).remove(); + after += "|" + $("#result").text(); + $.observable(model.things).refresh([{thing: "pen "},{thing: "lamp "}]); + after += "|" + $("#result").text(); + $.observable(model.things).move(0, 1); + after += "|" + $("#result").text(); + $.observable(model.things).refresh([]); + after += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|X box |X boxtable |Xtree boxtable |Xtree box |X box ||X pen lamp |X lamp pen |" + : "|X box |X box table |X tree box table |X tree box |X box ||X pen lamp |X lamp pen |", + '{^{if things.length}}{^{for things}} content block bound to both array and array.length responds correctly to observable array changes'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + model.things = []; // reset Prop + + $.templates('{^{for things.length && things}}{{:thing}}{{/for}}') + .link("#result", model); + + // ................................ Act .................................. + after = $("#result").text(); + $.observable(model.things).insert({thing: "box "}); + after += "|" + $("#result").text(); + $.observable(model.things).insert({thing: "table "}); + after += "|" + $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree "}); + after += "|" + $("#result").text(); + $.observable(model.things).remove(); + after += "|" + $("#result").text(); + $.observable(model.things).remove(0); + after += "|" + $("#result").text(); + $.observable(model.things).remove(); + after += "|" + $("#result").text(); + $.observable(model.things).refresh([{thing: "pen "},{thing: "lamp "}]); + after += "|" + $("#result").text(); + $.observable(model.things).move(0, 1); + after += "|" + $("#result").text(); + $.observable(model.things).refresh([]); + after += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|box |box table |tree box table |tree box |box ||pen lamp | lamppen |" + : "|box |box table |tree box table |tree box |box ||pen lamp |lamp pen |", + '{^{for things.length && things}} content block bound to both array and array.length responds correctly to observable array changes'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + model.things = []; // reset Prop + + $.templates('{^{for things.length}}{^{for ~root.things}}{{:thing}}{{/for}}{{/for}}') + .link("#result", model); + + // ................................ Act .................................. + after = $("#result").text(); + $.observable(model.things).insert({thing: "box "}); + after += "|" + $("#result").text(); + $.observable(model.things).insert({thing: "table "}); + after += "|" + $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree "}); + after += "|" + $("#result").text(); + $.observable(model.things).remove(); + after += "|" + $("#result").text(); + $.observable(model.things).remove(0); + after += "|" + $("#result").text(); + $.observable(model.things).remove(); + after += "|" + $("#result").text(); + $.observable(model.things).refresh([{thing: "pen "},{thing: "lamp "}]); + after += "|" + $("#result").text(); + $.observable(model.things).move(0, 1); + after += "|" + $("#result").text(); + $.observable(model.things).refresh([]); + after += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|box |box table |tree box table |tree box |box ||pen lamp | lamppen |" + : "|box |box table |tree box table |tree box |box ||pen lamp |lamp pen |", + '{^{for things.length}}{^{for ~root.things}} content bound to both array and array.length responds correctly to observable array changes'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + model.things = [{thing: "box"}, {thing: "table"}]; // reset Prop + + $.templates('{{include things}}{^{:length}} {^{for}}{{:thing}}{{/for}}{{/include}}') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, isIE8 ? "2 boxtable|3tree boxtable" : "2 boxtable|3 treeboxtable", + '{{include things}} moves context to things array, and {^{for}} then iterates and binds to array'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + model.things = [{thing: "box"}]; + $.templates('{^{for things}}{{:thing}}{{else}}None{{/for}}') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'box|treebox', + '{^{for things}}{{else}}{{/for}} binds to array changes on leaf array'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).remove(0, 2); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'treebox|None', + '{^{for things}}{{else}}{{/for}} renders {{else}} block when array is emptied'); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'tree', + '{^{for things}}{{else}}{{/for}} removes {{else}} block when item is added again'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: [{thing: "triangle"}, {thing: "circle"}]}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircle', + '{^{for things}}{{else}}{{/for}} binds to property change on path'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: {thing: "square"}}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'square', + '{^{for things}}{{else}}{{/for}} binds to property change on path - swapping from array to singleton object'); + + // ................................ Act .................................. + $.observable(model).removeProperty("things"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'None', + '{^{for things}}{{else}}{{/for}} binds to removeProperty change on path - and renders {{else}} block'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + model.things = [{thing: "box"}]; + $.templates('
                    {^{for things}}
                  • {{:thing}}
                  • {{else}}
                  • None
                  • {{/for}}
                  ') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'box|treebox', + '{^{for things}}{{else}}{{/for}} binds to array changes on leaf array'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).remove(0, 2); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'treebox|None', + '{^{for things}}{{else}}{{/for}} renders {{else}} block when array is emptied'); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'tree', + '{^{for things}}{{else}}{{/for}} removes {{else}} block when item is added again'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: [{thing: "triangle"}, {thing: "circle"}]}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'trianglecircle', + '{^{for things}}{{else}}{{/for}} binds to property change on path'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: {thing: "square"}}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'square', + '{^{for things}}{{else}}{{/for}} binds to property change on path - swapping from array to singleton object'); + + // ................................ Act .................................. + $.observable(model).removeProperty("things"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, 'None', + '{^{for things}}{{else}}{{/for}} binds to removeProperty change on path - and renders {{else}} block'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{^{for things}}{{:thing}}{{else}}None{{/for}}{^{if true}}_yes{{/if}}') + .link("#result", model); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + $.observable(model.things).insert(0, {thing: "box"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'None_yes|boxtree_yes', + '{^{for things}}{{else}}{{/for}}{^{if ...}} starting with empty array binds to array inserts'); + // See https://github.com/BorisMoore/jsviews/issues/326 + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates("testTmpl", '{{if ~things.length}}{{for ~things}}{{:thing}}{{/for}}{{/if}}'); + $.templates('{^{for things ~things=things tmpl="testTmpl"/}}
                  top
                  ') + .link("#result", model); + + before = $("#result td").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'top|toptree', + 'Complex template, with empty placeholder for tbody after thead, and subsequent data-linked insertion of tbody'); + + // ................................ Act .................................. + $.view("#result", true).refresh(); + res = "" + (after === $("#result").text()); + $.view("#result", true).views._2.refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].views._2.refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].views._2.views._2.refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].views._2.views._2.views[0].refresh(); + res += " " + (after === $("#result").text()); + + // ............................... Assert ................................. + assert.equal(res, 'true true true true true true', + 'view refresh at all levels correctly maintains content'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates("testTmpl", '{{if ~things.length}}
                  {{for ~things}}{{:thing}}{{/for}}
                  {{/if}}'); + $.templates('
                  top{^{for things ~things=things tmpl="testTmpl"/}}
                  ') + .link("#result", model); + + before = $("#result div").text(); + $.observable(model.things).insert(0, {thing: "tree"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'top|toptree', + 'Complex template, with empty placeholder for span, and subsequent data-linked insertion of in div'); + + // ................................ Act .................................. + $.view("#result", true).refresh(); + res = "" + (after === $("#result").text()); + $.view("#result", true).views._2.refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].views._2.refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].views._2.views._2.refresh(); + res += " " + (after === $("#result").text()); + $.view("#result", true).views._2.views[0].views._2.views._2.views[0].refresh(); + res += " " + (after === $("#result").text()); + + // ............................... Assert ................................. + assert.equal(res, 'true true true true true true', + 'view refresh at all levels correctly maintains content'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + // ................................ Act .................................. + $.templates('{^{for things}}{^{if expanded}}{{/if}}{{/for}}
                  {{:thing}}
                  ') + .link("#result", model); + + $.observable(model.things).insert(0, [{thing: "tree", expanded: false}]); + res = $._data(model.things[0]).events.propertyChange.length; + $.view("#result", true).views._1.views[0].refresh(); + res += "|" + $._data(model.things[0]).events.propertyChange.length; + $("#result").empty(); + res += "|" + $._data(model.things[0]).events; + + // ............................... Assert ................................. + assert.equal(res, '1|1|undefined', + 'Refreshing a view containing a tag which is bound to dependant data, and has no _prv node, removes the original binding and replaces it with a new one'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates('
                  {^{for things}}{^{if expanded}}{{:thing}}{{/if}}{{/for}}
                  ') + .link("#result", model); + + $.observable(model.things).insert(0, [{thing: "tree", expanded: false}]); + res = $._data(model.things[0]).events.propertyChange.length; + $.view("#result", true).views._1.views[0].refresh(); + res += "|" + $._data(model.things[0]).events.propertyChange.length; + $("#result").empty(); + res += "|" + $._data(model.things[0]).events; + + // ............................... Assert ................................. + assert.equal(res, '1|1|undefined', + 'Refreshing a view containing a tag which is bound to dependant data, and has no _prv node, removes the original binding and replaces it with a new one'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates('
                  {{if true}}{^{:things.length||""}}{{/if}}
                  ') + .link("#result", model); + + before = $("#result div *").length; + $.view("#result div", true).refresh(); + after = $("#result div *").length; + // ............................... Assert ................................. + assert.equal(after, before, + 'Refreshing a view containing non-elOnly content, with a data-bound tag with no rendered content removes the original script node markers for the tag and replace with the new ones'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates("testTmpl", '{^{if expanded}}{{:thing}}{{/if}}'); + $.templates('{^{for things tmpl="testTmpl"/}}
                  ') + .link("#result", model); + + res = $("#result td").text(); + $.observable(model.things).insert(0, [{thing: "tree", expanded: false}, {thing: "bush", expanded: true}]); + res += "|" + $("#result td").text(); + $.observable(model.things[0]).setProperty("expanded", true); + $.observable(model.things[1]).setProperty("expanded", false); + res += "|" + $("#result td").text(); + + // ............................... Assert ................................. + assert.equal(res, '|bush|tree', + 'Changing dependant data on bindings with deferred correctly triggers refreshTag and refreshes content with updated data binding'); + + // ................................ Act .................................. + $.view("#result tr").parent.refresh(); + res = $("#result td").text(); + $.view("#result tr").parent.parent.views[1].refresh(); + res += "|" + $("#result td").text(); + + // ............................... Assert ................................. + assert.equal(res, 'tree|tree', + 'view refresh with deferred correctly refreshes content'); + + // ................................ Act .................................. + $.observable(model.things[1]).setProperty("expanded", true); + res = $("#result td").text(); + + $.observable(model.things[0]).setProperty("expanded", false); + res += "|" + $("#result td").text(); + + // ............................... Assert ................................. + assert.equal(res, 'treebush|bush', + 'Changing dependant data on bindings with deferred, after view refresh correctly triggers refreshTag and refreshes content with updated data binding'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates("testTmpl", '{^{if expanded}}{{:thing}}{{/if}}'); + $.templates('{^{for things tmpl="testTmpl"/}}
                  ') + .link("#result", model); + + res = $("#result td").text(); + $.observable(model.things).insert(0, [{thing: "tree", expanded: false}, {thing: "bush", expanded: true}]); + res += "|" + $("#result").text(); + $.observable(model.things[0]).setProperty("expanded", true); + $.observable(model.things[1]).setProperty("expanded", false); + res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, '|bush|tree', + 'Changing dependant data on bindings with deferred correctly triggers refreshTag and refreshes content with updated data binding'); + + // ................................ Act .................................. + $.view("#result tr").refresh(); + res = $("#result").text(); + $.view("#result tr").parent.views[1].refresh(); + res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, 'tree|tree', + 'view refresh with deferred correctly refreshes content'); + + // ................................ Act .................................. + $.observable(model.things[1]).setProperty("expanded", true); + res = $("#result").text(); + $.observable(model.things[0]).setProperty("expanded", false); + res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, 'treebush|bush', + 'Changing dependant data on bindings with deferred, after view refresh correctly triggers refreshTag and refreshes content with updated data binding'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + + $.templates("
                    {{for}}
                  • Name: {{:firstName()}}. Width: {{:~settings.width}}
                  • {{/for}}
                  ") + .link("#result", person1, {settings: settings}); + + // ................................ Act .................................. + before = $("#result ul li").html(); // The innerHTML will be Name: Sir compFirst. Width: 40 + person1.fullName.set.call(person1, "compFirst compLast"); + settings.title = "Sir"; + settings.width = 40; + $.view("li").refresh(); + after = $("#result ul li").html(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Calling view("li").refresh() for a view in element-only content (elCnt true) updates correctly: "
                    {{for}}
                  • ...
                  • {{/for}}
                  "'); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + var data = {}; + + $.templates("
                    {^{for items}}
                  • insertBefore
                  • {{/for}}
                  • next
                  ") + .link("#result", data); + + // ................................ Act .................................. + before = $("#result ul").text(); // The innerHTML will be Name: Sir compFirst. Width: 40 + $.observable(data).setProperty("items", []); + var deferredString = $("#result ul li")[0]._df || ""; + $.observable(data.items).insert("X"); + after = $("#result ul").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + deferredString + "|" + after, + (isIE8 ? 'next||insertBeforenext' + : ' next||insertBefore next'), + 'Inserting content before a next sibling element in element-only context does not set ._df, and subsequent insertion is correctly placed before the next sibling.'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + $.templates('{^{for things}}
                  #index: #view.index: {{:thing}} Nested:{{for true}}{{for true}} #get(\'item\').index: #parent.parent.index:|{{/for}}{{/for}}
                  {{/for}}') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "tree"}); + $.observable(model.things).insert(0, {thing: "bush"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "#index:0 #view.index:0 bush Nested: #get('item').index:0 #parent.parent.index:0|#index:1 #view.index:1 tree Nested: #get('item').index:1 #parent.parent.index:1|", + 'Data-link to "#index" and "#get(\'item\').index" work correctly'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + + $.templates('{^{for things}}
                  {{:thing}} Nested:{{for}}{{for}}{{/for}}{{/for}}
                  |{{/for}}') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "tree"}); + $.observable(model.things).insert(0, {thing: "bush"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "bush Nested:0|tree Nested:1|", + 'Data-link to "#getIndex()" works correctly'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + $.templates('
                    {^{for things}}
                  • xxx
                  • {{/for}}
                  ') + .link("#result", model); + + // ................................ Act .................................. + $("#result div").empty(); + + // ............................... Assert ................................. + + assert.ok(viewsAndBindings().split(" ").length === 7 // We removed view inside div, but still have the view for the outer template. + && !$._data(model.things).events, + '$(container).empty removes listeners for empty tags in element-only content (_df="#n_/n_")'); + + // =============================== Arrange =============================== + data = { + list: [], + q: true + }; + + $.templates('
                    {^{if q}}{^{for list}}
                  • {{:#data}}
                  • {{/for}}{{/if}}
                  ') + .link("#result", data); + + // ................................ Act .................................. + $.observable(data).setProperty("q", false); + $.observable(data).setProperty("q", true); + $.observable(data.list).insert("added"); + + // ............................... Assert ................................. + assert.ok(viewsAndBindings().split(" ").length === 13 // We removed view inside div, but still have the view for the outer template. + && $._data(data.list).events.arrayChange.length === 1 + && $("#result ul").text() === "added", + 'In element-only content, updateContent calls disposeTokens on _df inner bindings'); + + // ................................ Reset ................................ + $("#result").empty(); + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + $.views.settings.advanced({_jsv: false}); + +}); + +QUnit.test("{^{for start end sort filter reverse}}", function(assert) { + $.views.settings.advanced({_jsv: true}); // For using cbBindings store + + assert.equal($.templates("{{for start=0 end=10}}{{:}} {{/for}}").render(), "0 1 2 3 4 5 6 7 8 9 ", "{{for start=0 end=10}}: Auto-create array"); + assert.equal($.templates("{{for start=5 end=9 reverse=1}}{{:}} {{/for}}").render(), "8 7 6 5 ", "{{for start=5 end=9 reverse=1}}: Auto-create array"); + assert.equal($.templates("{{for start=8 end=4 step=-1}}{{:}} {{/for}}").render(), "8 7 6 5 ", "{{for start=8 end=4 step=-1}}: Auto-create array"); + assert.equal($.templates("{{for start=8 end=4 step=-1 reverse=true}}{{:}} {{/for}}").render(), "5 6 7 8 ", "{{for start=8 end=4 step=-1 reverse=true}}: Auto-create array"); + assert.equal($.templates("{{for start=20 end='10' step=-2}}{{:}} {{/for}}").render(), "20 18 16 14 12 ", "{{for start=20 end='10' step=-2}}: Auto-create array"); + assert.equal($.templates("{{for start=20 end='10' step=2}}{{:}} {{/for}}").render(), "", "{{for start=20 end='10' step=2}}: Auto-create array (outputs nothing)"); + assert.equal($.templates("{{for start=2 end=-1.5 step=-.5}}{{:}} {{/for}}").render(), "2 1.5 1 0.5 0 -0.5 -1 ", "{{for start=0 end='10' step=-1}}: Auto-create array"); + assert.equal($.templates("{{for start=2}}{{:}} {{/for}}").render(), "", "{{for start=2}}: (outputs nothing)"); + assert.equal($.templates("{{for end=4}}{{:}} {{/for}}").render(), "0 1 2 3 ", "{{for end=4}}: (start defaults to 0)"); + + var myarray = [1, 9, 2, 8, 3, 7, 4, 6, 5, -100, 20, 100, -1]; + var mypeople = [ + {name: "Jo", details: {age: 22}}, + {name: "Bob", details: {age: 2}}, + {name: "Emma", details: {age: 12}}, + {name: "Jeff", details: {age: 13.5}}, + {name: "Julia", details: {age: 0.6}}, + {name: "Xavier", details: {age: 0}} + ]; + var oddValue = function(item, index, items) { return item%2; }; + var oddIndex = function(item, index, items) { return index%2; }; + var under20 = function(item, index, items) { + return item.details.age < 20; + }; + + assert.equal($.templates("{{for #data}}{{:}} {{/for}}").render(myarray, true), "1 9 2 8 3 7 4 6 5 -100 20 100 -1 ", "{{for #data}}"); + assert.equal($.templates("{{for #data sort=true}}{{:}} {{/for}}").render(myarray, true), "-100 -1 1 2 3 4 5 6 7 8 9 20 100 ", "{{for #data sort=true}}"); + assert.equal($.templates("{{for myarray reverse=true}}{{:}} {{/for}}").render({myarray: myarray}), "-1 100 20 -100 5 6 4 7 3 8 2 9 1 ", "{{for myarray reverse=true}}"); + assert.equal($.templates("{{for myarray start=1 end=-1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 2 8 3 7 4 6 5 -100 20 100 ", "{{for myarray start=1 end=-1}}"); + assert.equal($.templates("{{for myarray start=1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 2 8 3 7 4 6 5 -100 20 100 -1 ", "{{for myarray start=1}}"); + assert.equal($.templates("{{for myarray end=-1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "1 9 2 8 3 7 4 6 5 -100 20 100 ", "{{for myarray end=-1}}"); + assert.equal($.templates("{{for myarray}}{{:}} {{/for}}").render({myarray: myarray}), "1 9 2 8 3 7 4 6 5 -100 20 100 -1 ", "{{for myarray}}"); + assert.equal($.templates("{{for myarray reverse=true}}{{:}} {{/for}}").render({myarray: myarray}), "-1 100 20 -100 5 6 4 7 3 8 2 9 1 ", "{{for myarray reverse=true}}"); + assert.equal($.templates("{{for myarray sort=true}}{{:}} {{/for}}").render({myarray: myarray}), "-100 -1 1 2 3 4 5 6 7 8 9 20 100 ", "{{for myarray sort=true}}"); + assert.equal($.templates("{{for myarray sort=true reverse=true}}{{:}} {{/for}}").render({myarray: myarray}), "100 20 9 8 7 6 5 4 3 2 1 -1 -100 ", "{{for myarray sort=true reverse=true}}"); + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{for myarray filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 9 3 7 5 -1 ", "{{for myarray filter=~oddValue}}!!!"); + assert.equal($.templates("{{for myarray filter=~oddIndex}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 8 7 6 -100 100 ", "{{for myarray filter=~oddIndex}}"); + assert.equal($.templates("{{for myarray filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 9 3 7 5 -1 ", "{{for myarray filter=~oddValue}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "-1 1 3 5 7 9 ", "{{for myarray sort=true filter=~oddValue}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "-1 2 4 6 8 20 ", "{{for myarray sort=true filter=~oddIndex}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=1 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "2 4 ", "{{for myarray sort=true filter=~oddIndex start=1 end=3}}"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=-3 end=-1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "6 8 ", "{{for myarray sort=true filter=~oddIndex start=-3 end=-1}} Negative start or end count from the end"); + assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=3 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "", "{{for myarray sort=true filter=~oddIndex start=3 end=3}} (outputs nothing)"); +} + + assert.equal($.templates("{{for mypeople sort='name'}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}), "Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - Julia: age 0.6 - Xavier: age 0 - ", "{{for mypeople sort='name'}}"); + assert.equal($.templates("{{for mypeople sort='details.age'}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}), "Xavier: age 0 - Julia: age 0.6 - Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - ", "{{for mypeople sort='details.age'}}"); + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~under20}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {under20: under20}), "Jeff: age 13.5 - Emma: age 12 - Bob: age 2 - Julia: age 0.6 - Xavier: age 0 - ", "{{for mypeople sort='details.age' reverse=true filter=~under20}}"); + assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~under20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {under20: under20}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{for mypeople sort='details.age' reverse=true filter=~under20 start=1 end=-1}}"); +} + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support + // =============================== Arrange =============================== + model.things = [{ob: {thing: "box"}}]; + var ctx = {}; + $.templates('|All: {^{for things}}{{:ob.thing}} {{else}}None{{/for}}
                  \ +|Sort: {^{for this=~ctx.sorted things sort="ob.thing"}}{{:ob.thing}} {{else}}None{{/for}}
                  \ +|NotTreeReverse: {^{for things filter=~notTree reverse=true}}{{:ob.thing}} {{else}}None{{/for}}
                  \ +|Start1: {^{for things start=1}}{{:ob.thing}} {{else}}None{{/for}}') + .link("#result", model, { + ctx: ctx, + notTree: function(item) { + return item.ob.thing !== "tree"; + } + }); + + var after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: box |Sort: box |NotTreeReverse: box |Start1: None", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering'); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {ob: {thing: "tree"}}); + $.observable(model.things).insert([{ob: {thing: "apple"}}, {ob: {thing: "tree"}}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: tree box apple tree |Sort: apple box tree tree |NotTreeReverse: apple box |Start1: box apple tree ", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering binds to array changes on leaf array'); + + // ................................ Act .................................. + $.observable(model.things).remove(0, 3); + after = $("#result").text(); + + // ............................... Assert .................................6 + assert.equal(after, "|All: tree |Sort: tree |NotTreeReverse: None|Start1: None", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering renders {{else}} block when array is emptied'); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {ob: {thing: "tree"}}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: tree tree |Sort: tree tree |NotTreeReverse: None|Start1: tree ", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering removes {{else}} block when item is added again'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: [{ob: {thing: "triangle"}}, {ob: {thing: "circle"}}]}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: triangle circle |Sort: circle triangle |NotTreeReverse: circle triangle |Start1: circle ", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering binds to property change on path'); + + // ................................ Act .................................. + $.observable(model.things).insert([{ob: {thing: "square"}}, {ob: {thing: "tree"}}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: triangle circle square tree |Sort: circle square tree triangle |NotTreeReverse: square circle triangle |Start1: circle square tree ", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering inserts new items with sorting/filtering'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: {ob: {thing: "tree"}}}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: tree |Sort: tree |NotTreeReverse: tree |Start1: tree ", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering binds to property change on path - swapping from array to singleton object'); + + // ................................ Act .................................. + $.observable(model).setProperty({things: [{ob: {thing: "square"}}, {ob: {thing: "apple"}}, {ob: {thing: "tree"}}]}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: square apple tree |Sort: apple square tree |NotTreeReverse: apple square |Start1: apple tree ", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering binds to property change on path - swapping from singleton object back to array'); + + // ................................ Act .................................. + $.observable(model).removeProperty("things"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: None|Sort: None|NotTreeReverse: None|Start1: None", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering binds to removeProperty change on path - and renders {{else}} block'); + + // ................................ Act .................................. + $.observable(model).setProperty("things", [{ob: {thing: "circle"}}, {ob: {thing: "tree"}}, {ob: {thing: "square"}}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: circle tree square |Sort: circle square tree |NotTreeReverse: square circle |Start1: tree square ", + '{^{for things}}{{else}}{{/for}} plus sorting and filtering binds to setProperty change on path - and renders {{for}} block again'); + + // =============================== Arrange =============================== + var tgt = ctx.sorted.tagCtx.map.tgt; + + // ................................ Act .................................. + $.observable(tgt).insert([{ob: {thing: "red"}}, {ob: {thing: "green"}}, {ob: {thing: "blue"}}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All: circle tree square red green blue |Sort: circle square tree red green blue |NotTreeReverse: blue green red square circle |Start1: tree square red green blue ", + '{^{for things}} plus sorting and filtering support observable changes to target array tagCtx.map.tgt'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== + var movies = [{title: "a0"}, {title: "x0"}, {title: "b0"}, {title: "y0"}, {title: "c0"}, {title: "z0"}]; + ctx = {}; + var cnt = 0; + + $.templates( +'|All:--- {^{for movies}}{{:title}} {{/for}}
                  \ +|Sort:-- {^{for movies sort="title" reverse=true}}{{:title}} {{/for}}
                  \ +|Filter: {^{for movies sort="title" reverse=true filter=~odd}}{{:title}} {{/for}}
                  \ +|Slice:- {^{for movies sort="title" reverse=true filter=~odd start=1 end=-1 this=~ctx.target}}{{:title}} {{/for}}') + .link("#result", {movies: movies}, { + ctx: ctx, + odd: function(item, index, items) { + return index%2; + } + }); + + tgt = ctx.target.tagCtx.map.tgt; // This is the target array for the fourth (and last) {^{for}} tag above - Slice: {^{for ...}} + + // ................................ Act .................................. + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 |Sort:-- z0 y0 x0 c0 b0 a0 |Filter: y0 c0 a0 |Slice:- c0 ", + '{{for}} with sorting, filtering, reverse, start and end settings'); + + // ................................ Act .................................. + $.observable(tgt).insert({title: "t" + cnt++}); // Append item to fourth {^{for}} tag instance above + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 |Sort:-- z0 y0 x0 t0 c0 b0 a0 |Filter: y0 t0 b0 |Slice:- c0 t0 ", + 'Appending of item in target array (sorted, filtered etc) - item is rendered without refreshing sort, filter etc.'); + // But note that in our scenario above this will append an item to the source array movies, which will trigger refreshed + // rendering of the first three {^{for}} instance above + + ctx.target.refresh(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 |Sort:-- z0 y0 x0 t0 c0 b0 a0 |Filter: y0 t0 b0 |Slice:- t0 ", + 'To refresh sort etc with new item included, call tag.refresh() '); + + // ................................ Act .................................. + $.observable(tgt).insert(0, {title: "t" + cnt++}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 t1 |Sort:-- z0 y0 x0 t1 t0 c0 b0 a0 |Filter: y0 t1 c0 a0 |Slice:- t1 t0 ", + 'Insertion of item in target array (sorted, filtered etc) - item is rendered without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(movies).insert(1, {title: "m" + cnt++}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 |Sort:-- z0 y0 x0 t1 t0 m2 c0 b0 a0 |Filter: y0 t1 m2 b0 |Slice:- t1 m2 ", + 'Insertion of item in source array will also refresh sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).insert(1, [{title: "t" + cnt++}, {title: "t" + cnt++}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 t3 t4 |Sort:-- z0 y0 x0 t4 t3 t1 t0 m2 c0 b0 a0 |Filter: y0 t4 t1 m2 b0 |Slice:- t1 t3 t4 m2 ", + 'Insertion of multiple items in target array (sorted, filtered etc) - items are rendered without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).refresh([tgt[1], {title: "t" + cnt++}, tgt[0]]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 t1 t3 t5 |Sort:-- z0 y0 x0 t5 t3 t1 t0 c0 b0 a0 |Filter: y0 t5 t1 c0 a0 |Slice:- t3 t5 t1 ", + 'Calling refresh() on target array will insert and remove items appropriately from source array and target array (and move items in target array) without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).remove(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 t3 t5 |Sort:-- z0 y0 x0 t5 t3 t0 c0 b0 a0 |Filter: y0 t5 t0 b0 |Slice:- t3 t5 ", + 'Removing item in target array (sorted, filtered etc) - items are rendered without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(movies).remove(0); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- x0 b0 y0 c0 z0 t0 t3 t5 |Sort:-- z0 y0 x0 t5 t3 t0 c0 b0 |Filter: y0 t5 t0 b0 |Slice:- t5 t0 ", + 'Removal of item in source array will also refresh sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).move(0, 1); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- x0 b0 y0 c0 z0 t0 t3 t5 |Sort:-- z0 y0 x0 t5 t3 t0 c0 b0 |Filter: y0 t5 t0 b0 |Slice:- t0 t5 ", + 'Moving items in target array (sorted, filtered etc) - items are moved in target but not in source, and this is without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).refresh([{title: "t" + cnt++}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- x0 b0 y0 c0 z0 t3 t6 |Sort:-- z0 y0 x0 t6 t3 c0 b0 |Filter: y0 t6 c0 |Slice:- t6 ", + 'Calling refresh() on target array will insert and remove items appropriately from source array and target array (and move items in target array) without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(movies).insert(1, {title: "m" + cnt++}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- x0 m7 b0 y0 c0 z0 t3 t6 |Sort:-- z0 y0 x0 t6 t3 m7 c0 b0 |Filter: y0 t6 m7 b0 |Slice:- t6 m7 ", + 'Insertion of item in source array will also refresh sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).insert(1, [{title: "t" + cnt++}, {title: "t" + cnt++}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- x0 m7 b0 y0 c0 z0 t3 t6 t8 t9 |Sort:-- z0 y0 x0 t9 t8 t6 t3 m7 c0 b0 |Filter: y0 t9 t6 m7 b0 |Slice:- t6 t8 t9 m7 ", + 'Insertion of multiple items in target array (sorted, filtered etc) - items are rendered without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(movies).move(1, 3, 2); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- x0 y0 c0 m7 b0 z0 t3 t6 t8 t9 |Sort:-- z0 y0 x0 t9 t8 t6 t3 m7 c0 b0 |Filter: y0 t9 t6 m7 b0 |Slice:- t9 t6 m7 ", + 'Moving of items in source array will also refresh sort, filter etc.'); + + // ................................ Reset ................................ + $("#result").empty(); + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); +} + // =============================== Arrange =============================== + movies = [{title: "a0"}, {title: "x0"}, {title: "b0"}, {title: "y0"}, {title: "c0"}, {title: "z0"}]; + ctx = {}; + cnt = 0; + + $.templates( +'|All:--- {^{for movies}}{{:title}} {{/for}}
                  \ +|Slice:- {^{for movies start=1 end=-1 this=~ctx.target}}{{:title}} {{/for}}') + .link("#result", {movies: movies}, { + ctx: ctx, + odd: function(item, index, items) { + return index%2; + } + }); + + tgt = ctx.target.tagCtx.map.tgt; + + // ................................ Act .................................. + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 |Slice:- x0 b0 y0 c0 ", + '{{for}} with start and end settings ("sliced")'); + + // ................................ Act .................................. + $.observable(tgt).insert({title: "t" + cnt++}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:--- a0 x0 b0 y0 c0 z0t0 |Slice:- x0 b0 y0 c0t0 " + : "|All:--- a0 x0 b0 y0 c0 z0 t0 |Slice:- x0 b0 y0 c0 t0 ", + 'Appending of item in target array ("sliced") - item is rendered without refreshing sort, filter etc.'); + + ctx.target.refresh(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:--- a0 x0 b0 y0 c0 z0t0 |Slice:-x0 b0 y0 c0 z0 " + : "|All:--- a0 x0 b0 y0 c0 z0 t0 |Slice:- x0 b0 y0 c0 z0 ", + 'To refresh correct start and end with new item included, call tag.refresh() '); + + // ................................ Act .................................. + $.observable(tgt).insert(0, {title: "t" + cnt++}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:--- a0 x0 b0 y0 c0 z0t0t1 |Slice:-t1 x0 b0 y0 c0 z0 " + : "|All:--- a0 x0 b0 y0 c0 z0 t0 t1 |Slice:- t1 x0 b0 y0 c0 z0 ", + 'Insertion of item at specific position in target array ("sliced") - item is rendered at insert location, but item is simply appended to source array'); + + // ................................ Act .................................. + $.observable(movies).insert(1, {title: "m" + cnt++}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:--- a0m2 x0 b0 y0 c0 z0t0t1 |Slice:-m2 x0 b0 y0 c0 z0t0 " + : "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 |Slice:- m2 x0 b0 y0 c0 z0 t0 ", + 'Insertion of item in source array will also refresh "slicing"'); + + // ................................ Act .................................. + $.observable(tgt).insert(1, [{title: "t" + cnt++}, {title: "t" + cnt++}]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:--- a0m2 x0 b0 y0 c0 z0t0t1t3 t4 |Slice:-m2t3 t4 x0 b0 y0 c0 z0t0 " + : "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 t3 t4 |Slice:- m2 t3 t4 x0 b0 y0 c0 z0 t0 ", + 'Insertion of items at specific position in target array ("sliced") - items are rendered at insert location, but simply appended to source array'); + + // ................................ Act .................................. + $.observable(tgt).refresh([tgt[1], {title: "t" + cnt++}, tgt[0], tgt[2]]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:--- a0m2 t1t3 t4t5 |Slice:-t3t5 m2 t4 " + : "|All:--- a0 m2 t1 t3 t4 t5 |Slice:- t3 t5 m2 t4 ", + 'Calling refresh() on target array will append and remove items appropriately from source array and target array (and move items in target array)'); + + // ................................ Act .................................. + $.observable(tgt).remove(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:--- a0m2 t1t3t5 |Slice:-t3t5 m2 " + : "|All:--- a0 m2 t1 t3 t5 |Slice:- t3 t5 m2 ", + 'Removing item in target array ("sliced") - items are rendered without refreshing "slicing".'); + + // ................................ Act .................................. + $.observable(movies).remove(0); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:---m2 t1t3t5 |Slice:-t1 t3 " + : "|All:--- m2 t1 t3 t5 |Slice:- t1 t3 ", + 'Removal of item in source array will also refresh "slicing".'); + + // ................................ Act .................................. + $.observable(tgt).move(0, 1); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:---m2 t1t3t5 |Slice:- t3 t1 " + : "|All:--- m2 t1 t3 t5 |Slice:- t3 t1 ", + 'Moving items in target array ("slice") - items are moved in target but not in source, and this is without refreshing "slicing".'); + + // ................................ Act .................................. + $.observable(movies).move(1, 3, 2); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 + ? "|All:---m2 t5 t1t3 |Slice:-t5 t1 " + : "|All:--- m2 t5 t1 t3 |Slice:- t5 t1 ", + 'Moving of items in source array will also refresh "slicing".'); + + // ................................ Reset ................................ + $("#result").empty(); + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + // =============================== Arrange =============================== +var team = { + members: [ + {name: "one", phones:[]}, + {name: "two", phones:[21, 22]} + ] +}; + + $.templates( +'
                    {^{for start=0 members}}{^{for start=0 phones}}
                  • |{{:}}
                  • {{else}}
                  • |NoPhones
                  • {{/for}}
                  • |{{:name}}
                  • {{else}}
                  • |NoMembers
                  • {{/for}}
                  ') + .link("#result", team); + +var firstLi = $("li")[0]; + + // ............................... Assert ................................. + assert.equal( + $.view("ul").views._1._prv === firstLi + && $.view("ul").views._1.tag._prv === firstLi + && $.view("ul").views._1.views["0"].views._1._prv === firstLi + && $.view("ul").views._1.views["0"].views._1.tag._prv === firstLi + && $("#result").text(), "|NoPhones|one|21|22|two", + "First li is _prv for {{for}} tags"); + + // ................................ Act .................................. + $.observable(team.members).move(1, 0); + + // ............................... Assert ................................. +firstLi = $("li")[0]; + + assert.equal( + $.view("ul").views._1._prv === firstLi + && $.view("ul").views._1.tag._prv === firstLi + && $.view("ul").views._1.views["0"].views._1._prv === firstLi + && $.view("ul").views._1.views["0"].views._1.tag._prv === firstLi + && $("#result").text(), "|21|22|two|NoPhones|one", + "After observable move, first li is _prv for {{for}} tags"); + + // ................................ Act .................................. + $.observable(team.members).remove(0); + + // ............................... Assert ................................. +firstLi = $("li")[0]; + + assert.equal( + $.view("ul").views._1._prv === firstLi + && $.view("ul").views._1.tag._prv === firstLi + && $.view("ul").views._1.views["0"].views._1._prv === firstLi + && $.view("ul").views._1.views["0"].views._1.tag._prv === firstLi + && $("#result").text(), "|NoPhones|one", + "After remove, first li is _prv for {{for}} tags"); + + // ................................ Act .................................. + $.observable(team.members).remove(0); + + // ............................... Assert ................................. +firstLi = $("li")[0]; + + assert.equal( + $.view("ul").views._2._prv === firstLi + && $.view("ul").views._2.tag._prv === firstLi + && $.view("ul").views._3._prv === firstLi + && $.view("ul").views._3.tag._prv === firstLi + && $("#result").text(), "|NoMembers", + "After removing all, first li is _prv for {{for}} tags"); + + //................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "dataMap bindings all removed when tag disposed (content removed from DOM)"); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("{^{for}} with start end sort filter reverse: Incremental rendering", function(assert) { + var data = { + p_st: 2, + p_en: 4, + p_rev: false, + t_st: 0, + t_en: 4, + t_stp: undefined, + t_mapdeps: "flt", + flt: "l", + people: [ + "Jo", + "Bob", + "Jane", + "Jeff", + "May", + "Alice" + ], + things: [ + {is: "table"}, + {is: "porcelain"}, + {is: "lamp"}, + {is: "hat"} + ] + }, + out = "", + content = "", + people = data.people; + + $.templates( + '{^{for skip}}{{:~rndr(#data)}}' + + '{{else people start=p_st end=p_en reverse=p_rev}}|{{:~rndr(#data)}}' + + '{{else things sort=t_srt filter=t_flt start=t_st end=t_en step=t_stp mapDepends=t_mapdeps}}|{{:~rndr(is)}}' + + '{{else}}None{{/for}}' + ) + .link("#result", data, { + rndr: function(value) { + out += "|" + value; + return value; + } + }); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Jane|Jeff::|Jane|Jeff", 'initial render, first {{else}} block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("skip", "SkipTheList"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "SkipTheList::|SkipTheList", 'move to initial block (no mapped list'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("skip", undefined); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Jane|Jeff::|Jane|Jeff", 'move back to {{else people}} block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_st", 1); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane|Jeff::|Bob", 'incremental, on reducing start'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_en", 5); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane|Jeff|May::|May", 'incremental, on increasing end'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_en", 3); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane::", 'incremental, on reducing end'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_st", 4); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain|lamp|hat::|table|porcelain|lamp|hat", 'incremental, on increasing start, no items, moves to {{else}} block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_st", -1); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat::", 'incremental, on changing start - integer from end'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_en", -2); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "None::", 'incremental, on changing end - integer from end, no items, moves to final {{else}}'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty({p_st: 1, p_en:40}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane|Jeff|May|Alice::|Bob|Jane|Jeff|May|Alice", 'incremental, on changing start/end - moves to first block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_rev", true); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|May|Jeff|Jane|Bob|Jo::|Jo", 'incremental, set reverse=true'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty({p_en: 0, t_st: 0, t_en: 10}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain|lamp|hat::|table|porcelain|lamp|hat", 'incremental, moves to second block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_srt", "is"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|porcelain|table::", 'incremental, on changing start'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_flt", function(item, index, items) { + return index%2 === 1; // Include only odd index items + }); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|lamp|table::", 'incremental, on setting filter'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty({t_st: 0, t_en: 10, t_flt: false, t_srt: function(a, b) { + return a.is.length> b.is.length? 1 : a.is.length< b.is.length? -1 : 0; // Sort by string length of items + }}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|table|porcelain::|hat|porcelain", 'incremental, on setting sort function'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_flt", function(item, index, items) { + var flt = this.view.data.flt; + return flt ? item.is.toLowerCase().indexOf(flt.toLowerCase()) !== -1 : true; + }); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|lamp|table|porcelain::", 'incremental, on setting filter, with flt="l"'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("flt", "t"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|table::|hat", 'incremental, on setting flt to "t"'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("flt", "e"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain::|porcelain", 'incremental, on setting flt to "e"'); + + // ................................ Act .................................. + out = ""; + $.observable(data.things).insert(2, [{is: "cupboard"}, {is: "window"}]); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain::", 'incremental, on inserting items'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("flt", ""); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|table|window|cupboard|porcelain::|hat|lamp|window|cupboard", 'incremental, on setting flt to ""'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_srt", false); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain|cupboard|window|lamp|hat::", 'incremental, on setting sort to false'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_stp", 3); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|window::", 'incremental, on setting step to 3'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_stp", 2); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|cupboard|lamp::|cupboard|lamp", 'incremental, on setting step to 2'); + + // ................................ Act .................................. + out = ""; + $.observable(data.things).move(1, 4, 2); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|lamp|porcelain::|porcelain", 'incremental, on using move(1, 4, 2)'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_stp", false); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|window|lamp|hat|porcelain|cupboard::|window|hat|cupboard", 'incremental, on setting step to false'); + + // ................................ Act .................................. + out = ""; + $.observable(data.things).refresh([data.things[4], data.things[2], data.things[0], data.things[3]]); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|porcelain|lamp|table|hat::", 'incremental, on using refresh(...)'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_st", 10); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "None::", 'incremental, move to final {{else}} block'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + var data = { + p_rev: false, + people: [ + "Jo", + "Bob", + "Jane" + ] + }, + out = "", + content = "", + people = data.people; + + $.templates( + '{^{for people sort=p_srt reverse=p_rev}}|{{:~rndr(#data)}}{{/for}}' + ) + .link("#result", data, { + rndr: function(value) { + out += "|" + value; + return value; + } + }); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Jo|Bob|Jane::|Jo|Bob|Jane", 'initial render, (no initial DataMap use)'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_rev", true); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Jane|Bob|Jo::", 'reverse order (DataMap used - incremental re-order)'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_srt", true); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Jo|Jane|Bob::", 'reverse sort (DataMap used - incremental re-order)'); + + // ................................ Reset ................................ + $("#result").empty(); +}); + +QUnit.test("{^{props}} with start end sort filter reverse: Incremental rendering", function(assert) { + var data = { + p_st: 2, + p_en: 4, + p_rev: false, + t_st: 0, + t_en: 4, + t_stp: undefined, + t_mapdeps: "flt", + flt: "l", + people: { + one: "Jo", + b: "Bob", + x: "Jane", + two: "Jeff", + m: "May", + last: "Alice" + }, + things: { + a: {is: "table"}, + b: {is: "porcelain"}, + c: {is: "lamp"}, + d: {is: "hat"} + } + }, + out = "", + content = "", + people = data.people; + + $.templates( + '{^{props skip}}{{:~rndr(prop)}}' + + '{{else people start=p_st end=p_en reverse=p_rev}}|{{:~rndr(prop)}}' + + '{{else things sort=t_srt filter=t_flt start=t_st end=t_en step=t_stp mapDepends=t_mapdeps}}|{{:~rndr(prop.is)}}' + + '{{else}}None{{/props}}' + ) + .link("#result", data, { + rndr: function(value) { + out += "|" + value; + return value; + } + }); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Jane|Jeff::|Jane|Jeff", 'initial render, first {{else}} block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("skip", {is: "SkipTheList"}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "SkipTheList::|SkipTheList", 'move to initial block (no mapped list'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("skip", undefined); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Jane|Jeff::|Jane|Jeff", 'move back to {{else people}} block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_st", 1); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane|Jeff::|Bob", 'incremental, on reducing start'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_en", 5); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane|Jeff|May::|May", 'incremental, on increasing end'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_en", 3); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane::", 'incremental, on reducing end'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_st", 4); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain|lamp|hat::|table|porcelain|lamp|hat", 'incremental, on increasing start, no items, moves to {{else}} block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_st", -1); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat::", 'incremental, on changing start - integer from end'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_en", -2); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "None::", 'incremental, on changing end - integer from end, no items, moves to final {{else}}'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty({p_st: 1, p_en:40}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|Bob|Jane|Jeff|May|Alice::|Bob|Jane|Jeff|May|Alice", 'incremental, on changing start/end - moves to first block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("p_rev", true); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|May|Jeff|Jane|Bob|Jo::|Jo", 'incremental, set reverse=true'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty({p_en: 0, t_st: 0, t_en: 10}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain|lamp|hat::|table|porcelain|lamp|hat", 'incremental, moves to second block'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_srt", "prop.is"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|porcelain|table::", 'incremental, on changing start'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_flt", function(item, index, items) { + return index%2 === 1; // Include only odd index items + }); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|lamp|table::", 'incremental, on setting filter'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty({t_st: 0, t_en: 10, t_flt: false, t_srt: function(a, b) { + return a.prop.is.length> b.prop.is.length? 1 : a.prop.is.length< b.prop.is.length? -1 : 0; // Sort by string length of items + }}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|table|porcelain::|hat|porcelain", 'incremental, on setting sort function'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_flt", function(item, index, items) { + var flt = this.view.data.flt; + return flt ? item.prop.is.toLowerCase().indexOf(flt.toLowerCase()) !== -1 : true; + }); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|lamp|table|porcelain::", 'incremental, on setting filter, with flt="l"'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("flt", "t"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|table::|hat", 'incremental, on setting flt to "t"'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("flt", "e"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain::|porcelain", 'incremental, on setting flt to "e"'); + + // ................................ Act .................................. + out = ""; + $.observable(data.things).setProperty({e: {is: "cupboard"}, f: {is: "window"}}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|table|porcelain::", 'incremental, on inserting items'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("flt", ""); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|table|window|cupboard|porcelain::|hat|lamp|window|cupboard", 'incremental, on setting flt to ""'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_srt", "prop.is"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|cupboard|hat|lamp|porcelain|table|window::", 'incremental, on setting sort to "prop.is"'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_srt", false); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|table|window|cupboard|porcelain::", 'incremental, on setting sort to false'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_stp", 3); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|window::", 'incremental, on setting step to 3'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_stp", 2); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|table|cupboard::|table|cupboard", 'incremental, on setting step to 2'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_stp", false); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "|hat|lamp|table|window|cupboard|porcelain::|lamp|window|porcelain", 'incremental, on setting step to false'); + + // ................................ Act .................................. + out = ""; + $.observable(data).setProperty("t_st", 10); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "::" + out, "None::", 'incremental, move to final {{else}} block'); + + // ................................ Reset ................................ + $("#result").empty(); +}); + +QUnit.test("{^{if}}...{{else}}...{{/if}}", function(assert) { + $.views.settings.advanced({_jsv: true}); // For using cbBindings store + + // =============================== Arrange =============================== + var data = {one: true, two: false, three: true}, + boundIfElseTmpl = $.templates( + '{^{if one pane=0}}' + + '{^{if two pane=0}}' + + '{^{if three pane=0}}ONE TWO THREE {{else}}ONE TWO notThree {{/if}}' + + '{{else}}ONE notTwo {^{if three}}THREE {{/if}}{^{if !three}}notThree {{/if}}{{/if}}' + + '{{else three pane=1}}' + + '{^{if two pane=0}}notOne TWO THREE{{else}}notOne notTwo THREE {{/if}}' + + '{{else}}' + + '{^{if two pane=0}}notOne TWO notThree {{else}}notOne TWO notThree {{/if}}' + + '{{/if}}'); + + // ................................ Act .................................. + boundIfElseTmpl.link("#result", data); + + // ............................... Assert ................................. + after = $("#result").text(); + assert.equal(after, boundIfElseTmpl.render(data), + 'Bound if and else with link render the same as unbound, when using the JsRender render() method'); + + // ............................... Assert ................................. + assert.equal(after, "ONE notTwo THREE ", + 'Bound if and else render correct blocks based on boolean expressions'); + + // ................................ Act .................................. + $.observable(data).setProperty({one: false, two: false, three: true}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 ? "notOne notTwo THREE " : "notOne notTwo THREE ", + 'Bound if and else render correct blocks based on boolean expressions'); + + // ................................ Act .................................. + $.observable(data).setProperty({one: false, two: true, three: false}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, isIE8 ? "notOne TWO notThree " : "notOne TWO notThree ", + 'Bound if and else render correct blocks based on boolean expressions'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + data = {expanded: true}; + var deepIfTmpl = $.templates( + '' + + '{^{if expanded}}' + + '' + + '{{/if}}' + + '' + + '
                  DeepContent
                  afterDeep
                  '); + + // ................................ Act .................................. + deepIfTmpl.link("#result", data); + + $.observable(data).setProperty("expanded", false); + $.observable(data).setProperty("expanded", true); + + // ............................... Assert ................................. + after = $("#result").text(); + var deferredString = $("#result tr")[0]._df; // "/226_/322^" + // With deep version, the tokens for the {^{if}} binding had to be deferred - we test the format: + deferredString = /\/\d+\_\/\d+\^/.test(deferredString); + + assert.equal(deferredString && after, 'DeepContentafterDeep', + 'With deep bound {^{if}} tag, there is deferred binding and binding behaves correctly after removing and inserting'); + + // ................................ Act .................................. + $.observable(data).setProperty("expanded", false); + + // ............................... Assert ................................. + after = $("#result").text(); + deferredString = $("#result tr")[0]._df; // "#322^/322^" + // With deep version, the tokens for the {^{if}} binding had to be deferred - we test the format: + deferredString = /#(\d+\^)\/\1/.test(deferredString); + + assert.equal(deferredString && after, 'afterDeep', + 'With deep bound {^{if}} tag, there is deferred binding and binding behaves correctly after further remove'); + + // =============================== Arrange =============================== + var shallowIfTmpl = $.templates( + '' + + '{^{if expanded}}' + + '' + + '{{/if}}' + + '' + + '
                  ShallowContent
                  afterShallow
                  '); + + // ................................ Act .................................. + shallowIfTmpl.link("#result", data); + + $.observable(data).setProperty("expanded", false); + $.observable(data).setProperty("expanded", true); + + // ............................... Assert ................................. + after = $("#result").text(); + deferredString = $("#result tr")[0]._df; // "" + // With shallow version, no deferred binding + assert.equal(!deferredString && after, 'ShallowContentafterShallow', + 'With shallow bound {^{if}} tag, there is no deferred binding, and binding behaves correctly after removing and inserting'); + + // ................................ Act .................................. + $.observable(data).setProperty("expanded", false); + + // ............................... Assert ................................. + after = $("#result").text(); + deferredString = $("#result tr")[0]._df; // "" + // With shallow version, no deferred binding + + assert.equal(!deferredString && after, 'afterShallow', + 'With shallow bound {^{if}} tag, there is no deferred binding and binding behaves correctly after further remove'); + + // ................................ Reset ................................ + $("#result").empty(); + res = ""; + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("{^{props}} basic", function(assert) { + $.views.settings.advanced({_jsv: true}); // For using cbBindings store + + // =============================== Arrange =============================== + var root = { + objA: {propA1: "valA1a"}, + objB: {propB1: "valB1a"} + }; + + $.templates('{^{props objA}}{^{:key}}:{^{:prop}},{{/props}}') + .link("#result", root); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).setProperty({propA1: "valA1b"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'propA1:valA1a,|propA1:valA1b,', + '{^{props}} - set existing property'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).setProperty({propA1: "valA1c", propA2: "valA2a"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'propA1:valA1b,|propA1:valA1c,propA2:valA2a,', + '{^{props}} - set new property'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).setProperty({propA1: "", propA2: null}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'propA1:valA1c,propA2:valA2a,|propA1:,propA2:,', + '{^{props}} - set property to empty string or null'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).setProperty({propA1: null}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'propA1:,propA2:,|propA1:,propA2:,', + '{^{props}} - all properties null'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).removeProperty("propA1").removeProperty("propA2"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, 'propA1:,propA2:,|', + '{^{props}} - all properties removed'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).setProperty({propA1: "valA1b"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "|propA1:valA1b,", + '{^{props}} - set property where there were none'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root).setProperty({objA: {}}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propA1:valA1b,|", + '{^{props}} - set whole object to empty object'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root).setProperty({objA: {propX: "XX"}}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "|propX:XX,", + '{^{props}} - set whole object to different object'); + + //................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "{^{props}} dataMap bindings all removed when tag disposed (content removed from DOM)"); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("{^{props}} modifying content, through arrayChange/propertyChange on target array", function(assert) { +var done = assert.async(); + + $.views.settings.advanced({_jsv: true}); // For using cbBindings store + + // =============================== Arrange =============================== + + var root = { + objA: {propA1: "valA1a"} + }; + + $.templates( + '{^{props objA}}' + + '{^{:key}}:{^{:prop}},' + + '' + + ',' + + ',' + + '' + + '' + + '{{/props}}') + + .link("#result", root, { + add: function(ev, eventArgs) { + var view = eventArgs.view, + arr = view.get("array").data; + $.observable(arr).insert({key: "addkey", prop: "addprop"}); + }, + remove: function(ev, eventArgs) { + var view = eventArgs.view, + arr = view.get("array").data, + index = view.index; + $.observable(arr).remove(index); + }, + change: function(ev, eventArgs) { + var view = eventArgs.view, + item = view.data; + $.observable(item).setProperty({key: "changed", prop: "changedValue"}); + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $(".addProp").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propA1:valA1a,removeadd,change,|propA1:valA1a,removeadd,change,addkey:addprop,removeadd,change,", + '{^{props}} - add properties to props target array'); + + // ................................ Act .................................. + before = $("#result").text(); + $(".removeProp:first()").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propA1:valA1a,removeadd,change,addkey:addprop,removeadd,change,|addkey:addprop,removeadd,change,", + '{^{props}} - remove properties from props target array'); + + // ................................ Act .................................. + before = $("#result").text(); + $(".changeProp").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "addkey:addprop,removeadd,change,|changed:changedValue,removeadd,change,", + '{^{props}} - change value of key and prop in props target array'); + + // ................................ Act .................................. + before = $("#result").text(); + keydown($(".changePropInput").val("newValue")); + +setTimeout(function() { + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + JSON.stringify(root.objA), "changed:changedValue,removeadd,change,|changed:newValue,removeadd,change,|{\"changed\":\"newValue\"}", + '{^{props}} - change value of input bound to prop in props target array'); + + // ................................ Act .................................. + before = $("#result").text(); + keydown($(".changeKeyInput").val("newKey")); + +setTimeout(function() { + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after + "|" + JSON.stringify(root.objA), "changed:newValue,removeadd,change,|newKey:newValue,removeadd,change,|{\"newKey\":\"newValue\"}", + '{^{props}} - change value of input bound to key in props target array'); + + // ................................ Reset ................................ + + before = "" + $._data(root).events.propertyChange.length + "-" + $._data(root.objA).events.propertyChange.length; + $("#result").empty(); + after = "" + ($._data(root).events === undefined) + "-" + ($._data(root.objA).events === undefined) + " -" + JSON.stringify(_jsv.cbBindings); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "1-1|true-true -{}", + '{^{props}} dataMap bindings all removed when tag disposed (content removed from DOM)'); + + $.views.settings.advanced({_jsv: false}); + +done(); +}, 0); +}, 0); +}); + +QUnit.test("{^{props}}...{{else}} ...", function(assert) { + $.views.settings.advanced({_jsv: true}); // For using cbBindings store + + // =============================== Arrange =============================== + + var root = { + objA: {propA1: "valA1"}, + objB: {propB1: "valb1", propB2: "valb2"} + }; + + $.templates('{^{props objA}}{^{:key}}:{^{:prop}},' + + '{{else objB}}{^{:key}}:{^{:prop}},' + + '{{else}}' + + 'NONE' + + '{{/props}}') + + .link("#result", root); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).setProperty("propA2", "valA2"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propA1:valA1,|propA1:valA1,propA2:valA2,", + '{^{props}} - set new property on objA - shows additional property'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objA).removeProperty("propA1").removeProperty("propA2"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propA1:valA1,propA2:valA2,|propB1:valb1,propB2:valb2,", + '{^{props}} - remove properties from objA - switches to {{else objB}}'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objB).removeProperty("propB1").removeProperty("propB2"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propB1:valb1,propB2:valb2,|NONE", + '{^{props}} - remove properties from objB - switches to {{else}}'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objB).removeProperty("NotAProperty"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "NONE|NONE", + '{^{props}} - remove inexistant property from objB - remains on {{else}}'); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(root.objB).setProperty("newProp", ""); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "NONE|newProp:,", + '{^{props}} - set property on objB to undefined - render {{else objB}}'); + + // ................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "{^{props}} dataMap bindings all removed when tag disposed (content removed from DOM)"); + + // =============================== Arrange =============================== + + root = { + objA: {propA1: "valA1"}, + objB: {propB1: "valb1", propB2: "valb2"} + }; + + $.templates('{^{props objA}}{^{:key}}:{^{:prop}},' + + ',' + + '{{else objB}}{^{:key}}:{^{:prop}},' + + ',' + + '{{else}}' + + 'NONE' + + '{{/props}}') + + .link("#result", root, { + remove: function(ev, eventArgs) { + var view = eventArgs.view, + arr = view.get("array").data, + index = view.index; + $.observable(arr).remove(index); + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $(".removePropA").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propA1:valA1,remove,|propB1:valb1,remove,propB2:valb2,remove,", + '{^{props}} - remove properties from objA target array - switches to {{else objB}}'); + + // ................................ Act .................................. + before = $("#result").text(); + $(".removePropB").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, "propB1:valb1,remove,propB2:valb2,remove,|NONE", + '{^{props}} - remove properties from objB target array - switches to {{else}}'); + + // ................................ Reset ................................ + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "{^{props}} dataMap bindings all removed when tag disposed (content removed from DOM)"); + + $.views.settings.advanced({_jsv: false}); +}); + +if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support +QUnit.test("{^{props start end sort filter reverse}}...{{else}} ...", function(assert) { + $.views.settings.advanced({_jsv: true}); // For using _jsv + + // =============================== Arrange =============================== + var movies = {keyf: {title: "a0"}, keye: {title: "x0"}, keyd: {title: "b0"}, keyc: {title: "y0"}, keyb: {title: "c0"}, keya: {title: "z0"}}, + ctx = {}, + cnt = 0; + +$.templates( +'|All:--- {^{props movies}}{{:key}}:{{:prop.title}} {{/props}}
                  \ +|Sort:-- {^{props movies sort="prop.title" reverse=true}}{{:prop.title}} {{/props}}
                  \ +|Filter: {^{props movies sort="prop.title" reverse=true filter=~odd}}{{:prop.title}} {{/props}}
                  \ +|Slice:- {^{props movies sort="prop.title" reverse=true filter=~odd start=1 end=-1 this=~ctx.target}}{{:prop.title}} {{/props}}') + .link("#result", {movies: movies}, { + ctx: ctx, + odd: function(item, index, items) { + return index%2; + } + }); + + var tgt = ctx.target.tagCtx.contentView.data + function newProp(title) { + return {key: "key"+cnt++, prop: {title: title}} + } + + // ................................ Act .................................. + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 |Sort:-- z0 y0 x0 c0 b0 a0 |Filter: y0 c0 a0 |Slice:- c0 ", + '{{props}} with Sorting, filtering, reverse, start and end settings'); + + // ................................ Act .................................. + $.observable(tgt).insert(newProp("t" + cnt)); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 |Sort:-- z0 y0 x0 t0 c0 b0 a0 |Filter: y0 t0 b0 |Slice:- c0 t0 ", + 'Appending of item in target array (sorted, filtered etc) - item is rendered without refreshing sort, filter etc.'); + + ctx.target.refresh(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 |Sort:-- z0 y0 x0 t0 c0 b0 a0 |Filter: y0 t0 b0 |Slice:- t0 ", + 'To refresh, sort, slice etc with new item included, call tag.refresh() '); + + // ................................ Act .................................. + $.observable(tgt).insert(0, newProp("t" + cnt)); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 key1:t1 |Sort:-- z0 y0 x0 t1 t0 c0 b0 a0 |Filter: y0 t1 c0 a0 |Slice:- t1 t0 ", + 'Insertion of item in target array (sorted, filtered etc) - item is rendered without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(movies).setProperty("key" + cnt++, {title: "m" + cnt}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, +"|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 key1:t1 key2:m3 |Sort:-- z0 y0 x0 t1 t0 m3 c0 b0 a0 |Filter: y0 t1 m3 b0 |Slice:- t1 m3 ", + 'Insertion of item in source array will also refresh sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).insert(1, [newProp("t" + cnt), newProp("t" + cnt)]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 key1:t1 key2:m3 key4:t4 key3:t3 |Sort:-- z0 y0 x0 t4 t3 t1 t0 m3 c0 b0 a0 |Filter: y0 t4 t1 m3 b0 |Slice:- t1 t3 t4 m3 ", + 'Insertion of multiple items in target array (sorted, filtered etc) - items are rendered without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).refresh([tgt[1], newProp("t" + cnt), tgt[0]]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 key1:t1 key3:t3 key5:t5 |Sort:-- z0 y0 x0 t5 t3 t1 t0 c0 b0 a0 |Filter: y0 t5 t1 c0 a0 |Slice:- t3 t5 t1 ", + 'Calling refresh() on target array will insert and remove items appropriately from source array and target array (and move items in target array) without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).remove(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keyf:a0 keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 key3:t3 key5:t5 |Sort:-- z0 y0 x0 t5 t3 t0 c0 b0 a0 |Filter: y0 t5 t0 b0 |Slice:- t3 t5 ", + 'Removing item in target array (sorted, filtered etc) - items are rendered without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(movies).removeProperty("keyf"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 key3:t3 key5:t5 |Sort:-- z0 y0 x0 t5 t3 t0 c0 b0 |Filter: y0 t5 t0 b0 |Slice:- t5 t0 ", + 'Removal of item in source array will also refresh sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).move(0, 1); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key0:t0 key3:t3 key5:t5 |Sort:-- z0 y0 x0 t5 t3 t0 c0 b0 |Filter: y0 t5 t0 b0 |Slice:- t0 t5 ", + 'Moving items in target array (sorted, filtered etc) - items are moved in target but not in source, and this is without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).refresh([newProp("t" + cnt)]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key3:t3 key6:t6 |Sort:-- z0 y0 x0 t6 t3 c0 b0 |Filter: y0 t6 c0 |Slice:- t6 ", + 'Calling refresh() on target array will insert and remove items appropriately from source array and target array (and move items in target array) without refreshing sort, filter etc.'); + + // ................................ Act .................................. + $.observable(movies).setProperty("key" + cnt++, {title: "m" + cnt}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key3:t3 key6:t6 key7:m8 |Sort:-- z0 y0 x0 t6 t3 m8 c0 b0 |Filter: y0 t6 m8 b0 |Slice:- t6 m8 ", + 'Insertion of item in source array will also refresh sort, filter etc.'); + + // ................................ Act .................................. + $.observable(tgt).insert(1, [newProp("t" + cnt), newProp("t" + cnt)]); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(after, "|All:--- keye:x0 keyd:b0 keyc:y0 keyb:c0 keya:z0 key3:t3 key6:t6 key7:m8 key9:t9 key8:t8 |Sort:-- z0 y0 x0 t9 t8 t6 t3 m8 c0 b0 |Filter: y0 t9 t6 m8 b0 |Slice:- t6 t8 t9 m8 ", + 'Insertion of multiple items in target array (sorted, filtered etc) - items are rendered without refreshing sort, filter etc.'); + + // ................................ Reset ................................ + $("#result").empty(); + + assert.equal(JSON.stringify(_jsv.cbBindings), "{}", + "Bindings all removed when content removed from DOM"); + + $.views.settings.advanced({_jsv: false}); +}); +} + +QUnit.test('data-link="{on ...', function(assert) { + + $.views.settings.advanced({_jsv: true}); // For using _jsv + + // =============================== Arrange =============================== + + function swap(ev, eventArgs) { + $.observable(this).setProperty("type", this.type === "shape" ? "line" : "shape"); + } + var thing = { + type: "shape", + swap: swap + }; + + $.templates('
                  {^{:type}}
                  ') + .link("#result", thing); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result div").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "shape|line", + '{on swap} calls swap method on click, with "this" pointer context on data object'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('
                  {^{:type}}
                  ') + .link("#result", thing, {swap: swap}); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result div").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "shape|line", + '{on ~swap} calls swap helper method on click, with "this" pointer context defaulting to current data object'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('
                  {^{:type}} {^{:check}}
                  ') + .link("#result", thing, { + util: + { + swap: function(ev, eventArgs) { + $.observable(this.data).setProperty({ + type: this.data.type === "shape" ? "line" : "shape", + check: this.data === eventArgs.view.data + }); + }, + data: thing + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result div").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "shape |linetrue " + : "shape |line true", + '{on ~util.swap} calls util.swap helper method on click, with ~util as this pointer'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + + $.templates('
                  {^{:type}}
                  ') + .link("#result", thing, { + util: + { + swap: swap + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result div").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "shape|line", + '{on ~util.swap context=#data} calls util.swap helper method on click, with current data object as this pointer'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('
                  {^{:type}} {^{:check}}
                  ') + .link("#result", thing, { + util: + { + swap: function(ev, eventArgs) { + $.observable(this.data).setProperty({ + type: this.data.type === "shape" ? "line" : "shape", + check: this.data === eventArgs.view.data + }); + }, + data: thing, + swapCtx: { + data: thing + } + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result div").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "shape |linetrue " + : "shape |line true", + '{on ~util.swap context=~util.swapCtx} calls util.swap helper method on click, with util.swapCtx as this pointer'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + + $.templates('
                  {^{:type}} {^{:check}}
                  ') + .link("#result", thing, { + util: + { + swap: function(ev, eventArgs) { + $.observable(ev.data).setProperty({ + type: ev.data.type === "shape" ? "line" : "shape", + check: ev.data === eventArgs.view.data + }); + }, + data: thing, + swapCtx: { + data: thing + } + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result div").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "shape |linetrue " + : "shape |line true", + '{on ~util.swap data=#data} calls util.swap helper method on click, and passes current data #data as ev.data'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + + $.templates('
                  {^{:type}}
                  ') + .link("#result", thing); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result div").mouseup(); + after = $("#result").text(); + $("#result div").mousedown(); + after += $("#result").text(); + $("#result div").blur(); + after += $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "shape|lineshapeline", + "{on 'mouseup mousedown blur' swap} calls util method on mouseup, mousedown and blur"); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + var res = "1: "; + $.templates( + "
                  " + + "" + + "" + + "
                  ") + .link("#result", { + unbind: function(ev, eventArgs) { + res += "unbind "; + eventArgs.linkCtx.tag.onUnbind(); + }, + refresh: function(ev, eventArgs) { + res += "refresh "; + eventArgs.linkCtx.tag.refresh(); + }, + test: function() + { + res += "test "; + } + }); + + // ................................ Act .................................. + var events = $._data($("#divForOn")[0]).events, + eventBindings = "before: " + events.keydown.length + events.keyup.length + events.mouseup.length + events.mousedown.length; + + $("#divForOn #inputB").mouseup(); + + res += "2: "; + $("#divForOn .inputA").mouseup(); + + res += "3: "; + $("#divForOn #inputB").keyup(); + + res += "4: "; + $("#divForOn #inputB").keyup(); + + res += "5: "; + $("#divForOn .inputA").keydown(); + + res += "6: "; + $("#divForOn .inputA").keyup(); + + res += "7: "; + $("#divForOn #inputB").mouseup(); + + res += "8: "; + $("#divForOn #inputB").mousedown(); + + eventBindings += " | after: " + events.keydown + events.keyup + events.mouseup.length + events.mousedown.length; + // ............................... Assert ................................. + assert.equal(res, + "1: test 2: test 3: unbind 4: 5: unbind 6: 7: test 8: refresh ", + "multiple {on events selector method} bindings on container attach events on delegated elements. Also, tag.onDispose on tag instances removes specific handlers for corresponding elements/selectors"); + + // ............................... Assert ................................. + assert.equal(eventBindings, + "before: 1211 | after: undefinedundefined11", + "onDispose removes specific delegated events"); + + // ................................ Act .................................. + res = "1: "; + $("#divForOn").html(""); + + $("#divForOn #newlyAdded").mouseup(); + + res += "2: "; + $("#divForOn #newlyAdded").keyup(); + + // ............................... Assert ................................. + assert.equal(res, + "1: test 2: ", + "delegated {on events selector method} binding allows additional elements added to content to bind correctly"); + + // ................................ Act .................................. + $("#result").empty(); + eventBindings = "" + events.keydown + events.keyup + events.mouseup + JSON.stringify([_jsv.cbBindings, _jsv.bindings]); + + // ............................... Assert ................................. + assert.equal(eventBindings, + "undefinedundefinedundefined[{},{}]", + "Removing the element removes all associated attached {on } handlers"); + + // =============================== Arrange =============================== + var tmpl = $.templates("
                  \ + \ + \ +
                  "), + + data = { + name: "Jo", + role: "Advisor", + option: { + allow: true + }, + thisIsTheMethod: function(role, text, isFoo, compile, amount, root, ev, eventArgs) { + if (compile) { + compile.call(root, role, text, isFoo, amount, ev.data.allow, eventArgs.linkCtx.tag.tagCtx.args[2]); + } + }, + process: function(role, text, isFoo, amount, allow, extraParam) { + $.observable(this).setProperty("res", this.res + role + text + isFoo + amount + " allow:" + allow + " extraParam: " + extraParam + "|"); + }, + res: "" + }; + + tmpl.link("#result", data); + + // ................................ Act .................................. + $("#doIt").click(); + data.option.allow = false; + $.observable(data).setProperty("role", "Follower"); + $("#doIt").click(); + + // ............................... Assert ................................. + assert.equal(data.res, "Advisorheytrue33 allow:true extraParam: 754|Followerheytrue33 allow:false extraParam: 754|", + "{on 'click' selector otherParams... method params...} : supports passing params to method, of any type, as well as setting data and context for the function call"); + + // =============================== Arrange =============================== + res = "1: "; + $("#result").html("
                  " + + "" + + "" + + "
                  "); + + $.link(true, "#result", { + unbind: function(ev, eventArgs) { + res += "unbind "; + eventArgs.linkCtx.tag.onUnbind(); + }, + refresh: function(ev, eventArgs) { + res += "refresh "; + eventArgs.linkCtx.tag.refresh(); + }, + test: function() { + res += "test "; + } + }); + + // ................................ Act .................................. + events = $._data($("#divForOn")[0]).events; + eventBindings = "before: " + events.keydown.length + events.keyup.length + events.mouseup.length + events.mousedown.length; + + $("#divForOn #inputB").mouseup(); + + res += "2: "; + $("#divForOn .inputA").mouseup(); + + res += "3: "; + $("#divForOn #inputB").keyup(); + + res += "4: "; + $("#divForOn #inputB").keyup(); + + res += "5: "; + $("#divForOn .inputA").keydown(); + + res += "6: "; + $("#divForOn .inputA").keyup(); + + res += "7: "; + $("#divForOn #inputB").mouseup(); + + res += "8: "; + $("#divForOn #inputB").mousedown(); + + eventBindings += " | after: " + events.keydown + events.keyup + events.mouseup.length + events.mousedown.length; + // ............................... Assert ................................. + assert.equal(res, + "1: test 2: test 3: unbind 4: 5: unbind 6: 7: test 8: refresh ", + "Top-level {on }: multiple {on events selector method} top-level bindings on container attach events on delegated elements. Also, tag.onDispose on tag instances removes specific handlers for corresponding elements/selectors"); + + // ............................... Assert ................................. + assert.equal(eventBindings, + "before: 1211 | after: undefinedundefined11", + "Top-level {on }: onDispose removes specific delegated events"); + + // ................................ Act .................................. + res = "1: "; + $("#divForOn").html(""); + + $("#divForOn #newlyAdded").mouseup(); + + res += "2: "; + $("#divForOn #newlyAdded").keyup(); + + // ............................... Assert ................................. + assert.equal(res, + "1: test 2: ", + "Top-level {on }: delegated {on events selector method} binding allows additional elements added to content to bind correctly"); + + // ................................ Act .................................. + $("#result").empty(); + eventBindings = "" + events.keydown + events.keyup + events.mouseup + JSON.stringify([_jsv.cbBindings, _jsv.bindings]); + + // ............................... Assert ................................. + assert.equal(eventBindings, + "undefinedundefinedundefined[{},{}]", + "Top-level {on }: Removing the element removes all associated attached {on } handlers"); + + // =============================== Arrange =============================== + $("#result").html("
                  \ + \ + \ +
                  "); + + data = { + name: "Jo", + role: "Advisor", + option: { + allow: true + }, + thisIsTheMethod: function(role, text, isFoo, compile, amount, root, ev, eventArgs) { + if (compile) { + compile.call(root, role, text, isFoo, amount, ev.data.allow, eventArgs.linkCtx.tag.tagCtx.args[2]); + } + }, + process: function(role, text, isFoo, amount, allow, extraParam) { + $.observable(this).setProperty("res", this.res + role + text + isFoo + amount + " allow:" + allow + " extraParam: " + extraParam + "|"); + }, + res: "" + }; + + $.link(true, "#result", data); + + // ................................ Act .................................. + $("#doIt").click(); + data.option.allow = false; + $.observable(data).setProperty("role", "Follower"); + $("#doIt").click(); + + // ............................... Assert ................................. + assert.equal(data.res, "Advisorheytrue33 allow:true extraParam: 754|Followerheytrue33 allow:false extraParam: 754|", + "Top-level {on 'click' selector method params...} : supports passing params to method, of any type, as well as setting data and context for the function call"); + + // =============================== Arrange =============================== + res = "1: "; + data = { + unbind: function(ev, eventArgs) { + res += "unbind "; + eventArgs.linkCtx.tag.onUnbind(); + }, + refresh: function(ev, eventArgs) { + res += "refresh "; + eventArgs.linkCtx.tag.refresh(); + }, + test: function() { + res += "test "; + } + }; + $("#result").html("
                  oldcontent
                  "); + + $.link(true, "#linkTgt", data); + + events = $._data($("#linkTgt")[0]).events; + + // ................................ Act .................................. + $("#linkTgt").mousedown(); + + res += "2: "; + $("#linkTgt").mouseup(); + + res += "3: "; + $("#linkTgt").click(); + + res += "4: "; + $("#linkTgt").mousedown(); + + res += "5: "; + $("#linkTgt").mouseup(); + + res += "6: "; + $("#linkTgt").click(); + + // ............................... Assert ................................. + assert.equal(res, + "1: test 2: test 3: refresh 4: test 5: test 6: refresh ", + '$.link(true, "#linkTgt", data): top-level linking to element (not container) links correctly, including \'{on }\' bindings'); + + // ............................... Assert ................................. + eventBindings = "" + events.mouseup.length + events.mousedown.length + events.click.length; + + assert.equal(eventBindings, + "111", + '$.link(true, "#linkTgt", data): top-level linking to element (not container) adds {on } binding handlers correctly - including calling refresh() on {on } tag'); + + // ................................ Act .................................. + $.unlink("#linkTgt"); + + // ............................... Assert ................................. + eventBindings = "" + events.mouseup + events.mousedown + events.click + JSON.stringify([_jsv.cbBindings, _jsv.bindings]); + + assert.equal(eventBindings, + "undefinedundefinedundefined[{},{}]", + '$.unlink("#linkTgt"): directly on top-level data-linked element (not through container) removes all \'{on }\' handlers'); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test('{^{radiogroup}}', function(assert) { + + // =============================== Arrange =============================== + var tmpl = $.templates( + '{^{radiogroup selected}}' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + ); + + var model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }, + newName = "new"; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":Jim|:new||Bob-:Bob|", + '{^{radiogroup selected}}{^{for ...}}...'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + var tmpl = $.templates( + '{^{radiogroup selected}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":JIM|:NEW||None-:NONE|", + '{^{radiogroup selected}}......{^{for ...}}...'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED|jimUpdated-:JIMUPDATED|", + '{^{radiogroup selected}}...{^{for ...}}... - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates({markup: + '{^{radiogroup selected convert=~lower convertBack="upper" linkTo=selectedOut}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}', + converters: { + upper: function(val) { + return val.toUpperCase(); + } + } + }); + + model = { + selected: "JIM", + people: [ + {name: "bob"}, + {name: "jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + model.selectedOut + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":jim|:new||new-NONE-:none|", + '{^{radiogroup selected convert=... convertBack=... linkTo=...}}'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + model.selectedOut + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":none:bob:jimUpdated|new-JIMUPDATED-:jimUpdated|", + '{^{radiogroup selected convert=... convertBack=... linkTo=...}} - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '{^{radiogroup selected}}' + + ':' + + '{^{for people}}' + + ':' + + '{{/for}}' + +'{{/radiogroup}}' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, "JIM|NEW||None-NONE|", + '{^{radiogroup selected}} with labels by for/id'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED|jimUpdated-JIMUPDATED|", + '{^{radiogroup selected}} with labels by for/id - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '{^{radiogroup selected}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + + '{^{radiogroup selected}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":JIM:JIM|:NEW:NEW||None-:NONE:NONE|", + '{^{radiogroup selected}} - two radiogroups with same selected bindings'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED:NONE:BOB:JIMUPDATED|jimUpdated-:JIMUPDATED:JIMUPDATED|", + '{^{radiogroup selected}} - two radiogroups with same selected bindings - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '{^{radiogroup selected}}' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + + '{^{radiogroup selected}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + ); + + model = { + selected: "Jim", + people: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert([{name: "Bob"},{name: "Jim"},{name: "newName"}]); + + res += $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":NONE||:BOB:JIM:NEWNAME:NONE:BOB:JIM:NEWNAME|:JIM:JIM|||Bob-:BOB:BOB|", + '{^{radiogroup selected}} - two radiogroups with same selected bindings - starting out with no items, so no radio buttons'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '{^{radiogroup selected name="rad1"}}' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + + '{^{radiogroup selected name="rad1"}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + +'{{/radiogroup}}' + ); + + model = { + selected: "Jim", + people: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert([{name: "Bob"},{name: "Jim"},{name: "newName"}]); + + res += $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|" + $("#result input:checked")[0].name + "|" + $("#result input:checked")[1].name; + + // ............................... Assert ................................. + assert.equal(res, ":NONE||:BOB:JIM:NEWNAME:NONE:BOB:JIM:NEWNAME|:JIM:JIM|||Bob-:BOB:BOB|rad1|rad2", + '{^{radiogroup selected}} - name for group can be specified rather than auto-generated - on item or on radiogroup tag'); + + // ................................ Reset ................................ + $("#result").empty(); + +}); + +QUnit.test('radio buttons without {{radiogroup}}', function(assert) { + + // =============================== Arrange =============================== + var tmpl = $.templates( + '{^{for people}}' + + '' + + '{{/for}}' + ); + + var model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }, + newName = "new"; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":Jim|:new||Bob-:Bob|", + '{^{for ...}}...'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '' + + '{^{for people}}' + + '' + + '{{/for}}' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":JIM|:NEW||None-:NONE|", + '...{^{for ...}}...'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED|jimUpdated-:JIMUPDATED|", + '{^{for ...}}... - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates({markup: + '' + + '{^{for people}}' + + '' + + '{{/for}}', + converters: { + upper: function(val) { + return val.toUpperCase(); + } + } + }); + + model = { + selected: "JIM", + people: [ + {name: "bob"}, + {name: "jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + model.selectedOut + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":jim|:new||new-NONE-:none|", + 'data-link="{:select convert=... convertBack=... linkTo=...:}"'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + model.selectedOut + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":none:bob:jimUpdated|new-JIMUPDATED-:jimUpdated|", + 'data-link="{:select convert=... convertBack=... linkTo=...:}" - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + ':' + + '{^{for people}}' + + ':' + + '{{/for}}' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, "JIM|NEW||None-NONE|", + 'data-link="selected" with labels by for/id'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#" + $("#result input:checked").prop("id") + "Lbl").text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED|jimUpdated-JIMUPDATED|", + 'data-link="selected" with labels by for/id - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '' + + '{^{for people}}' + + '' + + '{{/for}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + ); + + model = { + selected: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert({ + name: newName + }); + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":JIM:JIM|:NEW:NEW||None-:NONE:NONE|", + 'data-link="selected" - two radiogroups with same selected bindings'); + + // ............................... Act ................................. + $.observable(model.people[1]).setProperty("name", "jimUpdated"); + + res = $("#result").text() + "|"; + + $("#result input").eq(2).prop("checked", true).change(); // Check third radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + assert.equal(res, ":NONE:BOB:JIMUPDATED:NONE:BOB:JIMUPDATED|jimUpdated-:JIMUPDATED:JIMUPDATED|", + 'data-link="selected" - two radiogroups with same selected bindings - updated label and value'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + tmpl = $.templates( + '{^{for people}}' + + '' + + '{{/for}}' + + '' + + '{^{for people}}' + + '' + + '{{/for}}' + ); + + model = { + selected: "Jim", + people: [] + }; + + // ............................... Act ................................. + tmpl.link("#result", model); + + res = $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).insert([{name: "Bob"},{name: "Jim"},{name: "newName"}]); + + res += $("#result").text() + "|" + $("#result input:checked").parent().text() + "|"; + + $.observable(model).setProperty("selected", newName); + + res += $("#result input:checked").parent().text() + "|"; + + $.observable(model.people).remove(2); + + res += $("#result input:checked").parent().text() + "|"; + + $("#result input").first().prop("checked", true).change(); // Check first radio button + + res += model.selected + "-" + $("#result input:checked").parent().text() + "|"; + + // ............................... Assert ................................. + assert.equal(res, ":NONE||:BOB:JIM:NEWNAME:NONE:BOB:JIM:NEWNAME|:JIM:JIM|||Bob-:BOB:BOB|", + 'data-link="selected" - two radiogroups with same selected bindings - starting out with no items, so no radio buttons'); + + // ................................ Reset ................................ + $("#result").empty(); + +}); + +QUnit.test('{^{on}}', function(assert) { + + $.views.settings.advanced({_jsv: true}); // For using _jsv + + // =============================== Arrange =============================== + + function swap(ev, eventArgs) { + $.observable(this).setProperty("type", this.type === "shape" ? "line" : "shape"); + } + var thing = { + type: "shape", + swap: swap + }; + + $.templates('{^{on swap/}} {^{:type}}') + .link("#result", thing); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "swap shape|swapline" + : "swap shape|swap line", + '{^{on swap/}} renders as button with label "swap", and calls swap method on click, with "this" pointer context on data object'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('{^{on missingMethod/}} {^{:type}}') + .link("#result", thing); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "noop shape|noop shape", + '{^{on missingMethod/}} renders as button with label "noop", and is noop on click'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + var tmpla = $.templates('{^{on swap}} clickme {{/on}} {^{:type}}'); + + tmpla.link("#result", thing); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "clickme shape|clickmeline" + : "clickme shape|clickme line", + '{^{on swap}} clickme {{/on}} renders as button with label "clickme", and calls swap method on click'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('{^{on swap tmpl=~label}} clickme {{/on}} {^{:type}}') + .link("#result", thing, {label: "clickagain"}); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "clickagain shape|clickagainline" + : "clickagain shape|clickagain line", + '{^{on swap tmpl=stringValue renders as button with label stringValue, and calls swap method on click'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('{^{on swap}}clickme{{/on}} {^{:type}}') + .link("#result", thing); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result span").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "clickme shape|clickmeline" + : "clickme shape|clickme line", + '{^{on swap}}clickme{{/on}} renders as span with label clickme, and calls swap method on click'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('{^{on ~swap/}} {^{:type}}') + .link("#result", thing, {swap: swap}); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "~swap shape|~swapline" + : "~swap shape|~swap line", + '{^{on ~swap/}} calls swap helper method on click, with "this" pointer context defaulting to current data object'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('{^{on ~util.swap/}} {^{:type}} {^{:check}}') + .link("#result", thing, { + util: + { + swap: function(ev, eventArgs) { + $.observable(this.data).setProperty({ + type: this.data.type === "shape" ? "line" : "shape", + check: this.data === eventArgs.view.data + }); + }, + data: thing + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "~util.swap shape |~util.swaplinetrue " + : "~util.swap shape |~util.swap line true", + '{^{on ~util.swap/}} calls util.swap helper method on click, with ~util as this pointer'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + + $.templates('{^{on ~util.swap context=#data/}} {^{:type}}') + .link("#result", thing, { + util: + { + swap: swap + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "~util.swap shape|~util.swapline" + : "~util.swap shape|~util.swap line", + '{^{on ~util.swap context=#data/}} calls util.swap helper method on click, with current data object as this pointer'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + + // =============================== Arrange =============================== + + $.templates('{^{on ~util.swap context=~util.swapCtx/}} {^{:type}} {^{:check}}') + .link("#result", thing, { + util: + { + swap: function(ev, eventArgs) { + $.observable(this.data).setProperty({ + type: this.data.type === "shape" ? "line" : "shape", + check: this.data === eventArgs.view.data + }); + }, + data: thing, + swapCtx: { + data: thing + } + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "~util.swap shape |~util.swaplinetrue " + : "~util.swap shape |~util.swap line true", + '{^{on ~util.swap context=~util.swapCtx/}} calls util.swap helper method on click, with util.swapCtx as this pointer'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + + $.templates('{^{on ~util.swap data=#data/}} {^{:type}} {^{:check}}') + .link("#result", thing, { + util: + { + swap: function(ev, eventArgs) { + $.observable(ev.data).setProperty({ + type: ev.data.type === "shape" ? "line" : "shape", + check: ev.data === eventArgs.view.data + }); + }, + data: thing, + swapCtx: { + data: thing + } + } + }); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").click(); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "~util.swap shape |~util.swaplinetrue " + : "~util.swap shape |~util.swap line true", + '{^{on ~util.swap data=#data/}} calls util.swap helper method on click, and passes current data #data as ev.data'); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + + $.templates('{^{on \'mouseup mousedown blur\' swap/}} {^{:type}}') + .link("#result", thing); + + // ................................ Act .................................. + before = $("#result").text(); + $("#result button").mouseup(); + after = $("#result").text(); + $("#result button").mousedown(); + after += $("#result").text(); + $("#result button").blur(); + after += $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "swap shape|swaplineswapshapeswapline" + : "swap shape|swap lineswap shapeswap line", + "{^{on 'mouseup mousedown blur' swap/}} calls util method on mouseup, mousedown and blur"); + + // ................................ Reset ................................ + $("#result").empty(); + thing.type = "shape"; + delete thing.check; + + // =============================== Arrange =============================== + var res = "1: "; + $.templates( + "
                  {^{on 'keyup keydown' '.inputA' unbind}}{^{on 'keyup' '#inputB' unbind}}{^{on 'mouseup' 'input' test}}{^{on 'mousedown' '#inputB' refresh}}\">" + + "" + + "" + + "{{/on}}{{/on}}{{/on}}{{/on}}
                  ") + .link("#result", { + unbind: function(ev, eventArgs) { + res += "unbind "; + eventArgs.linkCtx.tag.onUnbind(); + }, + refresh: function(ev, eventArgs) { + res += "refresh "; + eventArgs.linkCtx.tag.refresh(); + }, + test: function() { + res += "test "; + } + }); + + // ................................ Act .................................. + var events = $._data($("#divForOn")[0]).events, + eventBindings = "before: " + events.keydown.length + events.keyup.length + events.mouseup.length + events.mousedown.length; + + $("#divForOn #inputB").mouseup(); + + res += "2: "; + $("#divForOn .inputA").mouseup(); + + res += "3: "; + $("#divForOn #inputB").keyup(); + + res += "4: "; + $("#divForOn #inputB").keyup(); + + res += "5: "; + $("#divForOn .inputA").keydown(); + + res += "6: "; + $("#divForOn .inputA").keyup(); + + res += "7: "; + $("#divForOn #inputB").mouseup(); + + res += "8: "; + $("#divForOn #inputB").mousedown(); + + eventBindings += " | after: " + events.keydown + events.keyup + events.mouseup.length + events.mousedown.length; + + // ............................... Assert ................................. + assert.equal(res, + "1: test 2: test 3: unbind 4: 5: unbind 6: 7: test 8: refresh ", + "multiple {^{on events selector method}} bindings on container attach events on delegated elements. Also, tag.onDispose on tag instances removes specific handlers for corresponding elements/selectors"); + + // ............................... Assert ................................. + assert.equal(eventBindings, + "before: 1211 | after: undefinedundefined11", + "onDispose removes specific delegated events"); + + // ................................ Act .................................. + res = "1: "; + $("#divForOn #inputB").after(""); + + $("#divForOn #newlyAdded").mouseup(); + + res += "2: "; + $("#divForOn #newlyAdded").keyup(); + + // ............................... Assert ................................. + assert.equal(res, + "1: test 2: ", + "delegated {^{on events selector method}} binding allows additional elements added to content to bind correctly"); + + // ................................ Act .................................. + $("#result").empty(); + eventBindings = "" + events.keydown + events.keyup + events.mouseup + JSON.stringify([_jsv.cbBindings, _jsv.bindings]); + + // ............................... Assert ................................. + assert.equal(eventBindings, + "undefinedundefinedundefined[{},{}]", + "Removing the element removes all associated attached {on } handlers"); + + // =============================== Arrange =============================== + var tmpl = $.templates("{^{on 'click' '#doIt' 754 thisIsTheMethod role 'hey' true process data=option 33 #data context=option}}\ + \ + \ +{{/on}}"), + + data = { + name: "Jo", + role: "Advisor", + option: { + allow: true + }, + thisIsTheMethod: function(role, text, isFoo, compile, amount, root, ev, eventArgs) { + if (compile) { + compile.call(root, role, text, isFoo, amount, ev.data.allow, eventArgs.linkCtx.tag.tagCtx.args[2]); + } + }, + process: function(role, text, isFoo, amount, allow, extraParam) { + $.observable(this).setProperty("res", this.res + role + text + isFoo + amount + " allow:" + allow + " extraParam: " + extraParam + "|"); + }, + res: "" + }; + + tmpl.link("#result", data); + + // ................................ Act .................................. + $("#doIt").click(); + data.option.allow = false; + $.observable(data).setProperty("role", "Follower"); + $("#doIt").click(); + + // ............................... Assert ................................. + assert.equal(data.res, "Advisorheytrue33 allow:true extraParam: 754|Followerheytrue33 allow:false extraParam: 754|", + "{^{on 'click' selector otherParams... method params...}} : supports passing params to method, of any type, as well as setting data and context for the function call"); + + // ................................ Act .................................. + $("#result").empty(); + + // =============================== Arrange =============================== + + var tmpl = $.templates("{^{on doit id='doIt' class='red' width='100' height='100'/}}"), + res = "", + data = { + name: "Jo", + doit: function() { + var button = $("button"); + res = (Math.round(10*button.width())/10) + "|" + (Math.round(10*button.height())/10) + "|" + button[0].id + "|" + button[0].className; + } + }; + + tmpl.link("#result", data); + + // ................................ Act .................................. + $("#doIt").click(); + + // ............................... Assert ................................. + assert.equal(res, "100|100|doIt|red", + "{^{on ... id=... class=... width=... height=...}} : supports setting id, class, height and width"); + + // ................................ Act .................................. + $("#result").empty(); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test('data-link="{tag...} and {^{tag}} in same template"', function(assert) { +var done = assert.async(); + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + + $.templates('{^{tmplTag/}}-{^{:lastName}} -') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text() + $("#result input").val(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + after = $("#result").text() + $("#result input").val(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'Name: Mr Jo. Width: 30-One Name: Mr Jo. Width: 30-OneOne|Name: Sir newFirst. Width: 40-newLast Name: Sir newFirst. Width: 40-newLastnewLast', + 'Data link using: {^{tmplTag/}} {^{:lastName}} '); + + // ................................ Reset ................................ + $("#result").empty(); + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop:{^{:lastName}} computed:{^{:fullName()}} Tag:{^{tmplTag/}}') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text() + $("#last").val() + $("#full").val(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text() + $("#last").val() + $("#full").val(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + 'prop:OneOne computed:Mr Jo OneMr Jo One Tag:Name: Mr Jo. Width: 30Name: Mr Jo. Width: 30OneMr Jo One|prop:compLastcompLast computed:Sir compFirst compLastSir compFirst compLast Tag:Name: Sir compFirst. Width: 40Name: Sir compFirst. Width: 40compLastSir compFirst compLast', + 'Data link using: {^{:lastName}} {^{:fullName()}} {^{tmplTag/}} '); + + // ................................ Act .................................. + keydown($("#full").val("newFirst newLast")); + +setTimeout(function() { + after = $("#result").text() + $("#last").val() + $("#full").val(); + + // ............................... Assert ................................. + assert.equal(after, + "prop:newLastnewLast computed:Sir newFirst newLastSir newFirst newLast Tag:Name: Sir newFirst. Width: 40Name: Sir newFirst. Width: 40newLastnewFirst newLast", + 'Two-way binding to a computed observable correctly calls the setter'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events && !$._data(settings).events, + "$(container).empty removes the views and current listeners from that content"); + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop:{^{:lastName}} computed:{^{:fullName()}} Tag:{^{tmplTag/}}') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text() + $("#last").val() + $("#full").val(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text() + $("#last").val() + $("#full").val(); + + // ............................... Assert ................................. + res = 'prop:OneOne computed:Mr Jo OneMr Jo One Tag:Name: Mr Jo. Width: 30Name: Mr Jo. Width: 30OneMr Jo One|prop:compLastcompLast computed:Sir compFirst compLastSir compFirst compLast Tag:Name: Sir compFirst. Width: 40Name: Sir compFirst. Width: 40compLastSir compFirst compLast'; + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + + assert.ok(before + "|" + after === res && !viewsAndBindings() && !$._data(person1).events && !$._data(settings).events, + "$.unlink(container) removes the views and current listeners from that content"); + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop:{^{:lastName}} computed:{^{:fullName()}} Tag:{^{tmplTag/}}') + .link("#result", person1); + + // ................................ Act .................................. + $("#result").unlink(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(person1).events && !$._data(settings).events, + "$(container).unlink() removes the views and current listeners from that content"); + + // =============================== Arrange =============================== + + $.templates('prop:{^{:lastName}} computed:{^{:fullName()}} Tag:{^{tmplTag/}}') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text() + $("#last").val() + $("#full").val(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text() + $("#last").val() + $("#full").val(); + + // ............................... Assert ................................. + res = 'prop:OneOne computed:Mr Jo OneMr Jo One Tag:Name: Mr Jo. Width: 30Name: Mr Jo. Width: 30OneMr Jo One|prop:compLastcompLast computed:Sir compFirst compLastSir compFirst compLast Tag:Name: Sir compFirst. Width: 40Name: Sir compFirst. Width: 40compLastSir compFirst compLast'; + + // ................................ Act .................................. + viewContent = viewsAndBindings(); + + $.unobserve(person1, "*", settings, "*"); + + // ............................... Assert ................................. + + assert.ok(before + "|" + after === res && viewContent === viewsAndBindings() && !$._data(person1).events && !$._data(settings).events, + '$.unobserve(person1, "*", settings, "*") removes the current listeners from that content, but leaves the views'); + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + + // =============================== Arrange =============================== + + $.templates('prop:{^{:lastName}} computed:{^{:fullName()}} Tag:{^{tmplTag/}}') + .link("#result", person1); + + // ................................ Act .................................. + before = $("#result").text() + $("#last").val() + $("#full").val(); + $.observable(person1).setProperty({firstName: "newFirst", lastName: "newLast"}); + $.observable(settings).setProperty({title: "Sir", width: 40}); + $.observable(person1).setProperty({fullName: "compFirst compLast"}); + after = $("#result").text() + $("#last").val() + $("#full").val(); + + // ............................... Assert ................................. + res = 'prop:OneOne computed:Mr Jo OneMr Jo One Tag:Name: Mr Jo. Width: 30Name: Mr Jo. Width: 30OneMr Jo One|prop:compLastcompLast computed:Sir compFirst compLastSir compFirst compLast Tag:Name: Sir compFirst. Width: 40Name: Sir compFirst. Width: 40compLastSir compFirst compLast'; + + // ................................ Act .................................. + $.unlink(); + + // ............................... Assert ................................. + + assert.ok(before + "|" + after === res && !viewsAndBindings() && !$._data(person1).events && !$._data(settings).events, + '$.unlink() removes all views and listeners from the page'); + + // ................................ Reset ................................ + person1._firstName = "Jo"; // reset Prop + person1.lastName = "One"; // reset Prop + settings.title = "Mr"; // reset Prop + settings.width = 30; // reset Prop + $.views.settings.advanced({_jsv: false}); + // TODO ADDITIONAL TESTS: + // 1: link(null, data) to link whole document + +done(); +}, 0); +}); + +QUnit.test("Fallbacks for missing or undefined paths: using {^{:some.path onError = 'fallback'}}, etc.", function(assert) { + + $.views.settings.advanced({_jsv: true}); // For using viewsAndBindings() + + // =============================== Arrange =============================== + + $.views.tags({ + mytag1: function(val) {return val + " from my tag1"; }, + mytag2: { + template: "{{:}} from my tag2" + } + }).converters({ + upper: function(val) { + return val.toUpperCase(); + } + }); + + var initial = {a: {b: null}}, + updated = {c: {val: 'leaf'}}; + + $.templates( + "{^{:a.b^c.val onError=~error + 'A '}} " + + "{^{upper:a.b^c.val onError=~error + 'B '}} " + + "{^{>a.b^c.val onError=~error + 'C '}} " + + "{^{if a.b^c onError=~error + 'D '}}{{:a.b.c.val}}{{/if}} " + + "{^{for a.b^c onError=~error + 'E ' ~foo='foo'}}{{:val + ~foo}}{{/for}} " + + "{^{mytag1 a.b^c.val onError=~error + 'F '/}} " + + "{^{mytag2 a.b^c.val onError=~error + 'G '/}} " + + " " + + " " + + " " + + " ") + .link("#result", initial, {error: "err:"}); + // ................................ Act .................................. + + before = "" + $._data(initial.a).events.propertyChange.length + " " + !$._data(updated).events + " " + !$._data(updated.c).events + "|" + + $("#result").text() + "|"; + $.observable(initial.a).setProperty('b', updated); + after = $("#result").text() + "|"; + $.observable(initial.a.b.c).setProperty('val', "leaf2"); + after += $("#result").text() + "|"; + $.observable(initial.a.b).setProperty('c', {val: "leaf3"}); + after += $("#result").text() + "|"; + $.observable(initial.a).setProperty('b', {c: {val: "leaf4"}}); + after += $("#result").text() + "|"; + after += "" + $._data(initial.a).events.propertyChange.length + " " + $._data(initial.a.b).events.propertyChange.length + " " + $._data(initial.a.b.c).events.propertyChange.length + + " " + !$._data(updated).events + " " + !$._data(updated.c).events + "|" + + $("#result").text() + "|"; + + var prevB = initial.a.b; + + $.observable(initial.a).setProperty('b', null); + after += "" + $._data(initial.a).events.propertyChange.length + " " + !$._data(prevB).events + " " + !$._data(prevB.c).events + "|" + + $("#result").text() + "|"; + + $.observable(initial.a).setProperty('b', updated); + + after += $("#result").text() + "|"; + + assert.equal(before + after, + isIE8 + ? "11 true true|" + + "err:A ERR:B err:C err:D err:E err:F err:G err:H err:I ERR:J err:K |" + + "leafLEAFleafleafleaffooleaf from my tag1leaf from my tag2 leafleaf from my tag1LEAFLEAF|" + + "leaf2LEAF2leaf2leafleaffooleaf2 from my tag1leaf2 from my tag2 leaf2leaf2 from my tag1LEAF2LEAF2|" + + "leaf3LEAF3leaf3leafleaf3fooleaf3 from my tag1leaf3 from my tag2 leaf3leaf3 from my tag1LEAF3LEAF3|" + + "leaf4LEAF4leaf4leafleaf4fooleaf4 from my tag1leaf4 from my tag2 leaf4leaf4 from my tag1LEAF4LEAF4|" + + "11 11 9 true true|" + + "leaf4LEAF4leaf4leafleaf4fooleaf4 from my tag1leaf4 from my tag2 leaf4leaf4 from my tag1LEAF4LEAF4|" + + "11 true true|" + + "err:A ERR:B err:C err:D err:E err:F err:G err:H err:I ERR:J ERR:K |" + + "leaf3LEAF3leaf3leaf3leaf3fooleaf3 from my tag1leaf3 from my tag2 leaf3leaf3 from my tag1LEAF3LEAF3|" + : "11 true true|" + + "err:A ERR:B err:C err:D err:E err:F err:G err:H err:I ERR:J err:K |" + + "leaf LEAF leaf leaf leaffoo leaf from my tag1 leaf from my tag2 leaf leaf from my tag1 LEAF LEAF |" + + "leaf2 LEAF2 leaf2 leaf leaffoo leaf2 from my tag1 leaf2 from my tag2 leaf2 leaf2 from my tag1 LEAF2 LEAF2 |" + + "leaf3 LEAF3 leaf3 leaf leaf3foo leaf3 from my tag1 leaf3 from my tag2 leaf3 leaf3 from my tag1 LEAF3 LEAF3 |" + + "leaf4 LEAF4 leaf4 leaf leaf4foo leaf4 from my tag1 leaf4 from my tag2 leaf4 leaf4 from my tag1 LEAF4 LEAF4 |" + + "11 11 9 true true|" + + "leaf4 LEAF4 leaf4 leaf leaf4foo leaf4 from my tag1 leaf4 from my tag2 leaf4 leaf4 from my tag1 LEAF4 LEAF4 |" + + "11 true true|" + + "err:A ERR:B err:C err:D err:E err:F err:G err:H err:I ERR:J ERR:K |" + + "leaf3 LEAF3 leaf3 leaf3 leaf3foo leaf3 from my tag1 leaf3 from my tag2 leaf3 leaf3 from my tag1 LEAF3 LEAF3 |", + + "deep linking in templates, using onError - correctly re-link to data when missing objects are dynamically replaced"); + + // ................................ Act .................................. + $.unlink(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(initial.a).events && !$._data(initial.a.b).events, + '$.unlink() removes all views and listeners from the page'); + + // =============================== Arrange =============================== + + function Item(value, title) { + this.title = title; + this._value = value; + this.value = function(val) { + if (!arguments.length) { + return this._value; + } else { + this._value = val; + } + }; + this.value.set = true; + } + + initial = new Item("string1", "A"); + + $.templates( + "{^{:value() onError='error1'}} {^{:title}} " + + "{^{:value()^value() onError='error2'}} {^{:value()^title onError='error2b'}} " + + "{^{:value()^value().value() onError='error3'}} {^{:value()^value().title onError='error3b'}} " + + "{^{:value()^value().value().value() onError='error4'}} {^{:value()^value().value().title onError='error4b'}} " + ).link("#result", initial); + // ................................ Act .................................. + var B, C, D, a, b, c, d, e; + + before = $("#result").text() + "|"; + $.observable(initial).setProperty('value', B = new Item("string2", "B")); + after = $("#result").text() + "|"; + $.observable(initial.value()).setProperty('value', C = new Item("string3", "C")); + after += $("#result").text() + "|"; + $.observable(initial.value().value()).setProperty('value', D = new Item("string4", "D")); + after += $("#result").text() + "|"; + $.observable(initial).removeProperty('value'); + after += $("#result").text() + "|"; + $.observable(initial).setProperty('value', a = new Item(b = new Item(c = new Item(d = new Item(e = new Item("string4", "e"), "d"), "c"), "b"), "a")); + after += $("#result").text() + "|"; + + assert.equal(before + after, + isIE8 + ? "string1 A error2 error3 error3b error4 error4b |" + + "[object Object] Astring2Berror3error4error4b |" + + "[object Object] A[object Object]Bstring3Cerror4 |" + + "[object Object] A[object Object]B[object Object]Cstring4D |" + + "[object Object] Aerror2error3error3berror4error4b |" + + "[object Object] A[object Object]a[object Object]b[object Object]c |" + : + "string1 A error2 error3 error3b error4 error4b |" + + "[object Object] A string2 B error3 error4 error4b |" + + "[object Object] A [object Object] B string3 C error4 |" + + "[object Object] A [object Object] B [object Object] C string4 D |" + + "[object Object] A error2 error3 error3b error4 error4b |" + + "[object Object] A [object Object] a [object Object] b [object Object] c |", + + "deep linking in templates, using onError - correctly re-link to data when missing objects are dynamically replaced"); + + // ................................ Act .................................. + $.unlink(); + + // ............................... Assert ................................. + + assert.ok(!viewsAndBindings() && !$._data(initial.value()).events && !$._data(initial.value().value()).events, + '$.unlink() removes all views and listeners from the page'); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test('Bound tag properties and contextual parameters', function(assert) { + // =============================== Arrange =============================== + + var things = [ + { + type: "shape", + form: "circle" + }, + { + type: "line", + form: "square", + thickness: "1" + } + ]; + $.templates('Tag: {^{include ^tmpl=~typeTemplates[type]/}} Elem:
                  ') + .link("#result", things, { + typeTemplates: { + shape: "Shape: {^{:form}}\n", + line: "Line: {^{:form}} {^{:thickness}}\n" + } + } + ); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things[0]).setProperty({type: "line", thickness: 5}); + $.observable(things[1]).setProperty({type: "shape"}); + $.observable(things[1]).removeProperty("thickness"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " + : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + 'binding to ^tmpl=... :{^{include ^tmpl=~typeTemplates[type]... and data-link="{include ^tmpl=~typeTemplates[type]...'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + var things = [ + { + type: "shape", + form: "circle" + }, + { + type: "line", + form: "square", + thickness: "1" + } + ]; + $.templates('Tag: {^{if true ^tmpl=~typeTemplates[type]/}} Elem:
                  ') + .link("#result", things, { + typeTemplates: { + shape: "Shape: {^{:form}}\n", + line: "Line: {^{:form}} {^{:thickness}}\n" + } + } + ); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things[0]).setProperty({type: "line", thickness: 5}); + $.observable(things[1]).setProperty({type: "shape"}); + $.observable(things[1]).removeProperty("thickness"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " + : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + 'binding to ^tmpl=... :{^{if true ^tmpl=~typeTemplates[type]... and data-link="{if true ^tmpl=~typeTemplates[type]...'); + + // ................................ Reset ................................ + $("#result").empty(); + +// =============================== Arrange =============================== + + var things = [ + { + type: "shape", + form: "circle" + }, + { + type: "line", + form: "square", + thickness: "1" + } + ]; + $.templates('Tag: {^{if false}}{{else ^tmpl=~typeTemplates[type]}}{{/if}} Elem:
                  ') + .link("#result", things, { + typeTemplates: { + shape: "Shape: {^{:form}}\n", + line: "Line: {^{:form}} {^{:thickness}}\n" + } + } + ); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things[0]).setProperty({type: "line", thickness: 5}); + $.observable(things[1]).setProperty({type: "shape"}); + $.observable(things[1]).removeProperty("thickness"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " + : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + 'binding to ^tmpl=... :{^{if false}}{{else ^tmpl=~typeTemplates[type]... and data-link="{if false}{else ^tmpl=~typeTemplates[type]...'); + + // ................................ Reset ................................ + $("#result").empty(); + +// =============================== Arrange =============================== + + var things = [ + { + type: "shape", + form: "circle" + }, + { + type: "line", + form: "square", + thickness: "1" + } + ]; + $.templates('Tag: {^{for undefined}}{{else ^tmpl=~typeTemplates[type]}}{{/for}} Elem:
                  ') + .link("#result", things, { + typeTemplates: { + shape: "Shape: {^{:form}}\n", + line: "Line: {^{:form}} {^{:thickness}}\n" + } + } + ); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things[0]).setProperty({type: "line", thickness: 5}); + $.observable(things[1]).setProperty({type: "shape"}); + $.observable(things[1]).removeProperty("thickness"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " + : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + 'binding to ^tmpl=... :{^{for undefined}}{{else ^tmpl=~typeTemplates[type]... and data-link="{for undefined}{else ^tmpl=~typeTemplates[type]...'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + things = [ + { + type: "shape", + form: "circle" + }, + { + type: "line", + form: "square", + thickness: "1" + } + ]; + $.templates('Bound condition: {^{include ^~condition=type==="shape"}}{{:type}} {{:~condition}} {{/include}}' + + 'Unbound condition: {^{include ~condition=type==="shape"}}{{:type}} {{:~condition}} {{/include}}') + .link("#result", things); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things[0]).setProperty({type: "line", thickness: 5}); + $.observable(things[1]).setProperty({type: "shape"}); + $.observable(things[1]).removeProperty("thickness"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "Bound condition: shape true Unbound condition: shape true Bound condition: line false Unbound condition: line false |Bound condition:line false Unbound condition: shape true Bound condition:shape true Unbound condition: line false " + : "Bound condition: shape true Unbound condition: shape true Bound condition: line false Unbound condition: line false |Bound condition: line false Unbound condition: shape true Bound condition: shape true Unbound condition: line false ", + 'Binding to contextual parameter {^{include ^~condition=... triggers update. Unbound contextual parameter {^{include ~condition=... does not trigger updated content'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + things = [ + { + type: "shape", + form: "circle" + }, + { + type: "line", + form: "square", + thickness: "1" + } + ]; + + $.views.tags({ + updatingTag: { + }, + nonUpdatingTag: { + onUpdate: function() { + return false; + } + } + }); + $.templates('Updating: {^{updatingTag ^condition=type==="shape"}}{{:type}} {^{:~tagCtx.props.condition}} {{/updatingTag}} ' + + 'Non updating: {^{nonUpdatingTag ^condition=type==="shape"}}{{:type}} {^{:~tagCtx.props.condition}} {{/nonUpdatingTag}}') + .link("#result", things); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things[0]).setProperty({type: "line", thickness: 5}); + $.observable(things[1]).setProperty({type: "shape"}); + $.observable(things[1]).removeProperty("thickness"); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "Updating: shape true Non updating: shape true Updating: line false Non updating: line false |Updating:line false Non updating: shapefalse Updating:shape true Non updating: linetrue " + : "Updating: shape true Non updating: shape true Updating: line false Non updating: line false |Updating: line false Non updating: shape false Updating: shape true Non updating: line true ", + 'Binding to property triggers update {^{updatingTag ^condition=... unless tag is non-updating: {^{nonUpdatingTag ^condition=...'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + $.templates({ + myTmpl: "{{>name}} lead:{^{>~team.lead}} - " + }); + + var model = { + lead: "Jim", + people: [ + {name: "Bob"}, + {name: "Jim"} + ] + }; + + // ............................... Act ................................. + $.templates("
                  ").link("#result", model); + + res = $("#result").text(); + + $.observable(model.people).insert({ + name: "newName" + }); + + $.observable(model).setProperty("lead", "newName"); + + res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, (isIE8 ? "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName -newName lead:newName - " + : "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName - newName lead:newName - "), + "data-link allows passing in new contextual parameters to template: data-link=\"{for people ~team=#data tmpl=..."); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + model = { + sortby: "role", + cols: ["name", "role"], + sort: function(ev, eventArgs) { + $.observable(data).setProperty({ + sortby: data.sortby === "role" ? "name" : "role" + }); + } + }; + + // ............................... Act ................................. + $.templates('{^{for cols itemVar="~col"}}{^{:~root.sortby === ~col}}{{/for}}').link("#result", model); + + res = $("#result").text(); + + $.observable(model).setProperty("sortby", model.sortby === "role" ? "name" : "role"); + + res += "|" + $("#result").text(); + + $.observable(model).setProperty("sortby", model.sortby === "role" ? "name" : "role"); + + res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "falsetrue|truefalse|falsetrue", + "itemVar variables in item list are distinct variables"); + + // ................................ Reset ................................ + $("#result").empty(); + +}); + +QUnit.test('Data-linking helpers and contextual parameters', function(assert) { +$.views.settings.trigger(false); + + // =============================== Arrange =============================== + + var data = {name: "Jo", address: {}}; + res = ""; + + $.templates( + '{{for address ~nm=name}}' + + '
                  ' + + '' + + '{{/for}}' + ) + .link("#result", data); + + // ................................ Act .................................. + + res += $("#result").text() + " | "; + + $.observable(data).setProperty("name", "new"); + + res += $("#result").text() + " | "; + + $("#input1").val('changed').change(); + + res += $("#result").text() + " | "; + + // ............................... Assert ................................. + assert.equal(res, + "Jo | new | changed | ", + 'contextual parameter two-way binding'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + var things = [ + { + type: "shape", + form: "circle" + }, + { + type: "line", + form: "square", + thickness: "1" + } + ]; + $.templates('{^{include ~condition=type==="shape"}}{{:type}} {^{:type}} {^{:~condition}} {{/include}}') + .link("#result", things); + + // ................................ Act .................................. + before = $("#result").text(); + $.observable(things[0]).setProperty({type: "line", thickness: 5}); + $.observable(things[1]).setProperty({type: "shape"}); + after = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + isIE8 ? "shape shape true line line false |shapelinefalse lineshapetrue " + : "shape shape true line line false |shape line false line shape true ", + 'contextual parameter {^{include ~condition=... does not trigger update but references are bound'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + var getContent = function() { + $("#result input").each(function() { + res += this.value; + }); + res += $("#result").text() + "|"; + } + + var tmpl = $.templates( +'\ +\ +\ +\ +{^{include ~f1 = foo}}\ +\ +{^{include ~f2 = #data.foo}}\ +\ +\ +{^{include ~f3 = #view.data.foo}}\ +{^{:~f1}}\ +{^{:~f2}}\ +{^{:~f3}}\ +\ +\ +\ +{{/include}}\ +{{/include}}\ +{{/include}}\ +'); + + // ............................... Act ................................. + tmpl.link("#result", {foo: "F"}); + + var cnt = 0; + res = ""; + getContent(); + + $("#result input").each(function() { + $("#result input").val(cnt++).change(); + getContent(); + }); + + assert.equal(res, "FFFFFFFFFFFF|000000000000|111111111111|222222222222|333333333333|444444444444|" + + "555555555555|666666666666|777777777777|888888888888|", + 'Two-way binding to contextual parameters'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + getContent = function getContent() { + return $("#outerInput").val() + ":" + $("#innerInput").val() + ":" + $("#innerDiv").text(); + } + + var tmpl = $.templates( +'{^{if true ~street=address(name)}}\ + \ + {^{for address ~street=~street^street}}\ +
                  \ + \ + {{/for}}\ +{{/if}}'); + + // ............................... Act ................................. + + var address = {street: "add"}; + var altAddress = {street: "alt"}; + + function getAddress(name) { + return (name.length > 2 || data.alt) ? altAddress : address; + } + + getAddress.depends = "alt"; + + var data = {name: "Jo", address: getAddress, alt: false}; + + tmpl.link("#result", data); + + before = getContent(); + + $("#outerInput").val("addOuter").change(); + + after = before + "|" + getContent(); + + $("#innerInput").val("addInner").change(); + + after += "|" + getContent(); + + $.observable(data).setProperty("name", "John"); + + after += "|" + getContent(); + + $("#outerInput").val("altOuter").change(); + + after += "|" + getContent(); + + $("#innerInput").val("altInner").change(); + + after += "|" + getContent(); + + $.observable(data).setProperty("name", "Me"); + + after += "|" + getContent(); + + $.observable(data).setProperty("alt", true); + + after += "|" + getContent(); + + assert.equal(after, "add:add:add|addOuter:addOuter:addOuter|addInner:addInner:addInner" + + "|alt:alt:alt|altOuter:altOuter:altOuter|altInner:altInner:altInner" + + "|addInner:addInner:addInner|altInner:altInner:altInner", + 'Two-way binding to contextual parameters with computed values'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + + var tmpl = $.templates( +'{^{for items}}\ +{{for 22 ~ind=#index}}\ +{{for 33 ~ind=~ind+1}}\ +{{for 33 ~ind=~ind*2}}\ +{{if true}}\ +{^{:~ind}}\ +{{/if}}\ +{{/for}}\ +{{/for}}\ +{{/for}}\ +{{/for}}' +); + + // ............................... Act ................................. + + var data = {items: [1,2,3]}; + + tmpl.link("#result", data); + + before = $("#result").text(); + + $.observable(data.items).remove(); + + after = before + "|" + $("#result").text(); + + $.observable(data.items).remove(); + + after += "|" + $("#result").text(); + + $.observable(data.items).insert(4); + + after += "|" + $("#result").text(); + + $.observable(data.items).insert(5); + + after += "|" + $("#result").text(); + + $.observable(data.items).insert(6); + + after += "|" + $("#result").text(); + + assert.equal(after, "246|24|2|24|246|2468", + 'Contextual parameter for index with array change'); + + // ................................ Reset ................................ + $("#result").empty(); + +$.views.settings.trigger(true); +}); + +QUnit.test("JsViews ArrayChange: insert()", function(assert) { + + // =============================== Arrange =============================== + $.views.tags({ + liTag: function() { + return "
                • Tag
                • "; + } + }); + + model.things = [{thing: "Orig"}]; // reset Prop + + $.templates('
                    {^{liTag/}}{^{for things}}
                  • {{:thing}}
                  • {^{liTag/}}{{/for}}
                  • |after
                  ') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "First"}); + $.observable(model.things).insert(1, {thing: "Last"}); + $.observable(model.things).insert(1, {thing: "Middle"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagFirstTagMiddleTagLastTagOrigTag|after", + 'Within element only content, insertion maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + $.views.tags({ + spanTag: function() { + return "Tag"; + } + }); + + model.things = [{thing: "Orig"}]; // reset Prop + + $.templates('
                  {^{spanTag/}}{^{for things}}{{:thing}}{^{spanTag/}}{{/for}}|after
                  ') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "First"}); + $.observable(model.things).insert(1, {thing: "Last"}); + $.observable(model.things).insert(1, {thing: "Middle"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagFirstTagMiddleTagLastTagOrigTag|after", + 'Within regular content, insertion finds correctly the previous view, prevNode, nextNode, etc and establishes correct element/textNode order and binding'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = [{thing: "Orig"}]; // reset Prop + + // =============================== Arrange =============================== + $.templates('{^{for things}}{{/for}}
                  {{:thing}}
                  ') + .link("#result", model); + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "First"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "FirstOrig", + 'Within element only content, insertion maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop +}); + +QUnit.test("JsViews ArrayChange: remove()", function(assert) { + // =============================== Arrange =============================== + $.views.tags({ + liTag: function() { + return "
                • Tag
                • "; + } + }); + + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates('
                    {^{liTag/}}{^{for things}}
                  • {{:thing}}
                  • {^{liTag/}}{{/for}}
                  • |after
                  ') + .link("#result", model); // -> TagOrigTagFirstTagMiddleTagLastTag|after + + // ................................ Act .................................. + $.observable(model.things).remove(1); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagOrigTagMiddleTagLastTag|after", + 'Within element only content, remove(1) maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Act .................................. + $.observable(model.things).remove(); //TagOrigTagFirstTagMiddleTagLastTag|after + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagOrigTagMiddleTag|after", + 'Within element only content, remov maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + $.views.tags({ + spanTag: function() { + return "Tag"; + } + }); + + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates('
                  {^{spanTag/}}{^{for things}}{{:thing}}{^{spanTag/}}{{/for}}|after
                  ') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).remove(1); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagOrigTagMiddleTagLastTag|after", + 'Within regular content, remove(1) finds correctly the previous view, prevNode, nextNode, etc and establishes correct element/textNode order and binding'); + + // ................................ Act .................................. + $.observable(model.things).remove(); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagOrigTagMiddleTag|after", + 'Within regular content, remove() finds correctly the previous view, prevNode, nextNode, etc and establishes correct element/textNode order and binding'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + +}); + +QUnit.test("JsViews ArrayChange: move()", function(assert) { + // =============================== Arrange =============================== + $.views.tags({ + liTag: function() { + return "
                • Tag
                • "; + } + }); + + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates('
                    {^{liTag/}}{^{for things}}
                  • {{:thing}}
                  • {^{liTag/}}{{/for}}
                  • |after
                  ') + .link("#result", model); // -> TagOrigTagFirstTagMiddleTagLastTag|after + + // ................................ Act .................................. + $.observable(model.things).move(2, 0, 2); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagMiddleTagLastTagOrigTagFirstTag|after", + 'Within element only content, move(2, 0, 2) maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + function addResult() { + result += "|" + $("#result").text(); + } + + var result = ""; + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; + model.one = false; + model.two = false; + + $.templates('
                    {^{if one}}
                  • One
                  • {{/if}}{^{if two}}
                  • Two
                  • {{/if}}{^{for things}}
                  • {{:thing}}
                  • {{/for}}
                  ') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).move(2, 0, 2); + addResult(); + $.observable(model).setProperty("one", true); + addResult(); + $.observable(model).setProperty("one", false); + addResult(); + $.observable(model).setProperty("one", true); + addResult(); + $.observable(model).setProperty("two", true); + addResult(); + $.observable(model).setProperty("two", false); + addResult(); + $.observable(model).setProperty("two", true); + addResult(); + $.observable(model).setProperty("one", false); + addResult(); + $.observable(model).setProperty("two", false); + addResult(); + + // ............................... Assert ................................. + assert.equal(result, "|MiddleLastOrigFirst|OneMiddleLastOrigFirst|MiddleLastOrigFirst|OneMiddleLastOrigFirst|OneTwoMiddleLastOrigFirst|OneMiddleLastOrigFirst|OneTwoMiddleLastOrigFirst|TwoMiddleLastOrigFirst|MiddleLastOrigFirst", + 'In element only content with preceding collapsible {{if}} blocks, move(2, 0, 2) maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Act .................................. + result = "" + + $.observable(model.things).refresh([{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]); + addResult(); + $.observable(model).setProperty("one", true); + addResult(); + $.observable(model).setProperty("one", false); + addResult(); + $.observable(model).setProperty("one", true); + addResult(); + $.observable(model).setProperty("two", true); + addResult(); + $.observable(model).setProperty("two", false); + addResult(); + $.observable(model).setProperty("two", true); + addResult(); + $.observable(model).setProperty("one", false); + addResult(); + $.observable(model).setProperty("two", false); + addResult(); + + // ............................... Assert ................................. + assert.equal(result, "|OrigFirstMiddleLast|OneOrigFirstMiddleLast|OrigFirstMiddleLast|OneOrigFirstMiddleLast|OneTwoOrigFirstMiddleLast|OneOrigFirstMiddleLast|OneTwoOrigFirstMiddleLast|TwoOrigFirstMiddleLast|OrigFirstMiddleLast", + 'In element only content with preceding collapsible {{if}} blocks, refresh(...) maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + result = ""; + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + model.one = []; + model.two = []; + + $.templates('
                    {^{for one}}
                  • {{:}}
                  • {{/for}}{^{for two}}
                  • {{:}}
                  • {{/for}}{^{for things}}
                  • {{:thing}}
                  • {{/for}}
                  ') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).move(2, 0, 2); + addResult(); + $.observable(model.one).insert("one"); + addResult(); + $.observable(model.one).remove(); + addResult(); + $.observable(model.one).insert("one"); + addResult(); + $.observable(model.two).insert("two"); + addResult(); + $.observable(model.two).remove(); + addResult(); + $.observable(model.two).insert("two"); + addResult(); + $.observable(model.one).remove(); + addResult(); + $.observable(model.two).remove(); + addResult(); + + // ............................... Assert ................................. + assert.equal(result, "|MiddleLastOrigFirst|oneMiddleLastOrigFirst|MiddleLastOrigFirst|oneMiddleLastOrigFirst|onetwoMiddleLastOrigFirst|oneMiddleLastOrigFirst|onetwoMiddleLastOrigFirst|twoMiddleLastOrigFirst|MiddleLastOrigFirst", + 'In element only content with preceding collapsible {{for}} blocks, move(2, 0, 2) maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Act .................................. + result = "" + $.observable(model.things).refresh([{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]); + addResult(); + $.observable(model.one).insert("one"); + addResult(); + $.observable(model.one).remove(); + addResult(); + $.observable(model.one).insert("one"); + addResult(); + $.observable(model.two).insert("two"); + addResult(); + $.observable(model.two).remove(); + addResult(); + $.observable(model.two).insert("two"); + addResult(); + $.observable(model.one).remove(); + addResult(); + $.observable(model.two).remove(); + addResult(); + + // ............................... Assert ................................. + assert.equal(result, "|OrigFirstMiddleLast|oneOrigFirstMiddleLast|OrigFirstMiddleLast|oneOrigFirstMiddleLast|onetwoOrigFirstMiddleLast|oneOrigFirstMiddleLast|onetwoOrigFirstMiddleLast|twoOrigFirstMiddleLast|OrigFirstMiddleLast", + 'In element only content with preceding collapsible {{for}} blocks, refresh(...) maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + $.views.tags({ + spanTag: function() { + return "Tag"; + } + }); + + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates('
                  {^{spanTag/}}{^{for things}}{{:thing}}{^{spanTag/}}{{/for}}|after
                  ') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).move(2, 0, 2); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagMiddleTagLastTagOrigTagFirstTag|after", + 'Within regular content, move(2, 0, 2) finds correctly the previous view, prevNode, nextNode, etc and establishes correct element/textNode order and binding'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop + + // =============================== Arrange =============================== + function move(from, to, number) { + $.observable(model.items).move(from, to, number); + } + function remove(index, number) { + $.observable(model.items).remove(index, number); + } + + function insert(index, item) { + $.observable(model.items).insert(index, item); + } + + function findRed() { + return " at: " + + $(".wrap").find("span[style]").view().index + "/" + + + $(".wrap2").find("li[style]").view().index + "/" + + + $(".wrap3").find("li[style]").view().index; + } + + function current() { + var seq = "", + redItemAt; + for (var i=0; iStart ' + + '{^{for items}}' + + '{^{:#index}} {{:}}|' + + '{{/for}}' + + 'End
                  ' + + + '
                  Start ' + + '{^{for items}}' + + ' {{:}}|' + + '{{/for}}' + + 'End
                  ' + + + 'Start
                    ' + + '{^{for items}}' + + '
                  • {^{:#index}} |
                  • ' + + '{{/for}}' + + '
                  End' + + + '
                    ' + + '
                  • Start
                  • ' + + '{^{for items}}' + + '
                  • ' + + '{{/for}}' + + '
                  • End
                  • ' + + '
                  ' + ) + .link("#result", model); + + $(".wrap").find("span:first").css("color", "red"); + $(".wrap2").find("li:first").css("color", "red"); + $(".wrap3").find("li:nth-of-type(2)").css("color", "red"); + +// ................................ Act .................................. + move(0, 1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(1,0,2,3,4), + 'moved one item from 0 to 1'); +} + +// ................................ Act .................................. + move(0, 1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(0,1,2,3,4), + 'moved one item from 0 to 1 again (actually swaps back to orginal positions'); +} + +// ................................ Act .................................. + move(1, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(1,0,2,3,4), + 'moved one item back from 1 to 0'); +} + +// ................................ Act .................................. + move(1, 0); // Return to original position + move(1, 0, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(0,1,2,3,4), + 'move(1, 0, 0) does nothing'); +} + +// ................................ Act .................................. + move(1, 1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(0,1,2,3,4), + 'move(1, 1) does nothing'); +} + +// ................................ Act .................................. + move(0, 1, 2); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(2,0,1,3,4), + 'move(0, 1, 2) moves 2 items'); +} + +// ................................ Act .................................. + move(0, 1, 4); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(4,2,0,1,3), + 'move(0, 1, 4) moves 4 items'); +} + +// ................................ Act .................................. + move(1, 0, 4); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(2,0,1,3,4), + 'move(1, 0, 4) moves back 4 items'); +} + +// ................................ Act .................................. + move(0, 1, 5); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(2,0,1,3,4), + 'move(0, 1, 5): moving more than total items does nothing'); +} + +// ................................ Act .................................. + move(1, 2, 4); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(2,0,1,3,4), + 'move(1, 2, 4): moving up items beyond last item does nothing'); +} + +// ................................ Act .................................. + move(2, 1, 8); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(2,1,3,4,0), + 'move(2, 1, 8): moving back items from beyond last item will move just the existing ones'); +} + +// ................................ Act .................................. + remove(1,1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(2,3,4,0), + 'remove(1,1): works correctly'); +} + +// ................................ Act .................................. + remove(0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(3,4,0), + 'remove(0): works correctly'); +} + +// ................................ Act .................................. + move(2, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(0,3,4), + 'move(2, 0): works correctly'); +} + +// ................................ Act .................................. + remove(2); + move(0,1,2); + insert(0, 2); + move(2, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed(), + current(3,2,0), + 'multiple operations: works correctly - with the original item with style set to red still there'); +} + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + function findRed2() { + return " at: " + + $(".wrap").find("span[style]").view().getIndex() + "/" + + + $(".wrap2").find("li[style]").view().getIndex() + "/" + + + $(".wrap3").find("li[style]").view().getIndex(); + } + + model.items = [0,1,2,3,4]; + + var cnt = 5; + + $.templates({ + tags: { + tag: function() {return this.tagCtx.render();} + }, + markup: + '
                  Start ' + + '{^{for items}}' + + '{^{if true}}' + + '{^{if true}}' + + '{^{if false}}{{else}}' + + '{^{tag}}' + + '{^{:#getIndex()}} {{:}}|' + + '{{/tag}}' + + '{{/if}}' + + '{{/if}}' + + '{{/if}}' + + '{{/for}}' + + 'End
                  ' + + + '
                  Start ' + + '{^{for items}}' + + '{^{if true}}' + + '{^{if true}}' + + '{^{if false}}{{else}}' + + '{^{tag}}' + + ' {{:}}|' + + '{{/tag}}' + + '{{/if}}' + + '{{/if}}' + + '{{/if}}' + + '{{/for}}' + + 'End
                  ' + + + 'Start
                    ' + + '{^{for items}}' + + '{^{if true}}' + + '{^{if true}}' + + '{^{if false}}{{else}}' + + '{^{tag}}' + + '
                  • {^{:#getIndex()}} |
                  • ' + + '{{/tag}}' + + '{{/if}}' + + '{{/if}}' + + '{{/if}}' + + '{{/for}}' + + '
                  End' + + + '
                    ' + + '
                  • Start
                  • ' + + '{^{for items}}' + + '{^{if true}}' + + '{^{if true}}' + + '{^{if false}}{{else}}' + + '{^{tag}}' + + '
                  • ' + + '{{/tag}}' + + '{{/if}}' + + '{{/if}}' + + '{{/if}}' + + '{{/for}}' + + '
                  • End
                  • ' + + '
                  ' + } + ).link("#result", model); + + $(".wrap").find("span:first").css("color", "red"); + $(".wrap2").find("li:first").css("color", "red"); + $(".wrap3").find("li:nth-of-type(2)").css("color", "red"); + +// ................................ Act .................................. + move(0, 1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(1,0,2,3,4), + 'Complex template: moved one item from 0 to 1'); +} + +// ................................ Act .................................. + move(0, 1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(0,1,2,3,4), + 'Complex template: moved one item from 0 to 1 again (actually swaps back to orginal positions'); +} + +// ................................ Act .................................. + move(1, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(1,0,2,3,4), + 'Complex template: moved one item back from 1 to 0'); +} + +// ................................ Act .................................. + move(1, 0); // Return to original position + move(1, 0, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(0,1,2,3,4), + 'Complex template: move(1, 0, 0) does nothing'); +} + +// ................................ Act .................................. + move(1, 1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(0,1,2,3,4), + 'Complex template: move(1, 1) does nothing'); +} + +// ................................ Act .................................. + move(0, 1, 2); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(2,0,1,3,4), + 'Complex template: move(0, 1, 2) moves 2 items'); +} + +// ................................ Act .................................. + move(0, 1, 4); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(4,2,0,1,3), + 'Complex template: move(0, 1, 4) moves 4 items'); +} + +// ................................ Act .................................. + move(1, 0, 4); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(2,0,1,3,4), + 'Complex template: move(1, 0, 4) moves back 4 items'); +} + +// ................................ Act .................................. + move(0, 1, 5); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(2,0,1,3,4), + 'Complex template: move(0, 1, 5): moving more than total items does nothing'); +} + +// ................................ Act .................................. + move(1, 2, 4); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(2,0,1,3,4), + 'Complex template: move(1, 2, 4): moving up items beyond last item does nothing'); +} + +// ................................ Act .................................. + move(2, 1, 8); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(2,1,3,4,0), + 'Complex template: move(2, 1, 8): moving back items from beyond last item will move just the existing ones'); +} + +// ................................ Act .................................. + remove(1,1); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(2,3,4,0), + 'Complex template: remove(1,1): works correctly'); +} + +// ................................ Act .................................. + remove(0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(3,4,0), + 'Complex template: remove(0): works correctly'); +} + +// ................................ Act .................................. + move(2, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(0,3,4), + 'Complex template: move(2, 0): works correctly'); +} + +// ................................ Act .................................. + remove(2); + move(0,1,2); + insert(0, 2); + move(2, 0); + + // ............................... Assert ................................. + +if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. + assert.equal($("#result").text() + findRed2(), + current(3,2,0), + 'Complex template: multiple operations: works correctly - with the original item with style set to red still there'); +} + + // ................................ Reset ................................ + $("#result").empty(); + +}); + +QUnit.test("JsViews ArrayChange: refresh()", function(assert) { + // =============================== Arrange =============================== + $.views.tags({ + liTag: function() { + return "
                • Tag
                • "; + } + }); + + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates('
                    {^{liTag/}}{^{for things}}
                  • {{:thing}}
                  • {^{liTag/}}{{/for}}
                  • |after
                  ') + .link("#result", model); // -> TagOrigTagFirstTagMiddleTagLastTag|after + + // ................................ Act .................................. + $.observable(model.things).refresh([{thing: "A"}, {thing: "B"}, {thing: "C"}]); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagATagBTagCTag|after", + 'Within element only content, refresh() maintains correctly prevNode, nextNode, element order and binding on views and tags'); + + // ................................ Reset ................................ + $("#result").empty(); + + // =============================== Arrange =============================== + $.views.tags({ + spanTag: function() { + return "Tag"; + } + }); + + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates('
                  {^{spanTag/}}{^{for things}}{{:thing}}{^{spanTag/}}{{/for}}|after
                  ') + .link("#result", model); + + // ................................ Act .................................. + $.observable(model.things).refresh([{thing: "A"}, {thing: "B"}, {thing: "C"}]); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TagATagBTagCTag|after", + 'Within regular content, refresh() finds correctly the previous view, prevNode, nextNode, etc and establishes correct element/textNode order and binding'); + + // ................................ Reset ................................ + $("#result").empty(); + model.things = []; // reset Prop +}); + +QUnit.test("JsViews jsv-domchange", function(assert) { + + // =============================== Arrange =============================== + res = ""; + + function domchangeHandler(ev, tagCtx, linkCtx, eventArgs) { + res += ev.type + " " + ev.target.tagName + " " + tagCtx.params.args[0] + " " + (linkCtx.tag === tagCtx.tag) + " " + eventArgs.change + " | " ; + } + + $.views.tags({ + spanTag: function() { + return "Tag"; + } + }); + + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates('
                  {^{spanTag/}}{^{for things}}{{:thing}}{^{spanTag/}}{{/for}}|after
                  ') + .link("#result", model); + + $("#result div").on("jsv-domchange", domchangeHandler); + + // ................................ Act .................................. + $.observable(model.things).insert({thing: "New"}); + $.observable(model.things).move(2, 0, 2); + $.observable(model.things).remove(1, 2); + $.observable(model.things).refresh([{thing: "A"}, {thing: "B"}, {thing: "C"}]); + + // ............................... Assert ................................. + assert.equal(res, + "jsv-domchange DIV things true insert | " + + "jsv-domchange DIV things true move | " + + "jsv-domchange DIV things true remove | " + + "jsv-domchange DIV things true insert | " + + "jsv-domchange DIV things true remove | " + + "jsv-domchange DIV things true refresh | ", + 'Correct behavior of $(...).on("jsv-domchange", domchangeHandler)'); + + // ................................ Reset ................................ + $("#result").empty(); + reset(); + + // =============================== Arrange =============================== + model.things = [{thing: "Orig"}, {thing: "First"}, {thing: "Middle"}, {thing: "Last"}]; // reset Prop + + $.templates( + '
                  ' + + '{^{spanTag/}}{^{for things}}{{:thing}}{^{spanTag/}}{{/for}}|after' + + '
                  ') + .link("#result", model, { + domchange: function(param1, param2, ev, domchangeEventArgs, tagCtx, linkCtx, observableEventArgs) { + res += "Params: " + param1 + ", " + param2 + " | "; + domchangeHandler(ev, tagCtx, linkCtx, observableEventArgs); + } + }); + + // ................................ Act .................................. + $.observable(model.things).insert({thing: "New"}); + $.observable(model.things).move(2, 0, 2); + $.observable(model.things).remove(1, 2); + $.observable(model.things).refresh([{thing: "A"}, {thing: "B"}, {thing: "C"}]); + + assert.equal(res, + "Params: 333, 444 | jsv-domchange DIV things true insert | " + + "Params: 333, 444 | jsv-domchange DIV things true move | " + + "Params: 333, 444 | jsv-domchange DIV things true remove | " + + "Params: 333, 444 | jsv-domchange DIV things true insert | " + + "Params: 333, 444 | jsv-domchange DIV things true remove | " + + "Params: 333, 444 | jsv-domchange DIV things true refresh | ", + 'Correct behavior of data-link=\'{on "jsv-domchange" ~domchange param1 param2}\''); + + // ................................ Reset ................................ + model.things = []; // reset Prop + $("#result").empty(); + reset(); +}); + +QUnit.module("API - $.observe() (jsv)"); + +QUnit.test("observe/unobserve alternative signatures", function(assert) { + + $.views.settings.advanced({_jsv: true}); + + // =============================== Arrange =============================== + + var person = {last: " L"}; + function onch(ev, eventArgs) { + } + + // ................................ Act .................................. + $.observe(person, "last", onch); + $.templates("{^{:last}}").link("#result", person); + $.unobserve(person, "last", onch); + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, _jsv.bindings, $._data(person).events]), "[{},{},null]", + "observe/unobserve API calls combined with template binding: all bindings removed when content removed from DOM and unobserve called"); + + // ................................ Reset ................................ + reset(); + + // =============================== Arrange =============================== + function onch2(ev, eventArgs) {} + person = {first: "F", last: " L"}; + + // ................................ Act .................................. + $.observe(person, "last", onch); + $.observe(person, "last", onch2); + $.templates("{^{:last}} }} {^{:first + last}}").link("#result", person); + $.observe(person, "first", onch); + $.observe(person, "first", onch2); + $.unobserve(person, "last", onch); + $.unobserve(person, "last", onch2); + $("#result").empty(); + $.unobserve(person, "first", onch); + $.unobserve(person, "first", onch2); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, _jsv.bindings, $._data(person).events]), "[{},{},null]", + "Observe API calls combined with template binding (version 2): all bindings removed when content removed from DOM and unobserve called"); + + // ................................ Reset ................................ + reset(); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("Array", function(assert) { + + $.views.settings.advanced({_jsv: true}); // For using _jsv + + // =============================== Arrange =============================== + var people = [1, 2]; + function onch() {} + function onch2() {} + + // ................................ Act .................................. + $.observe(people, "length", onch); + $.observe(people, "length", onch2); + $.observe(people, "length2", onch); + $.templates("{^{for people}}{{/for}} {^{:people}}").link("#result", {people: people}); + $.observe(people, "length2", onch2); + $.unobserve(people, "length2", onch); + $.unobserve(people, "length2", onch2); + $("#result").empty(); + $.unobserve(people, "length", onch); + $.unobserve(people, "length", onch2); + + // ............................... Assert ................................. + assert.equal(JSON.stringify([_jsv.cbBindings, _jsv.bindings, $._data(people).events]), "[{},{},null]", + "observe/unobserve array - API calls in different orders: all bindings removed when content removed from DOM and unobserve called"); + + $.views.settings.advanced({_jsv: false}); +}); + +QUnit.test("MVVM", function(assert) { +$.views.settings.trigger(false); + + reset(); + // =============================== Arrange =============================== + function Person(name, address, phones) { + this._name = name; + this._address = address; + this._phones = phones; + } + + var personProto = { + name: function() { + return this._name; + }, + address: function() { + return this._address; + }, + phones: function() { + return this._phones; + } + }; + + personProto.name.set = function(val) { + this._name = val; + }; + + personProto.address.set = function(val) { + this._address = val; + }; + + personProto.phones.set = function(val) { + this._phones = val; + }; + + Person.prototype = personProto; + + function Address(street) { + this._street = street; + } + + var addressProto = { + street: function() { + return this._street; + } + }; + + addressProto.street.set = function(val) { + this._street = val; + }; + + Address.prototype = addressProto; + + function Phone(phone) { + this._number = phone.number; + } + + var phoneProto = { + number: function() { + return this._number; + } + }; + + phoneProto.number.set = function(val) { + this._number = val; + }; + + Phone.prototype = phoneProto; + + var person = new Person("pete", new Address("1st Ave"), []), + message = '', + ret = '', + input, + getResult = function(sep) { ret += (sep || "|") + input.val() + "/" + $("#result").text(); }; + + // ................................ Act .................................. + $.templates('{^{:address()^street()}}').link("#result", person); + + input = $("#result input"); + getResult(); + $("#result input").val("InputStreet").change(); + getResult("--"); + $.observable(person.address()).setProperty("street", "oldAddressChgStreet"); + getResult("--"); + $.observable(person).setProperty("address", new Address("newAddressStreet")); + getResult("--"); + $.observable(person.address()).setProperty("street", "newAddressChgStreet"); + getResult("--"); + + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(ret, "|1st Ave/1st Ave--InputStreet/InputStreet--oldAddressChgStreet/oldAddressChgStreet--newAddressStreet/newAddressStreet--newAddressChgStreet/newAddressChgStreet", + "Paths with computed/getters: address()^street() - Swapping object higher in path then updating leaf getter, works correctly"); + + // =============================== Arrange =============================== + + person = new Person("pete", new Address("1st Ave"), []); + + // ................................ Act .................................. + ret = ""; + $.templates('{^{:address()^street()}}').link("#result", person); + + input = $("#result input"); + getResult(); + input.val("InputStreet").change(); + getResult("--"); + $.observable(person.address()).setProperty("street", "oldAddressChgStreet"); + getResult("--"); + $.observable(person).setProperty("address", new Address("newAddressStreet")); + getResult("--"); + $.observable(person.address()).setProperty("street", "newAddressChgStreet"); + getResult("--"); + + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(ret, "|1st Ave/1st Ave--InputStreet/InputStreet--oldAddressChgStreet/oldAddressChgStreet--newAddressStreet/newAddressStreet--newAddressChgStreet/newAddressChgStreet", + "Paths with computed/getters: address().street() - Paths with computed/getter followed by '.' still update preceding getter" + + "- same as if there was a '^' separator"); + // =============================== Arrange =============================== + + person = new Person("pete", new Address("1st Ave"), [new Phone({number: "phone1"}), new Phone({number: "phone2"})]); + + // ................................ Act .................................. + ret = ""; + $.templates('{^{:address()^street()}}').link("#result", person); + + var observeAllHandler = function(ev, eventArgs) { + message += JSON.stringify(eventArgs) + "\n"; + }; + + var eventsCountBefore = $._data(person).events.propertyChange.length + + " " + $._data(person.address()).events.propertyChange.length + "|"; + + $.observable(person).observeAll(observeAllHandler); + + var eventsCountAfterObserveAll = $._data(person).events.propertyChange.length + + " " + $._data(person.address()).events.propertyChange.length + "|"; + + input = $("#result input"); + input.val("InputStreet").change(); + $.observable(person.address()).setProperty("street", "oldAddressChgStreet"); + $.observable(person).setProperty("address", new Address("newAddressStreet")); + $.observable(person.address()).setProperty("street", "newAddressChgStreet"); + + var eventsCountAfterChanges = $._data(person).events.propertyChange.length + + " " + $._data(person.address()).events.propertyChange.length + "|"; + + // ............................... Assert ................................. + assert.equal(message, '{\"change\":\"set\",\"path\":\"street\",\"value\":\"InputStreet\",\"oldValue\":\"1st Ave\"}\n\ +{\"change\":\"set\",\"path\":\"street\",\"value\":\"oldAddressChgStreet\",\"oldValue\":\"InputStreet\"}\n\ +{\"change\":\"set\",\"path\":\"address\",\"value\":{\"_street\":\"newAddressStreet\"},\"oldValue\":{\"_street\":\"oldAddressChgStreet\"}}\n\ +{\"change\":\"set\",\"path\":\"street\",\"value\":\"newAddressChgStreet\",\"oldValue\":\"newAddressStreet\"}\n', + "Paths with computed/getters: address().street() - observeAll correctly tracks all changes on all objects, even as object graph changes"); + + // ................................ Act .................................. + ret = ""; + message = ""; + + $.observable(person).unobserveAll(observeAllHandler); + + var eventsCountAfterUnobserveAll = $._data(person).events.propertyChange.length + + " " + $._data(person.address()).events.propertyChange.length + "|"; + + $.unobserve(person.address()); + + var eventsAfterUnobserveAddress = $._data(person).events.propertyChange.length + " " + !$._data(person.address()).events; + + input.val("InputStreetAfterUnobserve").change(); + $.observable(person.address()).setProperty("street", "oldAddressChgStreetAfterUnobserve"); + $.observable(person).setProperty("address", new Address("newAddressStreetAfterUnobserve")); + $.observable(person.address()).setProperty("street", "newAddressChgStreetAfterUnobserve"); + + getResult("--"); + + $("#result").empty(); + + var eventsAfterEmptyTemplateContainer = !$._data(person).events + + " " + !$._data(person.address()).events + "|"; + + // ............................... Assert ................................. + assert.equal(message + ret + + eventsCountBefore + + eventsCountAfterObserveAll + + eventsCountAfterChanges + + eventsCountAfterUnobserveAll + + eventsAfterUnobserveAddress + + eventsAfterEmptyTemplateContainer, + "--newAddressChgStreetAfterUnobserve/newAddressChgStreetAfterUnobserve2 2|3 3|3 3|2 2|2 truetrue true|", + "Paths with computed/getters: address().street() - unobserveAll is successful"); + + // =============================== Arrange =============================== + + getResult = function(sep) { ret += (sep || "|") + $("#result").text(); }; + + person = new Person("pete", new Address("1st Ave"), [new Phone({number: "phone1"}), new Phone({number: "phone2"})]); + + // ................................ Act .................................. + ret = ""; + $.templates('{^{for phones()}}{^{:number()}},{{/for}}').link("#result", person); + + getResult("\nInit>>"); + $.observable(person.phones()).insert(new Phone({number: "insertedPhone"})); + getResult("insert:"); + $.observable(person.phones()).remove(0); + getResult("remove:"); + $.observable(person.phones()).refresh([new Phone({number: "replacedPhone1"}), new Phone({number: "replacedPhone2"})]); + getResult("refresh:"); + $.observable(person.phones()).insert(1, [new Phone({number: "insertedPhone3a"}), new Phone({number: "insertedPhone3b"})]); + getResult("insert:"); + $.observable(person.phones()).move(1, 3, 2); + getResult(" move:"); + $.observable(person).setProperty("phones", [new Phone({number: "replacedPhone1"})]); + getResult("\nSet>>"); + $.observable(person.phones()).insert(new Phone({number: "insertedPhoneX"})); + getResult("insert:"); + $.observable(person.phones()).remove(0); + getResult("remove:"); + $.observable(person.phones()).refresh([new Phone({number: "replacedPhoneX1"}), new Phone({number: "replacedPhoneX2"})]); + getResult("refresh:"); + $.observable(person.phones()).insert(1, [new Phone({number: "insertedPhoneX3a"}), new Phone({number: "insertedPhoneX3b"})]); + getResult("insert:"); + $.observable(person.phones()).move(1, 3, 2); + getResult("move:"); + $.observable(person).setProperty("phones", []); + getResult("\nsetEmpty>>"); + $.observable(person.phones()).insert(new Phone({number: "insertedPhoneY"})); + getResult("insert:"); + + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(ret, "\nInit>>phone1,phone2,insert:phone1,phone2,insertedPhone,remove:phone2,insertedPhone,refresh:replacedPhone1,replacedPhone2,insert:replacedPhone1,insertedPhone3a,insertedPhone3b,replacedPhone2, move:replacedPhone1,replacedPhone2,insertedPhone3a,insertedPhone3b,\ +\nSet>>replacedPhone1,insert:replacedPhone1,insertedPhoneX,remove:insertedPhoneX,refresh:replacedPhoneX1,replacedPhoneX2,insert:replacedPhoneX1,insertedPhoneX3a,insertedPhoneX3b,replacedPhoneX2,move:replacedPhoneX1,replacedPhoneX2,insertedPhoneX3a,insertedPhoneX3b,\ +\nsetEmpty>>insert:insertedPhoneY,", + "Array operations with getters allow complete functionality, and track the modified tree at all times"); + // =============================== Arrange =============================== + + person = new Person("pete", new Address("1st Ave"), [new Phone({number: "phone1"}), new Phone({number: "phone2"})]); + + // ................................ Act .................................. + ret = ""; + $.templates('{^{for phones()}}{^{:number()}},{{/for}}').link("#result", person); + + eventsCountBefore = $._data(person).events.propertyChange.length + + " " + $._data(person.phones()).events.arrayChange.length + + " " + $._data(person.phones()[0]).events.propertyChange.length + "|"; + + $.observable(person).observeAll(observeAllHandler); + + eventsCountAfterObserveAll = $._data(person).events.propertyChange.length + + " " + $._data(person.phones()).events.arrayChange.length + + " " + $._data(person.phones()[0]).events.propertyChange.length + "|"; + + $.observable(person.phones()).insert(new Phone({number: "insertedPhone"})); + $.observable(person.phones()).remove(0); + $.observable(person.phones()).refresh([new Phone({number: "replacedPhone1"}), new Phone({number: "replacedPhone2"})]); + $.observable(person.phones()).insert(1, [new Phone({number: "insertedPhone3a"}), new Phone({number: "insertedPhone3b"})]); + + $.observable(person.phones()).move(1, 3, 2); + $.observable(person).setProperty("phones", [new Phone({number: "replacedPhone1"})]); + + $.observable(person.phones()).insert(new Phone({number: "insertedPhoneX"})); + + $.observable(person.phones()).remove(0); + + $.observable(person.phones()).refresh([new Phone({number: "replacedPhoneX1"}), new Phone({number: "replacedPhoneX2"})]); + $.observable(person.phones()).insert(1, [new Phone({number: "insertedPhoneX3a"}), new Phone({number: "insertedPhoneX3b"})]); + + $.observable(person.phones()).move(1, 3, 2); + $.observable(person).setProperty("phones", []); + $.observable(person.phones()).insert(new Phone({number: "insertedPhoneY"})); + $.observable(person.phones()[0]).setProperty("number", "newNumber"); + + eventsCountAfterChanges = $._data(person).events.propertyChange.length + + " " + $._data(person.phones()).events.arrayChange.length + + " " + $._data(person.phones()[0]).events.propertyChange.length + "|"; + + // ............................... Assert ................................. + assert.equal(message, '{\"change\":\"insert\",\"index\":2,\"items\":[{\"_number\":\"insertedPhone\"}]}\n\ +{\"change\":\"remove\",\"index\":0,\"items\":[{\"_number\":\"phone1\"}]}\n\ +{\"change\":\"insert\",\"index\":0,\"items\":[{\"_number\":\"replacedPhone1\"},{\"_number\":\"replacedPhone2\"}],\"refresh\":true}\n\ +{\"change\":\"remove\",\"index\":2,\"items\":[{\"_number\":\"phone2\"},{\"_number\":\"insertedPhone\"}],\"refresh\":true}\n\ +{\"change\":\"refresh\",\"oldItems\":[{\"_number\":\"phone2\"},{\"_number\":\"insertedPhone\"}]}\n\ +{\"change\":\"insert\",\"index\":1,\"items\":[{\"_number\":\"insertedPhone3a\"},{\"_number\":\"insertedPhone3b\"}]}\n\ +{\"change\":\"move\",\"oldIndex\":1,\"index\":2,\"items\":[{\"_number\":\"insertedPhone3a\"},{\"_number\":\"insertedPhone3b\"}]}\n\ +{\"change\":\"set\",\"path\":\"phones\",\"value\":[{\"_number\":\"replacedPhone1\"}],\"oldValue\":[{\"_number\":\"replacedPhone1\"},{\"_number\":\"replacedPhone2\"},{\"_number\":\"insertedPhone3a\"},{\"_number\":\"insertedPhone3b\"}]}\n\ +\ +{\"change\":\"insert\",\"index\":1,\"items\":[{\"_number\":\"insertedPhoneX\"}]}\n\ +{\"change\":\"remove\",\"index\":0,\"items\":[{\"_number\":\"replacedPhone1\"}]}\n\ +{\"change\":\"insert\",\"index\":0,\"items\":[{\"_number\":\"replacedPhoneX1\"},{\"_number\":\"replacedPhoneX2\"}],\"refresh\":true}\n\ +{\"change\":\"remove\",\"index\":2,\"items\":[{\"_number\":\"insertedPhoneX\"}],\"refresh\":true}\n\ +{\"change\":\"refresh\",\"oldItems\":[{\"_number\":\"insertedPhoneX\"}]}\n\ +{\"change\":\"insert\",\"index\":1,\"items\":[{\"_number\":\"insertedPhoneX3a\"},{\"_number\":\"insertedPhoneX3b\"}]}\n\ +{\"change\":\"move\",\"oldIndex\":1,\"index\":2,\"items\":[{\"_number\":\"insertedPhoneX3a\"},{\"_number\":\"insertedPhoneX3b\"}]}\n\ +\ +{\"change\":\"set\",\"path\":\"phones\",\"value\":[],\"oldValue\":[{\"_number\":\"replacedPhoneX1\"},{\"_number\":\"replacedPhoneX2\"},{\"_number\":\"insertedPhoneX3a\"},{\"_number\":\"insertedPhoneX3b\"}]}\n\ +\ +{\"change\":\"insert\",\"index\":0,\"items\":[{\"_number\":\"insertedPhoneY\"}]}\n\ +{\"change\":\"set\",\"path\":\"number\",\"value\":\"newNumber\",\"oldValue\":\"insertedPhoneY\"}\n', + "Paths with computed/getters: address().street() - observeAll correctly tracks all changes on all objects, even as object graph changes"); + + // ................................ Act .................................. + ret = ""; + message = ""; + + $.observable(person).unobserveAll(observeAllHandler); + + eventsCountAfterUnobserveAll = $._data(person).events.propertyChange.length + + " " + $._data(person.phones()).events.arrayChange.length + + " " + $._data(person.phones()[0]).events.propertyChange.length + "|"; + + $.unobserve(person.phones()); + + var eventsAfterUnobservePhones = $._data(person).events.propertyChange.length + + " " + !$._data(person.phones()).events + + " " + $._data(person.phones()[0]).events.propertyChange.length + "|"; + + $.observable(person.phones()).insert(new Phone({number: "insertedPhoneZ"})); + $.observable(person.phones()[0]).setProperty("number", "newNumberZ"); + + $("#result").empty(); + + eventsAfterEmptyTemplateContainer = !$._data(person).events + + " " + !$._data(person.phones()).events + + " " + !$._data(person.phones()[0]).events + "|"; + + // ............................... Assert ................................. + assert.equal(message + ret + + eventsCountBefore + + eventsCountAfterObserveAll + + eventsCountAfterChanges + + eventsCountAfterUnobserveAll + + eventsAfterUnobservePhones + + eventsAfterEmptyTemplateContainer, + "1 1 1|2 2 2|2 2 2|1 1 1|1 true 1|true true true|", + "Paths with computed/getters: address().street() - unobserveAll is successful"); + +$.views.settings.trigger(true); +}); + +QUnit.test("$.views.viewModels", function(assert) { + // =============================== Arrange =============================== + var Constr = $.views.viewModels({getters: ["a", "b"]}); + // ................................ Act .................................. + var vm = Constr("a1 ", "b1 "); + var res = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + res += vm.a() + vm.b(); + // ............................... Assert ................................. + assert.equal(res, "a1 b1 a2 b2 ", "viewModels, two getters, no methods"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: ["a", "b", "c"], extend: {add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + }}}); + // ................................ Act .................................. + vm = Constr("a1 ", "b1 ", "c1 "); + vm.add("before "); + res = vm.c(); + // ............................... Assert ................................. + assert.equal(res, "before a1 b1 c1 ", "viewModels, two getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({extend: {add: function(val) { + this.foo = val; + }}}); + // ................................ Act .................................. + vm = Constr(); + vm.add("before"); + res = vm.foo; + // ............................... Assert ................................. + assert.equal(res, "before", "viewModels, no getters, one method"); + + // =============================== Arrange =============================== + Constr = $.views.viewModels({getters: []}); + // ................................ Act .................................. + vm = Constr(); + res = JSON.stringify(vm); + // ............................... Assert ................................. + assert.equal(res, "{}", "viewModels, no getters, no methods"); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + } + }); + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 "}); + var changes = ""; + function observeAllHandler(ev, evArgs) { + changes += evArgs.value; + } + $.observable(vm).observeAll(observeAllHandler); + + res = vm.a() + vm.b(); + vm.a("a2 "); + vm.b("b2 "); + res += vm.a() + vm.b(); + + // ............................... Assert ................................. + assert.equal(res + "|" + changes, "a1 b1 a2 b2 |a2 b2 ", "viewModels, two getters, no methods"); + changes = ""; + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 "}); + + res = vm.a() + vm.b(); + + // ............................... Assert ................................. + assert.equal(res + "|" + changes, "a3 b3 |a3 b3 ", "viewModels merge, two getters, no methods"); + changes = ""; + + // ................................ Act .................................. + res = vm.unmap(); + res = JSON.stringify(res); + + // ............................... Assert ................................. + assert.equal(res, '{"a":"a3 ","b":"b3 "}', "viewModels unmap, two getters, no methods"); + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // =============================== Arrange =============================== + var viewModels = $.views.viewModels({ + T1: { + getters: ["a", {getter: "b"}, "c", "d", {getter: "e", type: undefined}, {getter: "f", type: null}, {getter: "g", type: "foo"}, {getter: "h", type: ""}] + } + }, {}); + // ................................ Act .................................. + vm = viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 ", d: "d1 ", e: "e1 ", f: "f1 ", g: "g1 ", h: "h1 "}); + $.observable(vm).observeAll(observeAllHandler); + + res = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + vm.a("a2 "); + vm.b("b2 "); + res += vm.a() + vm.b(); + // ............................... Assert ................................. + assert.equal(res + "|" + changes, "a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 |a2 b2 ", + "viewModels, multiple unmapped getters, no methods"); + changes = ""; + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 ", d: "d3 ", e: "e3 ", f: "f3 ", g: "g3 ", h: "h3 "}); + + res = vm.a() + vm.b() + vm.c() + vm.d() + vm.e() + vm.f() + vm.g() + vm.h(); + + // ............................... Assert ................................. + assert.equal(res + "|" + changes, "a3 b3 c3 d3 e3 f3 g3 h3 |a3 b3 c3 d3 e3 f3 g3 h3 ", + "viewModels merge, multiple unmapped getters, no methods"); + changes = ""; + + // ................................ Act .................................. + res = vm.unmap(); + res = JSON.stringify(res); + + // ............................... Assert ................................. + assert.equal(res, '{"a":"a3 ","b":"b3 ","c":"c3 ","d":"d3 ","e":"e3 ","f":"f3 ","g":"g3 ","h":"h3 "}', + "viewModels unmap, multiple unmapped getters, no methods"); + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b", "c"], + extend : { + add: function(val) { + this.c(val + this.a() + this.b() + this.c()); + } + } + } + }); + + // ................................ Act .................................. + vm = $.views.viewModels.T1.map({a: "a1 ", b: "b1 ", c: "c1 "}); + $.observable(vm).observeAll(observeAllHandler); + + vm.add("before "); + res = vm.c(); + + // ............................... Assert ................................. + assert.equal(res + "|" + changes, "before a1 b1 c1 |before a1 b1 c1 ", "viewModels, getters and one method"); + changes = ""; + + // ................................ Act .................................. + vm.merge({a: "a3 ", b: "b3 ", c: "c3 "}); + vm.add("updated "); + res = vm.c(); + + // ............................... Assert ................................. + assert.equal(res + "|" + changes, "updated a3 b3 c3 |a3 b3 c3 updated a3 b3 c3 ", "viewModels merge, getters and one method"); + changes = ""; + + // ................................ Act .................................. + res = vm.unmap(); + res = JSON.stringify(res); + + // ............................... Assert ................................. + assert.equal(res, '{"a":"a3 ","b":"b3 ","c":"updated a3 b3 c3 "}', "viewModels unmap, getters and one method"); + changes = ""; + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // =============================== Arrange =============================== + $.views.viewModels({ + T1: { + getters: ["a", "b"] + }, + T2: { + getters: [{getter: "t1", type: "T1"}, {getter: "t1Arr", type: "T1"}, {getter: "t1OrNull", type: "T1", defaultVal: null}] + } + }); + viewModels = $.views.viewModels; + // ................................ Act .................................. + var t1 = viewModels.T1.map({a: "a1 ", b: "b1 "}); // Create a T1 + var t2 = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: [t1.unmap(), {a: "a2 ", b: "b2 "}]}); // Create a T2 (using unmap to scrape values the T1: vm) + + $.observable(t1).observeAll(observeAllHandler); + $.observable(t2).observeAll(observeAllHandler); + + res = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + assert.equal(res, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t2.t1Arr()[0].merge({a: "a1x ", b: "b1x "}); // merge not the root, but a VM instance within hierarchy: vm2.t1Arr()[0] - leaving rest unchanged + res = JSON.stringify(t2.unmap()); + + // ............................... Assert ................................. + assert.equal(res + "|" + changes, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1x ","b":"b1x "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}|a1x b1x ', + "viewModels, merge deep node"); + changes = ""; + + // ............................... Reset ................................. + $.unobserve(observeAllHandler); + + // ................................ Act .................................. + var t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + var t2FromArr = viewModels.T2.map({t1: {a: "a3 ", b: "b3 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + res = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + assert.equal(res, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + t1Arr = viewModels.T1.map([{a: "a1 ", b: "b1 "}, {a: "a2 ", b: "b2 "}]); // Create a T1 array + t1Arr.push(viewModels.T1("a3 ", "b3 ")); + t2FromArr = viewModels.T2.map({t1: {a: "a4 ", b: "b4 "}, t1Arr: t1Arr.unmap()}); // Create a T2 (using unmap to scrape values the T1: vm) + res = JSON.stringify(t2FromArr.unmap()); + + // ............................... Assert ................................. + assert.equal(res, '{"t1":{"a":"a4 ","b":"b4 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "},{"a":"a3 ","b":"b3 "}],"t1OrNull":null}', + "viewModels, hierarchy"); + + // ................................ Act .................................. + var t2new = viewModels.T2(viewModels.T1("a3 ", "b3 "), [viewModels.T1("a1 ", "b1 "), viewModels.T1("a2 ", "b2 ")], viewModels.T1("a4 ", "b4 ") ); + res = JSON.stringify(t2new.unmap()); + + // ............................... Assert ................................. + assert.equal(res, '{"t1":{"a":"a3 ","b":"b3 "},"t1Arr":[{"a":"a1 ","b":"b1 "},{"a":"a2 ","b":"b2 "}],"t1OrNull":{"a":"a4 ","b":"b4 "}}', + "viewModels, hierarchy"); +}); + +QUnit.module("API - depends"); + +QUnit.test("Computed observables, converters and tags with depends", function(assert) { + // =============================== Arrange =============================== + +function testDepends(template) { + // =============================== Arrange =============================== + var ret = "", + items = ["first"], + items2 = ["new0", "new1"], + app = { + show: true, + name: "Jo", + itemsProp: items, + summary: summary + }; + + $.templates(template).link("#result", app, {summary: summary}); + + ret += "|1:" + $("#result").text(); + + // ................................ Act .................................. + $.observable(app).setProperty("name", "Bob"); + ret += "|2:" + $("#result").text(); + + $.observable(app.itemsProp).insert(0, "previous"); + ret += "|3:" + $("#result").text(); + + $.observable(app).setProperty("name", "Jim"); + ret += "|4:" + $("#result").text(); + + $.observable(app).setProperty("itemsProp", items2); + ret += "|5:" + $("#result").text(); + + $.observable(app.itemsProp).move(0, 1); + ret += "|6:" + $("#result").text(); + + $.observable(app.itemsProp).insert(0, "newPrev"); + ret += "|7:" + $("#result").text(); + + $.observable(app).setProperty("name", "Jeff"); + ret += "|8:" + $("#result").text() + "/" + !$._data(items).events + "/" + $._data(items2).events.arrayChange.length; + + $.observable(app).setProperty("show", false); + ret += "|9:" + $("#result").text() + "/" + !$._data(items).events + "/" + !$._data(items2).events; + + $.observable(app).setProperty("show", true); + ret += "|10:" + $("#result").text() + "/" + !$._data(items).events + "/" + $._data(items2).events.arrayChange.length; + + $.observable(app.itemsProp).insert(0, "extraPrev"); + ret += "|11:" + $("#result").text() + "/" + !$._data(items).events + "/" + $._data(items2).events.arrayChange.length; + + // ................................ Reset ................................ + $("#result").empty(); + $.unobserve(app); + + return ret === + "|1:first-1-Jo" + + "|2:first-1-Bob" + + "|3:previous-2-Bob" + + "|4:previous-2-Jim" + + "|5:new0-2-Jim" + + "|6:new1-2-Jim" + + "|7:newPrev-3-Jim" + + "|8:newPrev-3-Jeff" + "/true/1" + + "|9:/true/true" + + "|10:newPrev-3-Jeff" + "/true/1" + + "|11:extraPrev-4-Jeff" + "/true/1"; +} + + // =============================== Arrange =============================== + var summary = function() { + return this.itemsProp[0] + "-" + this.itemsProp.length + "-" + this.name; + }; + + summary.depends = ["itemsProp", "name"]; + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:summary()}}{{/if}}"), + 'Computed observable with depends = ["itemsProp", ...] updates for both array change and property change'); + + // =============================== Arrange =============================== + + summary.depends = function(object, callback) { + $.observe(object, "itemsProp", callback); + return "name"; + }; + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:summary()}}{{/if}}"), + 'Computed observable with depends function programmatically observing array, with the callback provided as parameter. Works equivalently to the declarative depends for an array'); + + // =============================== Arrange =============================== + var test; + summary.depends = function(data1) { + var this1 = this; + return function (data2) { + var this2 = this; + return [function (data3) { + var this3 = this; + test = this1 === data1 && this1 === data2 && this1 === data3 && this1 === this2 && this1 === this3; + return "itemsProp"; + }, "name"]; + }; + }; + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:summary()}}{{/if}}") && test, + 'Computed observable with depends including several nested function calls returning (finally) "itemsProp" updates for both array change and property change, and has correct this pointers and data arguments'); + + // =============================== Arrange =============================== + summary.depends = function() { + return function (object, callback) { + $.observe(object, "itemsProp", callback); + return [function () { + $.observe(object, "name", callback); + }]; + }; + }; + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:summary()}}{{/if}}"), + 'Computed observable with depends including several nested function calls (finally) programmatically observing both array and property. Works equivalently to declarative version'); + + // =============================== Arrange =============================== + function listenToArray(object, callback) { + $.observe(object, "itemsProp", callback); + } + function listenToName(object, callback) { + $.observe(object, "name", callback); + } + summary.depends = [listenToArray, listenToName]; + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:summary()}}{{/if}}"), + 'Computed observable with depends using independently declared functions to programmatically observe any fields. Works equivalently to declarative version'); + + // =============================== Arrange =============================== + function listenTo(field) { + return function(object, callback) { + $.observe(object, field, callback); + } + } + + summary.depends = [listenTo("itemsProp"), listenTo("name")]; + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:summary()}}{{/if}}"), + 'Computed observable with depends using generated function to programmatically observe any fields. Works equivalently to declarative version'); + + // =============================== Arrange =============================== + var summary = function() { + var data = this.data; // 'this' is the view + return data.itemsProp[0] + "-" + data.itemsProp.length + "-" + data.name; + } + summary.depends = ["itemsProp", "name"]; + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:~summary()}}{{/if}}"), + 'Computed observable helper depends = ["itemsProp", ...] updates for both array change and property change'); + + // =============================== Arrange =============================== + + var summary = function() { + var data = this.tagCtx.view.data; // 'this' is the tag instance + return data.itemsProp[0] + "-" + data.itemsProp.length + "-" + data.name; + } + + summary.depends = ["itemsProp", "name"]; + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{:'foo' convert=~summary}}{{/if}}"), + 'Converter (passed as helper) with depends = ["itemsProp", ...] updates for both array change and property change'); + + // =============================== Arrange =============================== + + $.views.converters("sumry", summary); + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{sumry:'foo'}}{{/if}}"), + 'Registered converter with depends = ["itemsProp", ...] updates for both array change and property change'); + + $.views.converters("sumry", null); + + // =============================== Arrange =============================== + summary.depends = null; + + $.views.tags("sumry", { + render: summary, + depends: ["itemsProp", "name"] + }); + + // ................................ Assert .................................. + assert.ok(testDepends("{^{if show}}{^{sumry/}}{{/if}}"), + 'Registered tag with depends = ["itemsProp", ...] updates for both array change and property change'); + + $.views.tags("sumry", null); + + // =============================== Arrange =============================== + var ret = "", + items = ["first"], + items2 = ["new0", "new1"], + app = { + show: true, + name: "Jo", + itemsProp: items, + summary: summary + }; + + $.templates("{^{for").link("#result", app, {summary: summary}); + + ret += "|1:" + $("#result").text(); + + // ................................ Act .................................. + $.observable(app).setProperty("name", "Bob"); + ret += "|2:" + $("#result").text(); + + $.observable(app.itemsProp).insert(0, "previous"); + ret += "|3:" + $("#result").text(); + + $.observable(app).setProperty("name", "Jim"); + + // =============================== Arrange =============================== +$.views.settings.trigger(false); + + function fullName() { + var person = this.ctxPrm ? this.ctxPrm("prson") : this; + return person.title + " " + person.name + " " + person.address.street; + } + + fullName.depends = function(data) { + return [this, "title", "name", "address^street"]; + }; + + fullName.set = function(val) { + var parts = val.split(" "); + $.observable(this).setProperty({ + title: parts.shift(), + name: parts.shift(), + address: {street: parts.join(" ")} + }); + }; + + var prson = { + title: "Sir", + name: "Jo", + address: {street: "1st Ave"}, + fullName: fullName, + }; + + $.views.templates({ + markup: '{^{:~prson.title}} ' + + '{^{:~prson.name}} ' + + '{^{:~prson.address^street}} ' + + 'Full: {^{:~prson.fullName()}} ' + + '{^{mytag ~prson.fullName}}' + + ' CTP: {^{:~ctp()}}' + + '' + + '{{/mytag}}' + + ' FULLNAMETAG: {^{fullName ~prson/}}', + tags: { + mytag: { + linkedCtxParam: "ctp", + onUpdate: false // Could also be true + }, + fullName: { + linkedCtxParam: ["prsn"], + render: function(person) { + return person.title + " " + person.name + " " + person.address.street + " "; + }, + depends: function(data) { + return [this.tagCtx.args[0], "title", "name", "address^street"]; + } + } + } + }).link("#result", 1, { + prson: prson + }); + var input, + result = $("#result").text(); + + // ................................ Act .................................. + $.observable(prson).setProperty("address", {street: "2nd St"}); + result += "\nADDRESS: " + $("#result").text(); + + input = $("#result input")[0]; + $(input).val(input.value + "+").change(); + result += "\nTITLE: " + $("#result").text(); + + input = $("#result input")[1]; + $(input).val(input.value + "+").change(); + result += "\nNAME: " + $("#result").text(); + + input = $("#result input")[2]; + $(input).val(input.value + "+").change(); + result += "\nSTREET: " + $("#result").text(); + + input = $("#result input")[3]; + $(input).val("Mr Bob FullSt").change(); + result += "\nFULL: " + $("#result").text(); + + input = $("#result input")[4]; + $(input).val("Lady Jane CtpSt").change(); + result += "\nCTP: " + $("#result").text(); + + input = $("#result input")[5]; + $(input).val("Ms Anne TagSt").change(); + result += "\nTAG: " + $("#result").text(); + + // ............................... Assert ................................. + + var expected = isIE8 ? + "Sir Jo 1st Ave Full: Sir Jo 1st Ave CTP: Sir Jo 1st Ave FULLNAMETAG: Sir Jo 1st Ave \n" + + "ADDRESS: Sir Jo 2nd St Full:Sir Jo 2nd St CTP:Sir Jo 2nd St FULLNAMETAG:Sir Jo 2nd St \n" + + "TITLE: Sir+ Jo 2nd St Full:Sir+ Jo 2nd St CTP:Sir+ Jo 2nd St FULLNAMETAG:Sir+ Jo 2nd St \n" + + "NAME: Sir+ Jo+ 2nd St Full:Sir+ Jo+ 2nd St CTP:Sir+ Jo+ 2nd St FULLNAMETAG:Sir+ Jo+ 2nd St \n" + + "STREET: Sir+ Jo+ 2nd St+ Full:Sir+ Jo+ 2nd St+ CTP:Sir+ Jo+ 2nd St+ FULLNAMETAG:Sir+ Jo+ 2nd St+ \n" + + "FULL: Mr Bob FullSt Full:Mr Bob FullSt CTP:Mr Bob FullSt FULLNAMETAG:Mr Bob FullSt \n" + + "CTP: Lady Jane CtpSt Full:Lady Jane CtpSt CTP:Lady Jane CtpSt FULLNAMETAG:Lady Jane CtpSt \n" + + "TAG: Ms Anne TagSt Full:Ms Anne TagSt CTP:Ms Anne TagSt FULLNAMETAG:Ms Anne TagSt " + : "Sir Jo 1st Ave Full: Sir Jo 1st Ave CTP: Sir Jo 1st Ave FULLNAMETAG: Sir Jo 1st Ave \n" + + "ADDRESS: Sir Jo 2nd St Full: Sir Jo 2nd St CTP: Sir Jo 2nd St FULLNAMETAG: Sir Jo 2nd St \n" + + "TITLE: Sir+ Jo 2nd St Full: Sir+ Jo 2nd St CTP: Sir+ Jo 2nd St FULLNAMETAG: Sir+ Jo 2nd St \n" + + "NAME: Sir+ Jo+ 2nd St Full: Sir+ Jo+ 2nd St CTP: Sir+ Jo+ 2nd St FULLNAMETAG: Sir+ Jo+ 2nd St \n" + + "STREET: Sir+ Jo+ 2nd St+ Full: Sir+ Jo+ 2nd St+ CTP: Sir+ Jo+ 2nd St+ FULLNAMETAG: Sir+ Jo+ 2nd St+ \n" + + "FULL: Mr Bob FullSt Full: Mr Bob FullSt CTP: Mr Bob FullSt FULLNAMETAG: Mr Bob FullSt \n" + + "CTP: Lady Jane CtpSt Full: Lady Jane CtpSt CTP: Lady Jane CtpSt FULLNAMETAG: Lady Jane CtpSt \n" + + "TAG: Ms Anne TagSt Full: Ms Anne TagSt CTP: Ms Anne TagSt FULLNAMETAG: Ms Anne TagSt "; + + assert.equal(result, expected, + "Custom tag control {{fullName ...}} using render, with linkedCtxParam, depends, onUpdate not false"); + + // =============================== Arrange =============================== + prson = { + title: "Sir", + name: "Jo", + fullName: fullName, + address: {street: "1st Ave"} + }; + + $.views.templates({ + markup: '{^{:~prson.title}} ' + + '{^{:~prson.name}} ' + + '{^{:~prson.address^street}} ' + + 'Full: {^{:~prson.fullName()}} ' + + '{^{mytag ~prson.fullName}}' + + ' CTP: {^{:~ctp()}}' + + '' + + '{{/mytag}}' + + ' FULLNAMETAG: {^{fullName ~prson/}}', + tags: { + mytag: { + linkedCtxParam: "ctp", + onUpdate: false + }, + fullName: { + linkedCtxParam: ["prsn"], + template: "{{:~prsn.title}} {{:~prsn.name}} {{:~prsn.address.street}} ", + depends: function(data) { + return [this.tagCtx.args[0], "title", "name", "address^street"]; + } + } + } + }).link("#result", 1, { + prson: prson + }); + var input, + result = $("#result").text(); + + // ................................ Act .................................. + $.observable(prson).setProperty("address", {street: "2nd St"}); + result += "\nADDRESS: " + $("#result").text(); + + input = $("#result input")[0]; + $(input).val(input.value + "+").change(); + result += "\nTITLE: " + $("#result").text(); + + input = $("#result input")[1]; + $(input).val(input.value + "+").change(); + result += "\nNAME: " + $("#result").text(); + + input = $("#result input")[2]; + $(input).val(input.value + "+").change(); + result += "\nSTREET: " + $("#result").text(); + + input = $("#result input")[3]; + $(input).val("Mr Bob FullSt").change(); + result += "\nFULL: " + $("#result").text(); + + input = $("#result input")[4]; + $(input).val("Lady Jane CtpSt").change(); + result += "\nCTP: " + $("#result").text(); + + input = $("#result input")[5]; + $(input).val("Ms Anne TagSt").change(); + result += "\nTAG: " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, expected, + "Custom tag control {{fullName ...}} using template, with linkedCtxParam, depends, onUpdate not false - works correctly"); + + // =============================== Arrange =============================== + prson = { + title: "Sir", + name: "Jo", + fullName: fullName, + address: {street: "1st Ave"} + }; + + $.views.templates({ + markup: 'Title: {^{:person.title}} ' + + 'Name: {^{:person.name}} ' + + 'Street: {^{:person^address.street}} ' + + 'Full: {^{:person.fullName()}} ' + + 'TAG: {^{mytag person.fullName ~prson=person}}' // Bind to function itself + + '{^{:~ctp()}}' + + ' ' + + '{{/mytag}}' + + 'TAG2: {^{mytag person.fullName() ~prson=person}}' // Bind to evaluated function + + '{^{:~ctp}}' + + ' ' + + '{{/mytag}}', + tags: { + mytag: { + linkedCtxParam: "ctp", + onUpdate: false + } + } + }).link("#result", { + person: prson + }); + var input, + result = $("#result").text(); + + // ................................ Act .................................. + $.observable(prson).setProperty("title","Sir2"); + result += "\nTITLE: " + $("#result").text(); + + $.observable(prson).setProperty("name","Jo2"); + result += "\nNAME: " + $("#result").text(); + + $.observable(prson).setProperty("address", {street: "2nd St"}); + result += "\nADDRESS: " + $("#result").text(); + + input = $("#result input")[0]; + $(input).val("Mr Bob FullSt").change(); + result += "\nCTP FUNCTION: " + $("#result").text(); + + input = $("#result input")[1]; + $(input).val("Mr Bob FullSt").change(); + result += "\nCTP EVALUATED FUNCTION: " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, isIE8 ? "Title: Sir Name: Jo Street: 1st Ave Full: Sir Jo 1st Ave TAG: Sir Jo 1st Ave TAG2: Sir Jo 1st Ave \n" + + "TITLE: Title:Sir2 Name: Jo Street: 1st Ave Full:Sir2 Jo 1st Ave TAG:Sir2 Jo 1st Ave TAG2:Sir2 Jo 1st Ave \n" + + "NAME: Title:Sir2 Name:Jo2 Street: 1st Ave Full:Sir2 Jo2 1st Ave TAG:Sir2 Jo2 1st Ave TAG2:Sir2 Jo2 1st Ave \n" + + "ADDRESS: Title:Sir2 Name:Jo2 Street:2nd St Full:Sir2 Jo2 2nd St TAG:Sir2 Jo2 2nd St TAG2:Sir2 Jo2 2nd St \n" + + "CTP FUNCTION: Title:Mr Name:Bob Street:FullSt Full:Mr Bob FullSt TAG:Mr Bob FullSt TAG2:Mr Bob FullSt \n" + + "CTP EVALUATED FUNCTION: Title:Mr Name:Bob Street:FullSt Full:Mr Bob FullSt TAG:Mr Bob FullSt TAG2:Mr Bob FullSt " + : "Title: Sir Name: Jo Street: 1st Ave Full: Sir Jo 1st Ave TAG: Sir Jo 1st Ave TAG2: Sir Jo 1st Ave \n" + + "TITLE: Title: Sir2 Name: Jo Street: 1st Ave Full: Sir2 Jo 1st Ave TAG: Sir2 Jo 1st Ave TAG2: Sir2 Jo 1st Ave \n" + + "NAME: Title: Sir2 Name: Jo2 Street: 1st Ave Full: Sir2 Jo2 1st Ave TAG: Sir2 Jo2 1st Ave TAG2: Sir2 Jo2 1st Ave \n" + + "ADDRESS: Title: Sir2 Name: Jo2 Street: 2nd St Full: Sir2 Jo2 2nd St TAG: Sir2 Jo2 2nd St TAG2: Sir2 Jo2 2nd St \n" + + "CTP FUNCTION: Title: Mr Name: Bob Street: FullSt Full: Mr Bob FullSt TAG: Mr Bob FullSt TAG2: Mr Bob FullSt \n" + + "CTP EVALUATED FUNCTION: Title: Mr Name: Bob Street: FullSt Full: Mr Bob FullSt TAG: Mr Bob FullSt TAG2: Mr Bob FullSt ", + "Custom tag control {{fullName ...}} with linkedCtxParam 2-way binding to computed property - either the function itself, or the evaluated function result"); + + // =============================== Arrange =============================== + $.views.templates({ + markup: + '{^{personname person ~psn2=person/}}' // binding to person + + '{{for person}}' + + '{^{personname #data ~psn2=#data/}}' // binding to #data as default argument + + '{^{personname ~psn2=#data/}}' // binding to #data as default argument + + '{{/for}}', + tags: { + personname: { + template: "", + linkedCtxParam: "psn" + } + } + }).link("#result", {person:{name: "Jo"}}); + + // ................................ Act .................................. + var getValues = function() { + result += inputs[0].value + " " + inputs[1].value + " " + inputs[2].value + " " + inputs[3].value + " " + inputs[4].value + " " + inputs[5].value + "\n"; + } + result = ""; + var inputs = $("#result input"); + + getValues(); + + $(inputs[0]).val("Jo2").change(); + + getValues(); + + $(inputs[1]).val("Jo3").change(); + + getValues(); + + $(inputs[2]).val("Jo4").change(); + + getValues(); + + $(inputs[3]).val("Jo5").change(); + + getValues(); + + $(inputs[4]).val("Jo6").change(); + + getValues(); + + $(inputs[5]).val("Jo7").change(); + + getValues(); + + // ............................... Assert ................................. + assert.equal(result, "Jo Jo Jo Jo Jo Jo\n" ++ "Jo2 Jo2 Jo2 Jo2 Jo2 Jo2\n" ++ "Jo3 Jo3 Jo3 Jo3 Jo3 Jo3\n" ++ "Jo4 Jo4 Jo4 Jo4 Jo4 Jo4\n" ++ "Jo5 Jo5 Jo5 Jo5 Jo5 Jo5\n" ++ "Jo6 Jo6 Jo6 Jo6 Jo6 Jo6\n" ++ "Jo7 Jo7 Jo7 Jo7 Jo7 Jo7\n", + "Custom tag control {{personname ...}} using template, with linkedCtxParam and tag contextual parameter, binding to #data, and with 2-way binding to person.name - works correctly"); + + // =============================== Arrange =============================== + $.views.templates({ + markup: + '{^{textbox path=person/}}' + + '

                  ' + + + '{^{textbox2 path=person.name/}}' + + '

                  ' + + + '{^{textbox3 path=person.name/}}' + + '
                  ' + + '
                  ' + + '
                  ', + tags: { + textbox: { + bindTo: "path", + linkedCtxParam: "psn", + template:"", + onUpdate: false + }, + textbox2: { + bindTo: "path", + linkedCtxParam: "nm", + template:"", + onUpdate: false + }, + textbox3: { + bindTo: "path", + linkedElement: "input", + template:"", + onUpdate: false + } + } + }).link("#result", {person:{name: "Jo"}}); + + // ................................ Act .................................. + var getValues = function() { + result += inputs[0].value + " " + inputs[1].value + " " + inputs[2].value + " " + inputs[3].value + " " + inputs[4].value + " " + inputs[5].value + " " + inputs[6].value + " " + inputs[7].value + "\n"; + } + result = ""; + var inputs = $("#result input"); + + getValues(); + + $(inputs[0]).val("Jo0").change(); + + getValues(); + + $(inputs[1]).val("Jo1").change(); + + getValues(); + + $(inputs[2]).val("Jo2").change(); + + getValues(); + + $(inputs[3]).val("Jo3").change(); + + getValues(); + + $(inputs[4]).val("Jo4").change(); + + getValues(); + + $(inputs[5]).val("Jo5").change(); + + getValues(); + + $(inputs[6]).val("Jo6").change(); + + getValues(); + + $(inputs[7]).val("Jo7").change(); + + getValues(); + + // ............................... Assert ................................. + assert.equal(result, "Jo Jo Jo Jo Jo Jo Jo Jo\n" ++ "Jo0 Jo0 Jo0 Jo0 Jo0 Jo0 Jo0 Jo0\n" ++ "Jo1 Jo1 Jo1 Jo1 Jo1 Jo1 Jo1 Jo1\n" ++ "Jo2 Jo2 Jo2 Jo2 Jo2 Jo2 Jo2 Jo2\n" ++ "Jo3 Jo3 Jo3 Jo3 Jo3 Jo3 Jo3 Jo3\n" ++ "Jo4 Jo4 Jo4 Jo4 Jo4 Jo4 Jo4 Jo4\n" ++ "Jo5 Jo5 Jo5 Jo5 Jo5 Jo5 Jo5 Jo5\n" ++ "Jo6 Jo6 Jo6 Jo6 Jo6 Jo6 Jo6 Jo6\n" ++ "Jo7 Jo7 Jo7 Jo7 Jo7 Jo7 Jo7 Jo7\n", + "Custom tag control {{texbox ...}} with linkedCtxParam or linkedElement, data-linked as (1) inline tag, (2) data-linked input or (3) data-linked div"); + + // =============================== Arrange =============================== + $.views.templates({ + markup: '{^{textbox path=name edit=editable/}}' + + '
                  ', + tags: { + textbox: { + bindTo: "path", + linkedCtxParam: "val", + init: function() { + this.edit = this.tagCtx.props.edit; // Initialize textbox state + }, + template:"" + + "{^{if ~tag.edit}}" // observable textbox state + + "" + + "{{else}}" + + "" + + "{{/if}}", + onUpdate: false + } + } + }).link("#result", {name: "Jo", editable: true}); + + // ................................ Act .................................. + var container = $("#result")[0]; + result = $("input:text", container)[0].value + " " + $("input:text", container)[1].value; + + $("input:text").eq(0).val("Fred").change(); // Modify text + + result += "|" + $("input:text", container)[0].value + " " + $("input:text", container)[1].value; + + var textBoxes = $.view().childTags("textbox"); // Find all the {{textbox}} tags in the view + + for (var i=0; i', + tags: { + textbox: { + bindTo: "path", + linkedCtxParam: "val", + init: function() { + this.edit = this.tagCtx.props.edit; // Initialize textbox state + }, + render: function() { + this.template = "" // Checkbox to toggle edit + + (this.edit // not bound, so driven by 'depends' + ? ""// for editing + : ""); // for rendering + }, + depends: function(data) { + return [this, "edit"]; // depends on textbox state + } + } + } + }).link("#result", {name: "Jo", editable: true}); + + // ................................ Act .................................. + var container = $("#result")[0]; + result = $("input:text", container)[0].value + " " + $("input:text", container)[1].value; + + $("input:text").eq(0).val("Fred").change(); // Modify text + + result += "|" + $("input:text", container)[0].value + " " + $("input:text", container)[1].value; + + var textBoxes = $.view().childTags("textbox"); // Find all the {{textbox}} tags in the view + + for (var i=0; i', + tags: { + textbox: { + bindTo: "path", + linkedCtxParam: "val", + init: function() { + this.edit = this.tagCtx.props.edit; ; // Initialize textbox state through edit property + }, + render: function() { + this.template = "" // Checkbox to toggle edit + + (this.edit + ? "" // for editing + : ""); // for rendering + }, + onUpdate: function(ev, eventArgs, tagCtxs) { + this.edit = tagCtxs[0].props.edit; // Respond to changed data-linked edit property. + }, + onBind: function() { + $.observe(this, "edit", $.proxy(this.refresh, this)); + }, + onUnbind: function() { + $.unobserve(this, "edit"); + } + } + } + }).link("#result", data); + + // ................................ Act .................................. + var container = $("#result")[0]; + result = $("input:text", container)[0].value + " " + $("input:text", container)[1].value; + + $("input:text").eq(0).val("Fred").change(); // Modify text + + result += "|" + $("input:text", container)[0].value + " " + $("input:text", container)[1].value; + + var textBoxes = $.view().childTags("textbox"); // Find all the {{textbox}} tags in the view + + for (var i=0; i>", "*"); + + res += "|" + $.views.settings.delimiters() + "|" + $.views.sub.settings.delimiters; + + $.views.settings.delimiters(current); + + res += "|" + $.templates("A_{{if true}}YES{{/if}}_B").render() + + "|" + $.views.settings.delimiters() + "|" + $.views.sub.settings.delimiters; + + // ............................... Assert ................................. + assert.equal(res, "A_yes_B|@%,%@,^|@%,%@,^|<<,>>,*|<<,>>,*|A_YES_B|{{,}},^|{{,}},^", "Custom delimiters with render()"); + + // ................................ Act .................................. + current = $.views.settings.delimiters(); + var app = {choose: true, name: "Jo"}; + $.views.settings.delimiters("_^", "!@", "("); + $.templates('_(^if choose!@
                  _^else!@no
                  _^/if!@').link("#result", app); + res = $("#result").text(); + $.observable(app).setProperty({choose: false, name: "other"}); + res += "|" + $("#result").text() + + "|" + $.views.settings.delimiters() + "|" + $.views.sub.settings.delimiters; + +$("#result input").val("new").change(); + + res += "|" + $("#result").text(); + + $.views.settings.delimiters(current); + + $.templates('{^{if choose}}
                  {{else}}NO
                  {{/if}}').link("#result", app); + res += "|" + $("#result").text() ++ "|" + $.views.settings.delimiters() + "|" + $.views.sub.settings.delimiters; + +$("#result input").val("NEW").change(); + + res += "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "Jo|noother2other3|_^,!@,(|_^,!@,(|nonew2new3|NOnew2new3|{{,}},^|{{,}},^|NONEW2NEW3", "Custom delimiters with link()"); + + // =============================== Arrange =============================== + // Debug mode false + + var oldDebugMode = $.views.settings.debugMode(); + + app = {choose: true, name: "Jo", onerr: "invalid'Jo'"}; + $.views.settings.debugMode(false); + + // ................................ Act .................................. + res = $.views.settings.debugMode(); + $("#result").empty(); + + try { + $.templates('{{:missing.willThrow}}X').link("#result", app); + } + catch (e) { + res += " " + !!e.message; + } + + res += " " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, 'false true ', + 'Debug mode false: {{:missing.willThrow}} throws error - with link()'); + + // ................................ Act .................................. + res = $.views.settings.debugMode(); + $("#result").empty(); + + try { + $.templates('
                  X
                  ').link("#result", app); + } + catch (e) { + res += " " + !!e.message; + } + + res += " " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, 'false true X', + 'Debug mode false: - data-link="missing.willThrow" - throws error'); + + // ................................ Act .................................. + // Debug mode true + + $.views.settings.debugMode(true); + + res = $.views.settings.debugMode(); + $("#result").empty(); + + $.templates('{{:missing.willThrow}}').link("#result", app); + + res += " " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res.slice(0, 13), 'true {Error: ', + 'Debug mode true: {{:missing.willThrow}} renders error - with link()'); + + // ................................ Act .................................. + + res = $.views.settings.debugMode(); + $("#result").empty(); + + $.templates('
                  X
                  ').link("#result", app); + + res += " " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res.slice(0, 13), 'true {Error: ', + 'Debug mode true: - data-link="missing.willThrow" - renders error'); + + app = {choose: true, name: "Jo", onerr: "invalid'Jo'"}; + res = ""; + + // ................................ Act .................................. + // Debug mode 'onError' handler function with return value + + $.views.settings.debugMode(function(e, fallback, view) { + // Can override using $.views.settings({onError: function(...) {...}}); + var data = this; + return "Override error - " + (fallback||"") + "_" + data.name + " " + (e.message.indexOf("undefined")>-1); // For syntax errors e is a string, and view is undefined + }); + + // ................................ Act .................................. + $.templates('{{:missing.willThrow}}').link("#result", app); + res = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "Override error - _Jo true", + "Debug mode 'onError' handler override - with link()"); + + // ................................ Act .................................. + $.templates('{{:missing.willThrow onError=onerr}} {^{if missing.willThrow onError=onerr + \' (in if tag)\'}}inside{{/if}}').link("#result", app); + res = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "Override error - invalid'Jo'_Jo true Override error - invalid'Jo' (in if tag)_Jo trueOverride error - invalid'Jo' (in data-link)_Jo true", + "onError fallback in tags and in data-link expression, with debug mode 'onError' handler override"); + + // ................................ Act .................................. + $.templates('{{:missing.willThrow onError=~myErrFn}} {^{if missing.willThrow onError=~myErrFn}}inside{{/if}}').link("#result", app, { + myErrFn: function(e, view) { + return "myErrFn for <" + this.name + ">"; + } + }); + res = $("#result").text(); + + // ............................... Assert ................................. + assert.equal(res, "Override error - myErrFn for _Jo true Override error - myErrFn for _Jo trueOverride error - myErrFn for _Jo true", + "onError handler in tags and in data-link expression, with debug mode 'onError' handler override "); + + // ................................ Reset .................................. + $("#result").empty(); + $.views.settings.debugMode(oldDebugMode); + +$.views.settings.trigger(true); +}); + +QUnit.module("API - Declarations"); + +QUnit.test("Template encapsulation", function(assert) { + + // =============================== Arrange =============================== + $.templates({ + myTmpl6: { + markup: "{{sort reverse=true people}}{{:lastName}}{{/sort}}", + tags: { + sort: sort + } + } + }); + + // ................................ Act .................................. + $.link.myTmpl6("#result", {people: people}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "TwoOne", "Template with tag resource"); + + // =============================== Arrange =============================== + $.templates({ + myTmpl7: { + markup: "{{if first}}Yes{{:~foo}}{{sort reverse=true people}}{{:lastName}}{{/sort}}{{else}}No{{:~foo}}{{sort reverse=true people}}{{:lastName}}{{/sort}}{{/if}}", + tags: { + sort: sort + }, + helpers: { + foo: "isFoo" + } + } + }); + + // ................................ Act .................................. + $.link.myTmpl7("#result", {people: people, first: false}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "NoisFooTwoOne", "Can access tag and helper resources from a nested context (i.e. inside {{if}} block)"); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.module("API - Views"); + +QUnit.test("$.view() in regular content", function(assert) { + + // =============================== Arrange =============================== + $.link.tmplHierarchy("#result", topData); + + // ................................ Act .................................. + var view = $.view("#1"); + + // ............................... Assert ................................. + assert.ok(view.ctxPrm("val") === 1 && view.type === "myWrap", '$.view(elem) gets nearest parent view. Custom tag blocks are of type "tmplName"'); + + // ................................ Act .................................. + view = $.view("#1", "root"); + + // ............................... Assert ................................. + assert.ok(view.parent.type === "top", '$.view(elem, "root") gets root view (child of top view)'); + + // ................................ Act .................................. + view = $.view("#1", "item"); + + // ............................... Assert ................................. + assert.ok(view.type === "item" && view.data.lastName === "One" && view.index === 0, '$.view(elem, "item") gets nearest item view'); + + // ................................ Act .................................. + view = $.view("#1", "data"); + + // ............................... Assert ................................. + assert.ok(view.type === "data" && view.data === topData, '$.view(elem, "data") gets nearest data view'); + + // ................................ Act .................................. + view = $.view("#1", "if"); + + // ............................... Assert ................................. + assert.ok(view.type === "if" && view.data === people[0], '$.view(elem, "if") gets nearest "if" view'); + + // ................................ Act .................................. + view = $.view("#1", "array"); + + // ............................... Assert ................................. + assert.ok(view.type === "array" && view.data === people, '$.view(elem, "array") gets nearest array view'); + + // ................................ Act .................................. + view = $.view("#sp1", "myWrap"); + + // ............................... Assert ................................. + assert.ok(view.type === "myWrap" && view.ctx.tag.tagName === "myWrap", '$.view(elem, "mytagName") gets nearest view for content of that tag'); + + view = $.view("#sp1"); + + // ............................... Assert ................................. + assert.ok(view.type === "if" && view.ctx.tag.tagName === "myWrap2", 'Within {{if}} block, $.view(elem) gets nearest "if" view, but view.ctx.tag is the nearest non-flow tag, i.e. custom tag that does not have flow set to true'); + + // ................................ Act .................................. + view = $.view("#1", true); + + // ............................... Assert ................................. + assert.ok(view.type === "myWrap2", '$.view(elem, true) gets the first nested view. Custom tag blocks are of type "tmplName"'); + + // ................................ Act .................................. + view = $.view("#result", true, "myFlow"); + + // ............................... Assert ................................. + assert.ok(view.type === "myFlow", '$.view(elem, true, viewTypeName) gets the first (depth first) nested view of that type'); + + // =============================== Arrange =============================== + + var data = []; + + $.templates("").link("#result", data); + + // ................................ Act .................................. + view = $.view("#result", true); + + // ............................... Assert ................................. + assert.ok(view.data === data && view.type === "array", + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true) returns the array view (even though the element is empty)'); + + // ................................ Act .................................. + var itemView = $.view("#result", true, "item"); + + // ............................... Assert ................................. + assert.ok(!itemView, + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true, "item") returns nothing'); + + // =============================== Arrange =============================== + + data = [1]; + + $.templates("").link("#result", data); + + // ................................ Act .................................. + view = $.view("#result", true); + + // ............................... Assert ................................. + assert.ok(view.data === data && view.type === "array", + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true) returns the array view (even though the container element is empty)'); + + // ................................ Act .................................. + itemView = $.view("#result", true, "item"); + + // ............................... Assert ................................. + assert.ok(itemView.index === 0, + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true, "item") returns the item view (even though the container element is empty)'); + + // =============================== Arrange =============================== + + data = {people: []}; + + $.templates("
                  {{for people}}{{/for}}
                  ").link("#result", data); + + // ................................ Act .................................. + view = $.view("#result div", true); + + // ............................... Assert ................................. + assert.ok(view.data === data.people && view.type === "array", + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true) returns the array view (even though the element is empty)'); + + // ................................ Act .................................. + itemView = $.view("#result div", true, "item"); + + // ............................... Assert ................................. + assert.ok(!itemView, + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true, "item") returns nothing'); + + // =============================== Arrange =============================== + + data = {people: [1]}; + + $.templates("
                  {{for people}}{{/for}}
                  ").link("#result", data); + + // ................................ Act .................................. + view = $.view("#result div", true); + + // ............................... Assert ................................. + assert.ok(view.data === data.people && view.type === "array", + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true) returns the array view (even though the container element is empty)'); + + // ................................ Act .................................. + itemView = $.view("#result div", true, "item"); + + // ............................... Assert ................................. + assert.ok(itemView.index === 0, + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true, "item") returns the item view (even though the container element is empty)'); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("view.get() and view.getIndex() in regular content", function(assert) { + + // =============================== Arrange =============================== + $.link.tmplHierarchy("#result", topData); + + var view1 = $.view("#1"); + + // ................................ Act .................................. + var view = view1.get(); + + // ............................... Assert ................................. + assert.ok(view===view1.parent, 'view.get() gets parent view'); + + // ................................ Act .................................. + view = view1.get("item"); + + // ............................... Assert ................................. + assert.ok(view.type === "item" && view.data.lastName === "One" && view.index === 0, 'view.get("item") gets nearest item view'); + + // ................................ Act .................................. + view = view1.get("myWrap"); + + // ............................... Assert ................................. + assert.ok(view === view1, 'view.get("viewTypeName") gets nearest viewTypeName view looking at ancestors starting from the view itself'); + + // ................................ Act .................................. + view = view1.get(true, "myWrap"); + + // ............................... Assert ................................. + assert.ok(view === view1, 'view.get(true, "viewTypeName") gets nearest viewTypeName view looking at descendants starting from the view itself'); + + // ................................ Act .................................. + view = view1.get(true, "myFlow"); + + // ............................... Assert ................................. + assert.ok(view.tmpl.markup === "zz{{if true}}{{myFlow2/}}{{/if}}", 'view.get(true, "viewTypeName") gets nearest viewTypeName view looking at descendants starting from the view itself'); + + // ................................ Act .................................. + view = view1.get(true, "myFlow2"); + + // ............................... Assert ................................. + assert.ok(view.tmpl.markup === "flow2", 'view.get(true, "viewTypeName") gets nearest viewTypeName view looking at descendants starting from the view itself'); + + // ................................ Act .................................. + view = view1.get(true); + + // ............................... Assert ................................. + assert.ok(view.type === "myWrap2" && view === view1.get(true, "myWrap2") && view === $.view("#sp0").parent, 'view.get(true) gets nearest child view of any type'); + + // ............................... Assert ................................. + assert.ok(view1.get(true, "nonexistent") === undefined, 'view.get(true, "viewTypeName") returns undefined if no descendant of that type, starting from the view itself'); + + // ............................... Assert ................................. + assert.ok($.view("#1").getIndex() === 0 && $.view("#1", "item").index === 0 && $.view("#2").getIndex() === 1 && $.view("#2", "item").index === 1, '$.view(elem).getIndex() gets index of nearest item view'); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { + + $.views.settings.trigger(false); + + // =============================== Arrange =============================== + $.views.tags("mytag", { + bindTo: ["height", "width"], + linkedElement: [".ht", ".wd"], + linkedCtxParam: ["ht", "wd"], + mainElement: "div", + template: "
                  {{include tmpl=#content/}}

                  ", + setValue: function(val, index, tagElse) { + if (val === undefined) { + val = this.getValue(tagElse)[index]; + this.tagCtxs[tagElse].ctxPrm(this.linkedCtxParam[index], val); + } else { + this.vals[tagElse][index] = val; + } +// return val; + }, + getValue: function(tagElse) { + return this.vals[tagElse]; + }, + onUpdate: false, + setSize: true, + vals: [[38, 48], [33, 44]] + }); + + // =============================== Arrange =============================== + var tmpl = $.templates(' {^{:~foo}}'); + + tmpl.link("#result", {}, {}); + + // ............................... Assert ................................. + assert.ok($.view().ctxPrm("toString") === undefined, + "ctxPrm() for built-in non-enumerables such as 'toString' returns undefined"); + + // ................................ Act .................................. + var input = $("#1"), + view1 = input.view(), + content = $("#result"), + res = "1: " + (view1.ctxPrm("foo")||"") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set1"); + + res += "|2: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input.val("new1"); + input.change(); + + res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: -: { } |2: set1-set1: {set1 } |3: new1-new1: {new1 } " + : "1: -: { } |2: set1-set1: { set1} |3: new1-new1: { new1} ", + "Uninitialized context param can be changed observably by two-way binding or by view.ctxPrm(foo, value) call"); + + // ................................ Act .................................. + tmpl.link("#result", {}, {foo: "instance"}); + + input = $("#1"); + view1 = input.view(); + content = $("#result"); + res = "1: " + (view1.ctxPrm("foo")||"") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set1"); + + res += "|2: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input.val("new1"); + input.change(); + + res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: instance-instance: { instance} |2: set1-set1: {set1} |3: new1-new1: {new1} " + : "1: instance-instance: { instance} |2: set1-set1: { set1} |3: new1-new1: { new1} ", + "Initialized instance context param can be changed observably by two-way binding or by view.ctxPrm(foo, value) call"); + + // ................................ Act .................................. + $.views.helpers("foo", "registered", tmpl); + + tmpl.link("#result", {}); + + input = $("#1"); + view1 = input.view(); + content = $("#result"); + res = "1: " + (view1.ctxPrm("foo")||"") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set1"); + + res += "|2: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input.val("new1"); + input.change(); + + res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: registered-registered: { registered} |2: set1-set1: {set1} |3: new1-new1: {new1} " + : "1: registered-registered: { registered} |2: set1-set1: { set1} |3: new1-new1: { new1} ", + "Initialized registered helper param can be changed observably by two-way binding or by view.ctxPrm(foo, value) call"); + + // =============================== Arrange =============================== + tmpl = $.templates( + ' Outer: {^{:~foo}}' + + '{{if true}}, Inner: {^{:~foo}}' + + '{{if true}}, Nested inner: {^{:~foo}}' + + '{{/if}}' + + '{{/if}}'); + + tmpl.link("#result", {}); + + input = $("#1"); + view1 = input.view(); + content = $("#result"); + res = "1: " + (view1.ctxPrm("foo")||"") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set1"); + + res += "|2: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input.val("new1"); + input.change(); + + res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: -: { Outer: , Inner: , Nested inner: }" + + " |2: set1-set1: { Outer:set1 , Inner:set1 , Nested inner:set1 }" + + " |3: new1-new1: { Outer:new1 , Inner:new1 , Nested inner:new1 } " + : "1: -: { Outer: , Inner: , Nested inner: }" + + " |2: set1-set1: { Outer: set1, Inner: set1, Nested inner: set1}" + + " |3: new1-new1: { Outer: new1, Inner: new1, Nested inner: new1} ", + "Observable contextual parameter is scoped to root view (view below top view)"); + + // =============================== Arrange =============================== + tmpl = $.templates( + 'Property: {^{:~prp}} |
                  ' + + 'Function: {^{:is}} |
                  ' + + '{{for items}}' + + 'Inner Property: {^{:~prp}} |
                  ' + + 'Inner Function: {^{:is}} |
                  ' + + '{{/for}}' +); + + var fn = function() { + return this.data.is; + }; + + fn.set = function(val) { + $.observable(this.data).setProperty("is", val); + } + + tmpl.link("#result", [ + {is:"outer1", items: [{is: "inner11"}, {is: "inner12"}]}, + {is:"outer2", items: [{is: "inner21"}, {is: "inner22"}]} + ], + {prp: "PRP", fn: fn} + ); + + var propInput1 = $(".prp").eq(0); + var fnInput1 = $(".fn").eq(0); + var innerPropInput1 = $(".prpb").eq(0); + var innerFnInput1 = $(".fnb").eq(0); + var innerFnInput3 = $(".fnb").eq(3); + content = $("#result"); + res = "1: " + content.text(); + + // ................................ Act .................................. + propInput1.val("prp1"); // first outer propInput + propInput1.change(); + innerPropInput1.val("prp2"); // first inner propInput + innerPropInput1.change(); + fnInput1.val("fn1"); // first outer fnInput + fnInput1.change(); + innerFnInput1.val("fn2"); // first inner fnInput + innerFnInput1.change(); + innerFnInput3.val("fn3"); // first inner fnInput + innerFnInput3.change(); + + res += "2: " + content.text(); + + // ............................... Assert ................................. + assert.equal(res, + "1: Property: PRP | Function: outer1 | " ++ "Inner Property: PRP | Inner Function: inner11 | Inner Property: PRP | Inner Function: inner12 | " ++ "Property: PRP | Function: outer2 | " ++ "Inner Property: PRP | Inner Function: inner21 | Inner Property: PRP | Inner Function: inner22 | " ++ "2: Property: prp2 | Function: fn1 | " ++ "Inner Property: prp2 | Inner Function: fn2 | Inner Property: prp2 | Inner Function: inner12 | " ++ "Property: prp2 | Function: outer2 | " ++ "Inner Property: prp2 | Inner Function: inner21 | Inner Property: prp2 | Inner Function: fn3 | ", + "Observable contextual parameter are scoped: for computed function, to calling view, for properties, not functions, to root view (view below top view)"); + + // =============================== Arrange =============================== + tmpl = $.templates(' {^{:~foo}}'); + + tmpl.link("#result", [0, 1]); + + var input1 = $(".inp")[0], + input2 = $(".inp")[1], + view2 = $.view(input2); + view1 = $.view(input1); + + content = $("#result"); + res = "1: View1:" + (view1.ctxPrm("foo")||"") + "-" + input1.value + " View2:" + (view2.ctxPrm("foo")||"") + "-" + input2.value + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set1"); + view2.ctxPrm("foo", "set2"); + + res += "|2: View1:" + (view1.ctxPrm("foo")||"") + "-" + input1.value + " View2:" + (view2.ctxPrm("foo")||"") + "-" + input2.value + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input1.value = "new1"; + $(input1).change(); + input2.value = "new2"; + $(input2).change(); + + res += "|3: View1:" + (view1.ctxPrm("foo")||"") + "-" + input1.value + " View2:" + (view2.ctxPrm("foo")||"") + "-" + input2.value + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: View1:- View2:-: { }" + + " |2: View1:set2-set2 View2:set2-set2: {set2 set2 }" + + " |3: View1:new2-new2 View2:new2-new2: {new2 new2 } " + : "1: View1:- View2:-: { }" + + " |2: View1:set2-set2 View2:set2-set2: { set2 set2}" + + " |3: View1:new2-new2 View2:new2-new2: { new2 new2} ", + "Observable contextual parameter is scoped to root view (view below top view) - which is array view, when rendering/linking an array"); + + // =============================== Arrange =============================== + tmpl = $.templates(' Outer: {^{:~foo}}' + + '{^{mytag width=cx}}, Inner: {^{:~foo}}' + + '{^{mytag}}, Nested inner: {^{:~foo}}' + + '{{else width=cx}}, Nested inner: {^{:~foo}}' + + '{{/mytag}}' + + '{{/mytag}}'); + + tmpl.link("#result", {cx: 22}); + + var input1 = $("#1"), + view1 = input1.view(), + input2 = $("#2"), + view2 = input2.view(), + input3 = $("#3"), + view3 = input3.view(), + input4 = $("#4"), + view4 = input4.view(); + content = $("#result"); + res = "1: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + "/" + (view3.ctxPrm("foo")||"") + "/" + (view4.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set1"); + view2.ctxPrm("foo", "set2"); + view3.ctxPrm("foo", "set3"); + view4.ctxPrm("foo", "set4"); + + res += "|2: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + "/" + (view3.ctxPrm("foo")||"") + "/" + (view4.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input1.val("new1"); + input1.change(); + input2.val("new2"); + input2.change(); + input3.val("new3"); + input3.change(); + input4.val("new4"); + input4.change(); + + res += "|3: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + "/" + (view3.ctxPrm("foo")||"") + "/" + (view4.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer:set1 , Inner:set2 , Nested inner:set4 , Nested inner:set4 }" + + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer:new1 , Inner:new2 , Nested inner:new4 , Nested inner:new4 } " + : "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer: set1, Inner: set2, Nested inner: set4, Nested inner: set4}" + + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer: new1, Inner: new2, Nested inner: new4, Nested inner: new4} ", + "Observable contextual parameter within linked tag is scoped to tag view, - closest non flow tag ancestor, shared across else blocks"); + // ................................ Act .................................. + + var innerTag = $.view().childTags(true, "mytag")[1]; + + res = "|1: " + (innerTag.ctxPrm("foo")||""); + + innerTag.ctxPrm("foo", "tagFoo"); + innerTag.ctxPrm("newPrm", "tagNewPrm"); + + res += " |2: " + (innerTag.ctxPrm("foo")||"") + "-" + (innerTag.ctxPrm("newPrm")||"") + + "-" + (view1.ctxPrm("newPrm")||"") + "/" + (view2.ctxPrm("newPrm")||"") + "/" + (view3.ctxPrm("newPrm")||"") + "/" + (view4.ctxPrm("newPrm")||"") + + "-" + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + "/" + (view3.ctxPrm("foo")||"") + "/" + (view4.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "|1: new4" + + " |2: tagFoo-tagNewPrm-//tagNewPrm/tagNewPrm-new1/new2/tagFoo/tagFoo-new1/new2/tagFoo/tagFoo: { Outer:new1 , Inner:new2 , Nested inner:tagFoo , Nested inner:tagFoo } " + : "|1: new4" + + " |2: tagFoo-tagNewPrm-//tagNewPrm/tagNewPrm-new1/new2/tagFoo/tagFoo-new1/new2/tagFoo/tagFoo: { Outer: new1, Inner: new2, Nested inner: tagFoo, Nested inner: tagFoo} ", + "tag.ctxPrm() gets/sets parameter scoped to tag view, shared across else blocks"); + + // ............................... Assert ................................. + + assert.equal(innerTag.tagCtxs[0].nodes().length + "|" + innerTag.tagCtxs[1].nodes().length + "|" + innerTag.nodes().length + + "-" + innerTag.tagCtxs[0].contents(true, "input").length + "|" + innerTag.tagCtxs[1].contents(true, "input").length + "|" + innerTag.contents(true, "input").length, + isIE8 ? "3|2|5-1|1|2" : "2|2|4-1|1|2", + "Multiple else blocks: tag.nodes() and tag.content() return content from all else blocks"); + + // =============================== Arrange =============================== + tmpl = $.templates(' Outer: {^{:~foo}}' + + '{{mytag width=cx}}, Inner: {^{:~foo}}' + + '{{mytag}}, Nested inner: {^{:~foo}}' + + '{{else width=cx}}, Nested inner: {^{:~foo}}' + + '{{/mytag}}' + + '{{/mytag}}'); + + tmpl.link("#result", {cx: 22}); + + var input1 = $("#1"), + view1 = input1.view(), + input2 = $("#2"), + view2 = input2.view(), + input3 = $("#3"), + view3 = input3.view(), + input4 = $("#4"), + view4 = input4.view(); + content = $("#result"); + res = "1: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + "/" + (view3.ctxPrm("foo")||"") + "/" + (view4.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set1"); + view2.ctxPrm("foo", "set2"); + view3.ctxPrm("foo", "set3"); + view4.ctxPrm("foo", "set4"); + + res += "|2: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + "/" + (view3.ctxPrm("foo")||"") + "/" + (view4.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input1.val("new1"); + input1.change(); + input2.val("new2"); + input2.change(); + input3.val("new3"); + input3.change(); + input4.val("new4"); + input4.change(); + + res += "|3: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + "/" + (view3.ctxPrm("foo")||"") + "/" + (view4.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer:set1 , Inner:set2 , Nested inner:set4 , Nested inner:set4 }" + + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer:new1 , Inner:new2 , Nested inner:new4 , Nested inner:new4 } " + : "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer: set1, Inner: set2, Nested inner: set4, Nested inner: set4}" + + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer: new1, Inner: new2, Nested inner: new4, Nested inner: new4} ", + "Observable contextual parameter within unlinked tag is scoped to tag view, - closest non flow tag ancestor, shared across else blocks"); + + // =============================== Arrange =============================== + $.views.tags.mytag.vals = [[38, 48], [33, 44]]; + + tmpl = $.templates(' Outer: {^{:~wd}}' + + '{^{mytag width=11}}, Inner: {^{:~wd}}' + + '{^{mytag}}, Nested inner: {^{:~wd}}' + + '{{else width=cx}}, Nested inner: {^{:~wd}}' + + '{{/mytag}}' + + '{{/mytag}}'); + + tmpl.link("#result", {cx: 22}); + + var input1 = $("#1"), + view1 = input1.view(), + input2 = $("#2"), + view2 = input2.view(), + input3 = $("#3"), + view3 = input3.view(), + input4 = $("#4"), + view4 = input4.view(); + content = $("#result"); + res = "1: " + (view1.ctxPrm("wd")||"") + "/" + (view2.ctxPrm("wd")||"") + "/" + (view3.ctxPrm("wd")||"") + "/" + (view4.ctxPrm("wd")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("wd", "set1"); + view2.ctxPrm("wd", "set2"); + view3.ctxPrm("wd", "set3"); + view4.ctxPrm("wd", "set4"); + + res += "|2: " + (view1.ctxPrm("wd")||"") + "/" + (view2.ctxPrm("wd")||"") + "/" + (view3.ctxPrm("wd")||"") + "/" + (view4.ctxPrm("wd")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input1.val("new1"); + input1.change(); + input2.val("new2"); + input2.change(); + input3.val("new3"); + input3.change(); + input4.val("new4"); + input4.change(); + + res += "|3: " + (view1.ctxPrm("wd")||"") + "/" + (view2.ctxPrm("wd")||"") + "/" + (view3.ctxPrm("wd")||"") + "/" + (view4.ctxPrm("wd")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + + assert.equal(res, isIE8 + ? "1: /11/48/22-/11/48/22: { Outer: , Inner: 11, Nested inner:48 , Nested inner: 22}" + + " |2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer:set1 , Inner:set2, Nested inner:set3 , Nested inner:set4}" + + " |3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer:new1 , Inner:new2, Nested inner:new3 , Nested inner:new4} " + : "1: /11/48/22-/11/48/22: { Outer: , Inner: 11, Nested inner: 48, Nested inner: 22}" + + " |2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer: set1, Inner: set2, Nested inner: set3, Nested inner: set4}" + + " |3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer: new1, Inner: new2, Nested inner: new3, Nested inner: new4} ", + "Observable tag contextual parameter within linked tag is scoped to tag view, - closest non flow tag ancestor, not shared across else blocks"); + + // =============================== Arrange =============================== + tmpl = $.templates(' Outer: {^{:~wd}}' + + '{{mytag width=11}}, Inner: {^{:~wd}}' + + '{{mytag}}, Nested inner: {^{:~wd}}' + + '{{else width=cx}}, Nested inner: {^{:~wd}}' + + '{{/mytag}}' + + '{{/mytag}}'); + + tmpl.link("#result", {cx: 22}); + + var input1 = $("#1"), + view1 = input1.view(), + input2 = $("#2"), + view2 = input2.view(), + input3 = $("#3"), + view3 = input3.view(), + input4 = $("#4"), + view4 = input4.view(); + content = $("#result"); + res = "1: " + (view1.ctxPrm("wd")||"") + "/" + (view2.ctxPrm("wd")||"") + "/" + (view3.ctxPrm("wd")||"") + "/" + (view4.ctxPrm("wd")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("wd", "set1"); + view2.ctxPrm("wd", "set2"); + view3.ctxPrm("wd", "set3"); + view4.ctxPrm("wd", "set4"); + + res += "\n|2: " + (view1.ctxPrm("wd")||"") + "/" + (view2.ctxPrm("wd")||"") + "/" + (view3.ctxPrm("wd")||"") + "/" + (view4.ctxPrm("wd")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input1.val("new1"); + input1.change(); + input2.val("new2"); + input2.change(); + input3.val("new3"); + input3.change(); + input4.val("new4"); + input4.change(); + + res += "\n|3: " + (view1.ctxPrm("wd")||"") + "/" + (view2.ctxPrm("wd")||"") + "/" + (view3.ctxPrm("wd")||"") + "/" + (view4.ctxPrm("wd")||"") + + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: /11//22-/11//22: { Outer: , Inner: 11, Nested inner: , Nested inner: 22}" + + " \n|2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer:set1 , Inner:set2, Nested inner:set3 , Nested inner:set4}" + + " \n|3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer:new1 , Inner:new2, Nested inner:new3 , Nested inner:new4} " + : "1: /11//22-/11//22: { Outer: , Inner: 11, Nested inner: , Nested inner: 22}" + + " \n|2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer: set1, Inner: set2, Nested inner: set3, Nested inner: set4}" + + " \n|3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer: new1, Inner: new2, Nested inner: new3, Nested inner: new4} ", + "Observable tag contextual parameter within unlinked tag is scoped to tag view, - closest non flow tag ancestor, not shared across else blocks"); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: 'OUTER{^{:~foo}}{^{namebox/}}', + tags: { + namebox: { + template: 'INNER{^{:~foo}}' + } + } + }); + + tmpl.link("#result", [1,2]); + + var inputOuter0 = $("#outer0"), + inputOuter1 = $("#outer1"), + inputInner0 = $("#inner0"), + inputInner1 = $("#inner1"); + + // ................................ Act .................................. + inputInner0.val("inner0!"); + inputInner0.change(); + inputOuter1.val("outer1!"); + inputOuter1.change(); + + var res = $("#result").text() + "%" + inputOuter0.val() + "|" + inputOuter1.val() + "|" + inputInner0.val() + "|" + inputInner1.val(); + + // ............................... Assert ................................. + assert.equal(res, "OUTERouter1!INNERinner0!OUTERouter1!INNER%outer1!|outer1!|inner0!|", + "When contextual parameter not initialized at higher level, it is scoped to nearest tag container, or to root view (view below top view)"); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: 'OUTERMOST{^{:~foo}} {^{include ~foo="wrapper!"}}OUTER{^{:~foo}}{^{namebox/}}{{/include}}', + // With {{include ~foo=...}} wrapper + tags: { + namebox: { + template: 'INNER{^{:~foo}}' + } + } + }); + + tmpl.link("#result", [1,2]); + + inputOuter0 = $("#outer0"); + inputOuter1 = $("#outer1"); + inputInner0 = $("#inner0"); + inputInner1 = $("#inner1"); + + res = $("#result").text() + "--" + inputOuter0.val() + "|" + inputOuter1.val() + "|" + inputInner0.val() + "|" + inputInner1.val(); + + // ............................... Assert ................................. + assert.equal(res, "OUTERMOST OUTERwrapper!INNERwrapper!OUTERMOST OUTERwrapper!INNERwrapper!--wrapper!|wrapper!|wrapper!|wrapper!", + "When contextual parameter is initialized at higher level, it is initialized to that level"); + + // ................................ Act .................................. + inputInner0.val("inner0!"); + inputInner0.change(); + inputOuter1.val("outer1!"); + inputOuter1.change(); + + res = $("#result").text() + "%" + inputOuter0.val() + "|" + inputOuter1.val() + "|" + inputInner0.val() + "|" + inputInner1.val(); + + // ............................... Assert ................................. + assert.equal(res, "OUTERMOST OUTERinner0!INNERinner0!OUTERMOST OUTERouter1!INNERouter1!%inner0!|outer1!|inner0!|outer1!", + "When contextual parameter is initialized at higher level, it is scoped to that level"); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: 'OUTER{^{:~foo}}{^{namebox/}}', + tags: { + namebox: { + template: 'INNER{^{:~foo}}', + } + }, + helpers: {foo: "helperInit!"} // Global helper + }); + + tmpl.link("#result", [1,2]); + + inputOuter0 = $("#outer0"); + inputOuter1 = $("#outer1"); + inputInner0 = $("#inner0"); + inputInner1 = $("#inner1"); + + // ................................ Act .................................. + inputInner0.val("inner0!"); + inputInner0.change(); + inputOuter1.val("outer1!"); + inputOuter1.change(); + + res = $("#result").text() + "%" + inputOuter0.val() + "|" + inputOuter1.val() + "|" + inputInner0.val() + "|" + inputInner1.val(); + + // ............................... Assert ................................. + assert.equal(res, "OUTERouter1!INNERouter1!OUTERouter1!INNERouter1!%outer1!|outer1!|outer1!|outer1!", + "When contextual parameter is initialized as global helper, it is scoped to root view (view below top view)"); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: 'OUTER{^{:~foo}}{^{namebox/}}', + tags: { + namebox: { + template: 'INNER{^{:~foo}}' + } + } + }); + + tmpl.link("#result", [1,2], {foo: "instanceHelperInit!"}); // Instance helper + + inputOuter0 = $("#outer0"); + inputOuter1 = $("#outer1"); + inputInner0 = $("#inner0"); + inputInner1 = $("#inner1"); + + // ................................ Act .................................. + inputInner0.val("inner0!"); + inputInner0.change(); + inputOuter1.val("outer1!"); + inputOuter1.change(); + + res = $("#result").text() + "%" + inputOuter0.val() + "|" + inputOuter1.val() + "|" + inputInner0.val() + "|" + inputInner1.val(); + + // ............................... Assert ................................. + assert.equal(res, "OUTERouter1!INNERouter1!OUTERouter1!INNERouter1!%outer1!|outer1!|outer1!|outer1!", + "When contextual parameter is initialized as instance helper, it is scoped to root view (view below top view)"); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: 'OUTER{^{:~foo}}{^{namebox/}}', + tags: { + namebox: { + template: 'INNER{{:~foo}}' // Needs refreshing to show ~foo updates, since {{:~foo}} rather than data-linked {^{:~foo}} + } + }, + helpers: {foo: "helperInit!"} // Global helper + }); + + tmpl.link("#result", [1,2]); + + inputOuter0 = $("#outer0"); + inputOuter1 = $("#outer1"); + + // ................................ Act .................................. + inputOuter1.val("inner1!"); + inputOuter1.change(); + + res = $("#result").text() + "%" + inputOuter0.val() + "|" + inputOuter1.val(); + + // ............................... Assert ................................. + assert.equal(res, "OUTERinner1!INNERhelperInit!OUTERinner1!INNERhelperInit!%inner1!|inner1!", + "When tag needs to be refreshed, if no depends on tag, will not refresh values of ~foo "); + + // =============================== Arrange =============================== + tmpl = $.templates({ + markup: 'OUTER{^{:~foo}}{^{namebox/}}', + tags: { + namebox: { + template: 'INNER{{:~foo}}', // Needs refreshing to show ~foo updates, since {{:~foo}} rather than data-linked {^{:~foo}} + depends: "~foo" // Depends path to ~foo will force refresh when ~foo changes + } + }, + helpers: {foo: "helperInit!"} // Global helper + }); + + tmpl.link("#result", [1,2]); + + inputOuter0 = $("#outer0"); + inputOuter1 = $("#outer1"); + + // ................................ Act .................................. + inputOuter1.val("inner1!"); + inputOuter1.change(); + + res = $("#result").text() + "%" + inputOuter0.val() + "|" + inputOuter1.val(); + + // ............................... Assert ................................. + assert.equal(res, "OUTERinner1!INNERinner1!OUTERinner1!INNERinner1!%inner1!|inner1!", + "When tag needs to be refreshed, if depends='~foo' on tag, will refresh values of ~foo "); + +// =============================== Arrange =============================== + tmpl = $.templates(' {^{:~foo}}'); + + tmpl.link("#result", [1,2], {foo: "val1"}); + + input1 = $("#a1"); + view1 = input1.view(); + input2 = $("#a2"); + view2 = input2.view(); + content = $("#result"); + + res = "1: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input1.val("new1"); + input1.change(); + + res += "\n2: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view2.ctxPrm("foo", "set2"); + + res += "\n3: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + // Replace and verify context params are scoped within "#result", so re-initialized + tmpl.link("#result", [1,2], {foo: "val2"}); + + input1 = $("#a1"); + view1 = input1.view(); + input2 = $("#a2"); + view2 = input2.view(); + + res += "\n4: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + view1.ctxPrm("foo", "set3"); + + res += "\n5: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + input2.val("new3"); + input2.change(); + + res += "\n6: " + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: val1/val1-val1/val1: { val1 val1}" + + " \n2: new1/new1-new1/new1: {new1new1}" + + " \n3: set2/set2-set2/set2: {set2set2}" + + " \n4: val2/val2-val2/val2: { val2 val2}" + + " \n5: set3/set3-set3/set3: {set3set3}" + + " \n6: new3/new3-new3/new3: {new3new3} " + : "1: val1/val1-val1/val1: { val1 val1}" + + " \n2: new1/new1-new1/new1: { new1 new1}" + + " \n3: set2/set2-set2/set2: { set2 set2}" + + " \n4: val2/val2-val2/val2: { val2 val2}" + + " \n5: set3/set3-set3/set3: { set3 set3}" + + " \n6: new3/new3-new3/new3: { new3 new3} ", + "link() will initialize contextual parameters, which are scoped to the newly linked view - so re-initialize on relinking"); + + // =============================== Arrange =============================== + var outerTmpl = $.templates(' {^{:~foo}}
                  '); + + outerTmpl.link("#result", {}, {foo: "outer"}); + content = $("#result"); + + var inputOuter = $("#outer"); + var viewOuter = inputOuter.view(); + + res = "1: " + (viewOuter.ctxPrm("foo")||"") + + "-" + inputOuter.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + // Link to "#main" within linked templated content, and ensure context params are scoped within "#main", independent + // of context params in outer views under "#result" + tmpl = $.templates(' {^{:~foo}}'); + tmpl.link("#main", [1,2], {foo: "val1"}); + + input1 = $("#a1"); + view1 = input1.view(); + input2 = $("#a2"); + view2 = input2.view(); + + res += "\n2: " + (viewOuter.ctxPrm("foo")||"") + "/" + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + inputOuter.val() + "/" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + viewOuter.ctxPrm("foo", "newouter"); + view1.ctxPrm("foo", "new1"); + input2.val("new2"); + input2.change(); + + res += "\n3: " + (viewOuter.ctxPrm("foo")||"") + "/" + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + inputOuter.val() + "/" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ................................ Act .................................. + // Link to "#main" within linked templated content, and ensure context params are scoped within "#main", independent + // of context params in outer views under "#result" + tmpl.link("#main", [1,2], {foo: "val2"}); + + input1 = $("#a1"); + view1 = input1.view(); + input2 = $("#a2"); + view2 = input2.view(); + + res += "\n4: " + (viewOuter.ctxPrm("foo")||"") + "/" + (view1.ctxPrm("foo")||"") + "/" + (view2.ctxPrm("foo")||"") + + "-" + inputOuter.val() + "/" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; + + // ............................... Assert ................................. + assert.equal(res, isIE8 + ? "1: outer-outer: { outer }" + + " \n2: outer/val1/val1-outer/val1/val1: { outer val1 val1}" + + " \n3: newouter/new2/new2-newouter/new2/new2: {newouter new2new2}" + + " \n4: newouter/val2/val2-newouter/val2/val2: {newouter val2 val2} " + : "1: outer-outer: { outer }" + + " \n2: outer/val1/val1-outer/val1/val1: { outer val1 val1}" + + " \n3: newouter/new2/new2-newouter/new2/new2: { newouter new2 new2}" + + " \n4: newouter/val2/val2-newouter/val2/val2: { newouter val2 val2} ", + "link() will initialize contextual parameters, scoped to the newly linked view (within target container), even when the target container is within data-linked content"); + + // =============================== Arrange =============================== + tmpl = $.templates('{^{:~nm}} {^{:nm}} {^{:~fnprop()}} {^{:fnprop()}} {^{:~fullName()}} {^{:fullName()}} '); + + function fn1() {return "FN1"} + function fn2() {return "FN2"} + + function fullNameVM() { + return this.nm + $.view("#it").ctxPrm("nm") + "Last"; + } + + fullNameVM.depends = ["nm", "~nm"]; + + fullNameVM.set = function(val) { + $.observable(this).setProperty("nm", val.slice(0, -4)); + }; + + function fullNameCtx() { + return this.data.nm + this.ctxPrm("nm") + "Last"; + } + + fullNameCtx.depends = ["nm", "~nm"]; + + fullNameCtx.set = function(val) { + this.ctxPrm("nm", val.slice(0, -4)); + }; + + var data = { + nm: "Jo", + fullName: fullNameVM, + fnprop: fn1 + }, + ctx = { + nm: "Bob", + fullName: fullNameCtx, + fnprop: fn1 + }; + + tmpl.link("#result", data, ctx); + + // ................................ Act .................................. + var message = ""; + + function changeHandler(ev, eventArgs) { + message += eventArgs.path + "(" + (eventArgs.ctxPrm||"") + "):" + eventArgs.value; + } + + $.observe(data, "nm", changeHandler); + $.observe(data, "fullName", changeHandler); + $.observe($.view("#it"), "~nm", changeHandler); + $.observe($.view("#it"), "~fullName", changeHandler); + + $.view("#it").ctxPrm("nm", "NewCtxProp"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("nm", "NewVmProp"); + $.view("#it").ctxPrm("fnprop", fn2); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fnprop", fn2); + $.view("#it").ctxPrm("fullName", "NewCtxFullname"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fullName", "NewVmFullname"); + + // ............................... Assert ................................. + assert.equal($("#result").text(), isIE8 + ? "NewCtxFullNewVmFullFN2FN2NewVmFullNewCtxFullLastNewVmFullNewCtxFullLast " + : "NewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", + "Observe computed with both data and contextual parameters as depends paths"); + + // ............................... Assert ................................. + assert.equal(message, "_ocp(nm):NewCtxPropnm():NewVmProp_ocp(nm):NewCtxFull_ocp(fullName):NewVmPropNewCtxFullLastnm():NewVmFullfullName():NewVmFullNewCtxFullLast", + "Observe listener registered for props and computed props, and ctxPrm listener registered for contextual parameters and computed contextual parameters. Trigger correctly."); + + // =============================== Arrange =============================== + tmpl = $.templates('{^{:~nm}} {^{:nm}} {^{:~fnprop()}} {^{:fnprop()}} {^{:~fullName()}} {^{:fullName()}} '); + + function fullNameHlp() { + return this.data.nm + this.ctxPrm("nm") + "Last"; + } + + fullNameHlp.depends = ["nm", "~nm"]; + + fullNameHlp.set = function(val) { + this.ctxPrm("nm", val.slice(0, -4)); + }; + + $.views.helpers({ + nm: "Jim", + fnprop: fn1, + fullName: fullNameHlp + }); + + data = { + nm: "Jo", + fullName: fullNameVM, + fnprop: fn1 + }; + + tmpl.link("#result", data); + + // ................................ Act .................................. + var message = ""; + + $.observe(data, "nm", changeHandler); + $.observe(data, "fullName", changeHandler); + $.observe($.view("#it"), "~nm", changeHandler); + $.observe($.view("#it"), "~fullName", changeHandler); + + $.view("#it").ctxPrm("nm", "NewCtxProp"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("nm", "NewVmProp"); + $.view("#it").ctxPrm("fnprop", fn2); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fnprop", fn2); + $.view("#it").ctxPrm("fullName", "NewCtxFullname"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fullName", "NewVmFullname"); + + // ............................... Assert ................................. + var fnctions = fullNameHlp === $.views.helpers.fullName && fn1 === $.views.helpers.fnprop; // Make sure helper function have not been replaced by ctxPrm() call + assert.equal(fnctions + $("#result").text(), isIE8 + ? "trueNewCtxFullNewVmFullFN2FN2NewVmFullNewCtxFullLastNewVmFullNewCtxFullLast " + : "trueNewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", + "Observe registered computed helper with both data and contextual parameters as depends paths"); + + // ............................... Assert ................................. + assert.equal(message, "_ocp(nm):NewCtxPropnm():NewVmProp_ocp(nm):NewCtxFull_ocp(fullName):NewVmPropNewCtxFullLastnm():NewVmFullfullName():NewVmFullNewCtxFullLast", + "Observe listener registered for props and computed props, and ctxPrm listener registered for contextual parameters and computed contextual parameters. Trigger correctly."); + // ................................ Act .................................. + + // =============================== Arrange =============================== + + $("#result").empty(); + + $.views.helpers({ + nm: null, + fnprop: null, + fullName: null + }); + + tmpl = $.templates('{^{:~nm}} {^{:nm}} {^{:~fnprop()}} {^{:fnprop()}} {^{:~fullName()}} {^{:fullName()}} '); + + $.views.helpers({ + nm: "Jim", + fnprop: fn1, + fullName: fullNameHlp + }, tmpl); // local to tmpl + + data = { + nm: "Jo", + fullName: fullNameVM, + fnprop: fn1 + }; + + tmpl.link("#result", data); + + // ................................ Act .................................. + var message = ""; + + $.observe(data, "nm", changeHandler); + $.observe(data, "fullName", changeHandler); + $.observe($.view("#it"), "~nm", changeHandler); + $.observe($.view("#it"), "~fullName", changeHandler); + + $.view("#it").ctxPrm("nm", "NewCtxProp"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("nm", "NewVmProp"); + $.view("#it").ctxPrm("fnprop", fn2); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fnprop", fn2); + $.view("#it").ctxPrm("fullName", "NewCtxFullname"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fullName", "NewVmFullname"); + + // ............................... Assert ................................. + fnctions = fullNameHlp === tmpl.helpers.fullName && fn1 === tmpl.helpers.fnprop; // Make sure helper function have not been replaced by ctxPrm() call + assert.equal(fnctions + $("#result").text(), isIE8 + ? "trueNewCtxFullNewVmFullFN2FN2NewVmFullNewCtxFullLastNewVmFullNewCtxFullLast " + : "trueNewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", + "Observe registered computed helper, local to template, with both data and registered helper contextual parameters as depends paths"); + + // ............................... Assert ................................. + assert.equal(message, "_ocp(nm):NewCtxPropnm():NewVmProp_ocp(nm):NewCtxFull_ocp(fullName):NewVmPropNewCtxFullLastnm():NewVmFullfullName():NewVmFullNewCtxFullLast", + "Observe listener registered for props and computed props, and ctxPrm listener registered for contextual parameters and computed contextual parameters. Trigger correctly."); + // ................................ Act .................................. + + message = ""; + res = ""; + + function listeners() { + res += $._data(data).events.propertyChange.length + + $._data($.view("#it")._ocps.nm[0]).events.propertyChange.length + + $._data($.view("#it")._ocps.fullName[0]).events.propertyChange.length + "|"; + } + + listeners(); + $.unobserve(data, "nm", changeHandler); + listeners(); + $.unobserve(data, "fullName", changeHandler); + listeners(); + $.unobserve($.view("#it"), "~nm", changeHandler); + listeners(); + $.unobserve($.view("#it"), "~fullName", changeHandler); + listeners(); + + $.view("#it").ctxPrm("nm", "AddCtxProp"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("nm", "AddVmProp"); + $.view("#it").ctxPrm("fnprop", fn1); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fnprop", fn1); + $.view("#it").ctxPrm("fullName", "AddCtxFullname"); // Get this to work for triggering computed function helper change + $.observable(data).setProperty("fullName", "AddVmFullname"); + + // ............................... Assert ................................. + assert.equal(message === "" && res, "14|13|11|10|9|", + "Unobserve programmatic APIs for data and for contextual parameters works correctly. Event handlers removed, and no longer triggered"); + + // ............................... Assert ................................. + assert.equal($("#result").text(), isIE8 + ? "AddCtxFullAddVmFullFN1FN1AddVmFullAddCtxFullLastAddVmFullAddCtxFullLast " + : "AddCtxFull AddVmFull FN1 FN1 AddVmFullAddCtxFullLast AddVmFullAddCtxFullLast ", + "After removing programmatically attached handlers for data and for contextual parameters, declarative UI handlers work correctly"); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("$.view() in element-only content", function(assert) { + + // =============================== Arrange =============================== + $.link.tmplHierarchyElCnt("#result", topData); + + // ................................ Act .................................. + var view = $.view("#tr1"); + + // ............................... Assert ................................. + assert.ok(view.ctxPrm("val") === 1 && view.type === "myWrapElCnt", 'Within element-only content, $.view(elem) gets nearest parent view. Custom tag blocks are of type "tmplName"'); + + // ................................ Act .................................. + view = $.view("#tr1", "root"); + + // ............................... Assert ................................. + assert.ok(view.parent.type === "top", '$.view(elem, "root") gets root view (child of top view)'); + + // ................................ Act .................................. + view = $.view("#tr1", "item"); + + // ............................... Assert ................................. + assert.ok(view.type === "item" && view.data.lastName === "One" && view.index === 0, 'Within element-only content, $.view(elem, "item") gets nearest item view'); + + // ................................ Act .................................. + view = $.view("#sp1", "item"); + + // ............................... Assert ................................. + assert.ok(view.type === "item" && view.data.lastName === "One" && view.index === 0, '$.view(elem, "item") gets nearest item view, up through both elCnt and regular content views'); + + // ................................ Act .................................. + view = $.view("#tr1", "data"); + + // ............................... Assert ................................. + assert.ok(view.type === "data" && view.data === topData, 'Within element-only content, $.view(elem, "data") gets nearest data view'); + + // ................................ Act .................................. + view = $.view("#tr1", "if"); + + // ............................... Assert ................................. + assert.ok(view.type === "if" && view.data === people[0], 'Within element-only content, $.view(elem, "if") gets nearest "if" view'); + + // ................................ Act .................................. + view = $.view("#tr1", "array"); + + // ............................... Assert ................................. + assert.ok(view.type === "array" && view.data === people, 'Within element-only content, $.view(elem, "array") gets nearest array view'); + + // ................................ Act .................................. + view = $.view("#sp1", "myWrapElCnt"); + + // ............................... Assert ................................. + assert.ok(view.type === "myWrapElCnt" && view.ctx.tag.tagName === "myWrapElCnt", 'Within element-only content, $.view(elem, "mytagName") gets nearest view for content of that tag'); + + // ................................ Act .................................. + view = $.view("#td1"); + + // ............................... Assert ................................. + assert.ok(view.type === "if" && view.ctx.tag.tagName === "myWrapElCnt", 'Within {{if}} block, $.view(elem) gets nearest "if" view, but view.ctx.tag is the nearest non-flow tag, i.e. custom tag that does not have flow set to true'); + + // ................................ Act .................................. + view = $.view("#spInFlow1"); + + // ............................... Assert ................................. + assert.ok(view.type === "myFlowElCnt" && view.ctx.tag.tagName === "myWrapElCnt", 'Within {{myFlow}} block, for a flow tag, $.view(elem) gets nearest "myFlow" view, but view.ctx.tag is the nearest non-flow tag'); + + // ................................ Act .................................. + view = $.view("#tr1", true); + + // ............................... Assert ................................. + assert.ok(view.type === "myWrap2ElCnt", 'Within element-only content, $.view(elem, true) gets the first nested view. Custom tag blocks are of type "tmplName"'); + + // ................................ Act .................................. + view = $.view("#tr1", true, "myFlowElCnt"); + + // ............................... Assert ................................. + assert.ok(view.type === "myFlowElCnt", 'Within element-only content, $.view(elem, true, "mytagName") gets the first (depth first) nested view of that type'); + + // ................................ Act .................................. + view = $.view("#tr1").get(true); + + // ............................... Assert ................................. + assert.ok(view.type === "myWrap2ElCnt", 'Within element-only content, view.get(true) gets the first nested view. Custom tag blocks are of type "tmplName"'); + + // ................................ Act .................................. + view = $.view("#tr1").get(true, "myFlowElCnt"); + + // ............................... Assert ................................. + assert.ok(view.type === "myFlowElCnt", 'Within element-only content, view.get(true, "mytagName") gets the first (depth first) nested view of that type'); + + // ................................ Act .................................. + view = $.view("#tr1"); + + // ............................... Assert ................................. + assert.ok(view.type === "myWrapElCnt" && view === view.get("myWrapElCnt"), 'view.get("viewTypeName") gets nearest viewTypeName view looking at ancestors starting from the view itself'); + + // ............................... Assert ................................. + assert.ok(view === view.get(true, "myWrapElCnt"), 'view.get(true, "viewTypeName") gets nearest viewTypeName view looking at descendants starting from the view itself'); + + // ................................ Act .................................. + view = $.view("#tr1").get(true, "myFlowElCnt"); + + // ............................... Assert ................................. + assert.ok(view.tmpl.markup === "xx{{if true}}{{myFlow2/}}{{/if}}", 'view.get(true, "viewTypeName") gets nearest viewTypeName view looking at descendants starting from the view itself'); + + // ................................ Act .................................. + view = $.view("#tr1").get(true, "myFlow2"); + + // ............................... Assert ................................. + assert.ok(view.tmpl.markup === "flow2", 'view.get(true, "viewTypeName") gets nearest viewTypeName view looking at descendants starting from the view itself'); + + // ............................... Assert ................................. + assert.ok($.view("#tr1").get(true, "nonexistent") === undefined, 'view.get(true, "viewTypeName") returns undefined if no descendant of that type, starting from the view itself'); + + // =============================== Arrange =============================== + + var data = []; + + $("#result").html("
                    "); + + $.templates("").link("#result ul", data); + + // ................................ Act .................................. + view = $.view("#result ul", true); + + // ............................... Assert ................................. + assert.ok(view.data === data && view.type === "array", + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true) returns the array view (even though the element is empty)'); + + // ................................ Act .................................. + var itemView = $.view("#result ul", true, "item"); + + // ............................... Assert ................................. + assert.ok(!itemView, + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true, "item") returns nothing'); + + // =============================== Arrange =============================== + + data = [1]; + + $("#result").html("
                      "); + + $.templates("").link("#result ul", data); + + // ................................ Act .................................. + view = $.view("#result ul", true); + + // ............................... Assert ................................. + assert.ok(view.data === data && view.type === "array", + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true) returns the array view (even though the container element is empty)'); + + // ................................ Act .................................. + itemView = $.view("#result ul", true, "item"); + + // ............................... Assert ................................. + assert.ok(itemView.index === 0, + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true, "item") returns the item view (even though the container element is empty)'); + + // =============================== Arrange =============================== + + data = {people: []}; + + $.templates("
                        {{for people}}{{/for}}
                      ").link("#result", data); + + // ................................ Act .................................. + view = $.view("#result ul", true); + + // ............................... Assert ................................. + assert.ok(view.data === data.people && view.type === "array", + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true) returns the array view (even though the element is empty)'); + + // ................................ Act .................................. + itemView = $.view("#result ul", true, "item"); + + // ............................... Assert ................................. + assert.ok(!itemView, + 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true, "item") returns nothing'); + + // =============================== Arrange =============================== + + data = {people: [1]}; + + $.templates("
                        {{for people}}{{/for}}
                      ").link("#result", data); + + // ................................ Act .................................. + view = $.view("#result ul", true); + + // ............................... Assert ................................. + assert.ok(view.data === data.people && view.type === "array", + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true) returns the array view (even though the container element is empty)'); + + // ................................ Act .................................. + itemView = $.view("#result ul", true, "item"); + + // ............................... Assert ................................. + assert.ok(itemView.index === 0, + 'If elem is a container for a rendered array rendering nothing, and the array is not empty, $.view(elem, true, "item") returns the item view (even though the container element is empty)'); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("view.get() and view.getIndex() in element-only content", function(assert) { + + // =============================== Arrange =============================== + $.link.tmplHierarchyElCnt("#result", topData); + + var view1 = $.view("#tr1"); + + // ................................ Act .................................. + var view = view1.get(); + + // ............................... Assert ................................. + assert.ok(view === view1.parent, 'In element-only content, view.get() gets parent view'); + + // ................................ Act .................................. + view = view1.get("item"); + + // ............................... Assert ................................. + assert.ok(view.type === "item" && view.data.lastName === "One" && view.index === 0, 'In element-only content, view.get("item") gets nearest item view'); + + // ................................ Act .................................. + view = view1.get("myWrapElCnt"); + + // ............................... Assert ................................. + assert.ok(view.ctxPrm("val") === 1 && view.type === "myWrapElCnt", 'In element-only content, view.get("viewTypeName") gets nearest viewTypeName view - even if is the nearest view'); + + // ............................... Assert ................................. + assert.ok($.view("#tr1").getIndex() === 0 && $.view("#tr1", "item").index === 0 && $.view("#tr2").getIndex() === 1 && $.view("#tr2", "item").index === 1, + '$.view(elem).getIndex() gets index of nearest item view, up through elCnt views'); + + // ............................... Assert ................................. + assert.ok($.view("#sp1").getIndex() === 0 && $.view("#sp1", "item").index === 0 && $.view("#sp2").getIndex() === 1 && $.view("#sp2", "item").index === 1, + '$.view(elem).getIndex() gets index of nearest item view, up through both elCnt and regular content views'); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.module("API - Tag Controls"); + +QUnit.test("Wrapping", function(assert) { + // =============================== Arrange =============================== + $.templates({ + markup: '{{mytag}}{{:name}}{{/mytag}}' + + '
                      ', + tags: { + mytag: { + render: function(val) { + return "DefaultArg:" + this.tagCtx.args[0].name + "TMPL:" + this.tagCtx.render(val) + "CNT:" + this.tagCtx.content.render(val); + } + } + } + }).link("#result", {name: "Jo"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + "DefaultArg:JoTMPL:JoCNT:Jo" + + "DefaultArg:JoTMPL:JoCNT:Jo", + "If tag has no template, tagCtx.render() and tagCtx.content.render() both render content. arg[0] defaults to current data context."); + + // =============================== Arrange =============================== + $.templates({ + markup: '{{mytag}}{{:name}}{{/mytag}}' + + '
                      ', + tags: { + mytag: { + render: function(val) { + return "TMPL:" + this.tagCtx.render(val) + "CNT:" + this.tagCtx.content.render(val); + }, + template: "1{{include tmpl=#content/}} 2{{include tmpl=~tagCtx.content/}} 3{{:~tagCtx.args[0].name}} " + } + } + }).link("#result", {name: "Jo"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + "TMPL:1Jo 2Jo 3Jo CNT:Jo" + + "TMPL:1Jo 2Jo 3Jo CNT:Jo", + "If tag has a template, tagCtx.render() renders template and tagCtx.content.render() renders content"); + + // =============================== Arrange =============================== + $.templates({ + markup: '{{mytag}}a{{:name}}{{else #data}}b{{:name}}{{/mytag}}' + + '
                      ', + tags: { + mytag: { + render: function(val) { + return "TMPL:" + this.tagCtx.render(val) + "CNT:" + this.tagCtx.content.render(val); + }, + template: "1{{include tmpl=#content/}} 2{{include tmpl=~tagCtx.content/}} 3{{:~tagCtx.args[0].name}}{{:~tagCtx.index}} " + } + } + }).link("#result", {name: "Jo"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + + "TMPL:1aJo 2aJo 3Jo0 CNT:aJo" + + "TMPL:1bJo 2bJo 3Jo1 CNT:bJo" + + "TMPL:1aJo 2aJo 3Jo0 CNT:aJo" + + "TMPL:1bJo 2bJo 3Jo1 CNT:bJo", + "If tag has a template, tagCtx.render() renders template and tagCtx.content.render() renders content - also for else blocks"); + + // =============================== Arrange =============================== + $.templates({ + markup: '{{mytag}}{{:name}}{{/mytag}}' + + '
                      ', + tags: { + mytag: { + render: function(val) { + var val = this.tagCtx.view.data; + return "DefaultArg:" + !!this.tagCtx.args[0] + "TMPL:" + this.tagCtx.render(val) + "CNT:" + this.tagCtx.content.render(val); + }, + init: function() { + this.argDefault = false; + } + } + } + }).link("#result", {name: "Jo"}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + "DefaultArg:falseTMPL:JoCNT:Jo" + + "DefaultArg:falseTMPL:JoCNT:Jo", + "If argDefault is false, arg[0] does not default to current data context. But can programmatically pass in data to tagCtx.render() or tagCtx.content.render()"); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("view.childTags() and tag.childTags()", function(assert) { + + // =============================== Arrange =============================== + $.link.boundTmplHierarchy("#result", topData); + + var tags, + view1 = $.view("#result", true, "item"); + + // ................................ Act .................................. + + tags = view1.childTags(); + + // ............................... Assert ................................. + assert.ok(tags.length === 4 + && tags[0].tagName === "myWrap" && tags[0].tagCtx.props.val === 1 && tags[0].tagCtx.view.getIndex() === 0 && + tags[1].tagName === "myWrap" && tags[1].tagCtx.props.val === 2 && tags[1].tagCtx.view.getIndex() === 0 && + tags[2].tagName === "mySimpleWrap" && + tags[3].tagName === "myWrap2", + 'view.childTags() returns top-level bound tags within the view, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags(true); + + // ............................... Assert ................................. + assert.ok(tags.length === 8 + && tags[0].tagName === "myWrap" + && tags[1].tagName === "myWrap2" + && tags[2].tagName === "myWrap2" + && tags[3].tagName === "myWrap" + && tags[4].tagName === "mySimpleWrap" + && tags[5].tagName === "mySimpleWrap" + && tags[6].tagName === "myWrap2" + && tags[7].tagName === "myWrap2" + && tags[0].tagCtx.props.val === 1 && tags[0].tagCtx.view.getIndex() === 0, + 'view.childTags(true) returns all tags within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags("myWrap"); + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrap" && tags[1].tagName === "myWrap" && tags[0].tagCtx.props.val === 1 && tags[0].tagCtx.view.getIndex() === 0, + 'view.childTags("mytagName") returns all top-level tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags(true, "myWrap2"); + + // ............................... Assert ................................. + assert.ok(tags.length === 4 + && tags[0].tagName === "myWrap2" + && tags[1].tagName === "myWrap2" + && tags[2].tagName === "myWrap2" + && tags[3].tagName === "myWrap2" + && tags[0].tagCtx.view.getIndex() === 0, + 'view.childTags(true, "mytagName") returns all tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags("myWrap2"); + + // ............................... Assert ................................. + assert.ok(tags.length === 1 + && tags[0].tagName === "myWrap2", + 'view.childTags(true, "mytagName") returns all tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.get(true, "myWrap").childTags(); // Get first myWrap view and look for its top-level child tags + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrap2" && tags[1].tagName === "myWrap2" && tags[1].tagCtx.view.getIndex() === 0, + 'tag.childTags() returns top-level bound child tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.get(true, "myWrap").childTags(true); // Get first myWrap view and look for descendant tags + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrap2" && tags[1].tagName === "myWrap2", + 'tag.childTags(true) returns descendant tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags("myWrap")[0].childTags(); // Get first myWrap tag and look for its top-level child tags + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrap2" && tags[1].tagName === "myWrap2" && tags[1].tagCtx.view.getIndex() === 0, + 'tag.childTags() returns top-level bound child tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags("myWrap")[0].childTags(true); // Get first myWrap tag and look for descendant tags + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrap2" && tags[1].tagName === "myWrap2", + 'tag.childTags(true) returns descendant tags, and skips any unbound tags'); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("view.childTags() in element-only content", function(assert) { + + // =============================== Arrange =============================== + $.link.boundTmplHierarchyElCnt("#result", topData); + + var tags, + view1 = $.view("#result", true, "item"); + + // ................................ Act .................................. + tags = view1.childTags(); + + // ............................... Assert ................................. + assert.ok(tags.length === 4 && tags[0].tagName === "myWrapElCnt" && tags[0].tagCtx.props.val === 1 && tags[0].tagCtx.view.getIndex() === 0 + && tags[1].tagName === "myWrapElCnt" && tags[1].tagCtx.props.val === 2 && tags[1].tagCtx.view.getIndex() === 0 + && tags[2].tagName === "mySimpleWrap" && tags[2].tagCtx.props.val === 5 && tags[2].tagCtx.view.getIndex() === 0, + 'In element-only content, view.childTags() returns top-level bound non-flow tags within the view, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags(true); + + // ............................... Assert ................................. + assert.ok(tags.length === 9 + && tags[0].tagName === "myWrapElCnt" + && tags[1].tagName === "myWrap2ElCnt" + && tags[2].tagName === "mySimpleWrap" + && tags[3].tagName === "myWrap2ElCnt" + && tags[4].tagName === "myWrapElCnt" + && tags[5].tagName === "mySimpleWrap" + && tags[6].tagName === "mySimpleWrap" + && tags[7].tagName === "myWrap2" + && tags[8].tagName === "myWrap2ElCnt" + && tags[0].tagCtx.props.val === 1 && tags[0].tagCtx.view.getIndex() === 0, + 'In element-only content, view.childTags(true) returns all bound non-flow tags within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags("myWrapElCnt"); + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrapElCnt" && tags[1].tagName === "myWrapElCnt" && tags[0].tagCtx.props.val === 1 && tags[0].tagCtx.view.getIndex() === 0, + 'In element-only content, view.childTags("mytagName") returns all top-level bound tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags(true, "myWrap2ElCnt"); + + // ............................... Assert ................................. + assert.ok(tags.length === 3 + && tags[0].tagName === "myWrap2ElCnt" + && tags[1].tagName === "myWrap2ElCnt" + && tags[1].tagName === "myWrap2ElCnt" + && tags[0].tagCtx.view.getIndex() === 0, + 'In element-only content, view.childTags(true, "mytagName") returns all bound tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags(true, "myFlow"); + + // ............................... Assert ................................. + assert.ok(tags.length === 2 + && tags[0].tagName === "myFlow" + && tags[1].tagName === "myFlow" + && tags[1].tagCtx.view.getIndex() === 0, + 'In element-only content, view.childTags(true, "myFlow") for a flow tag returns all bound tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags(true, "if"); + + // ............................... Assert ................................. + assert.ok(tags.length === 1 + && tags[0].tagName === "if" + && tags[0].tagCtx.view.getIndex() === 0, + 'In element-only content, view.childTags(true, "if") for a flow tag ("if" in this case) returns all bound tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags("myWrap2ElCnt"); + + // ............................... Assert ................................. + assert.ok(tags.length === 1, 'In element-only content, view.childTags("mytagName") returns all top-level tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.get(true, "myWrapElCnt").childTags(); // Get first myWrapElCnt view and look for its top-level child tags + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrap2ElCnt" && tags[1].tagName === "myWrap2ElCnt" && tags[1].tagCtx.view.getIndex() === 0, + 'view.childTags() returns top-level bound child tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.get(true, "myWrapElCnt").childTags(true); // Get first myWrapElCnt view and look for descendant tags + + // ............................... Assert ................................. + assert.ok(tags.length === 3 && tags[0].tagName === "myWrap2ElCnt" && tags[1].tagName === "mySimpleWrap" && tags[2].tagName === "myWrap2ElCnt", + 'view.childTags(true) returns descendant tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags("myWrapElCnt")[0].childTags(); // Get first myWrapElCnt tag and look for its top-level child tags + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrap2ElCnt" && tags[1].tagName === "myWrap2ElCnt" && tags[1].tagCtx.view.getIndex() === 0, + 'tag.childTags() returns top-level bound child tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags("myWrapElCnt")[0].childTags(true); // Get first myWrapElCnt tag and look for descendant tags + + // ............................... Assert ................................. + assert.ok(tags.length === 3 && tags[0].tagName === "myWrap2ElCnt" && tags[1].tagName === "mySimpleWrap" && tags[2].tagName === "myWrap2ElCnt", + 'tag.childTags(true) returns descendant tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags("mySimpleWrap")[0].childTags(); // Get first mySimpleWrap tag and look for its top-level child tags + + // ............................... Assert ................................. + assert.ok(tags.length === 1 && tags[0].tagName === "mySimpleWrap", + 'tag.childTags() returns top-level bound child tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags("mySimpleWrap")[0].childTags(true); // Get first mySimpleWrap tag and look for descendant tags + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "mySimpleWrap" && tags[1].tagName === "myWrap2", + 'tag.childTags(true) returns descendant tags, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags("mySimpleWrap")[0].childTags(true, "myWrap2"); // Get first mySimpleWrap tag and look for descendant tags of type "myWrap2" + + // ............................... Assert ................................. + assert.ok(tags.length === 1 && tags[0].tagName === "myWrap2", + 'tag.childTags(true, "mytagName") returns descendant tags of chosen name, and skips any unbound tags'); + + // =============================== Arrange =============================== + $.templates("{^{for row}}{^{mySimpleWrap/}}{{/for}}
                      ").link("#result", {row: {}}); + + // ................................ Act .................................. + var tag = $("#result tr").view().childTags()[0]; + + // ............................... Assert ................................. + assert.ok(tag.tagName === "mySimpleWrap", + 'childTags() correctly finds tag which has no output and renders within element contet, inside another tag also in element content'); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("view.childTags() in element-only content, using data-link", function(assert) { + + // =============================== Arrange =============================== + $.link.boundTmplHierarchyElCntWithDataLink("#result", person1); + + var tags, + view1 = $.view("#result", true); + // ................................ Act .................................. + tags = view1.childTags(); + + // ............................... Assert ................................. + assert.ok(tags.length === 1 && tags[0].tagName === "myWrapElCnt" && tags[0].tagCtx.props.val === 1, + 'In element-only content, view.childTags() returns top-level bound tags within the view, and skips any unbound tags'); + + // ................................ Act .................................. + tags = view1.childTags(true); + + // ............................... Assert ................................. + assert.ok(tags.length === 2 && tags[0].tagName === "myWrapElCnt" && tags[1].tagName === "myWrap2ElCnt" && tags[0].tagCtx.props.val === 1, + 'In element-only content, view.childTags(true) returns all tags within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags("myWrapElCnt"); + + // ............................... Assert ................................. + assert.ok(tags.length === 1 && tags[0].tagName === "myWrapElCnt" && view1.childTags("inexistantTag").length === 0, + 'In element-only content, view.childTags("mytagName") returns all top-level tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags(true, "myWrap2ElCnt"); + + // ............................... Assert ................................. + assert.ok(tags.length === 1 && tags[0].tagName === "myWrap2ElCnt", + 'In element-only content, view.childTags(true, "mytagName") returns all tags of the given name within the view - in document order'); + + // ................................ Act .................................. + tags = view1.childTags("myWrap2ElCnt"); + + // ............................... Assert ................................. + assert.ok(tags.length === 0, 'In element-only content, view.childTags(true, "mytagName") returns all tags of the given name within the view - in document order'); + + // ............................... Reset ................................. + $("#result").empty(); +}); + +QUnit.test("lateRender - for deferred API calls", function(assert) { + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: +// These calls are before the targeted instance, so need lateRender=true (or any other value than false) +'
                      ' + +'
                      ' + +'/
                      ' + +'{^{for #get(true, \'mytag\').tag.value tmpl=\'showVal\' lateRender=true/}}' + +'{^{for #childTags(\'mytag\')[0].value tmpl=\'showVal\' lateRender=true/}}' + +'/{^{:#childTags(\'mytag\')[0].value lateRender=true}}' + + +// This is the targeted instance +'=
                      ' + + +// These calls are after the targeted instance, so don't need lateRender=true +'
                      ' + +'
                      ' + +'/
                      ' + +// But these following tags still need lateRender=true, so the rendering is also deferred to after linking has been completed +'{^{for #get(true, \'mytag\').tag.value tmpl=\'showVal\' lateRender=true/}}' + +'{^{for #childTags(\'mytag\')[0].value tmpl=\'showVal\' lateRender=true/}}' + +'/{^{:#childTags(\'mytag\')[0].value lateRender=true}}' + +'/{^{mylaterendertag \'mytag\'/}}' + +'/{^{mylaterendertag \'mytag\' lateRender=false/}}', + tags: { + mytag: { + template: 'MyTag', + value: 'tagVal' + }, + mylaterendertag: { + render: function() { + return this.tagCtx.view.childTags(this.tagCtx.args[0]) .length; + }, + lateRender: 1 // This will render late, unless lateRender=false on the instance markup + } + }, + templates: { + showVal: '-{{:}}' + } + }).link("#result", {}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "-tagVal-tagVal/tagVal-tagVal-tagVal/tagVal=MyTag-tagVal-tagVal/tagVal-tagVal-tagVal/tagVal/1/0", + "When using APIs such as #childTags() and #get() within binding expressions, to return tag instances, use lateRender=true to defer the API call until linking is complete" ); + + // ................................ Act .................................. + $.templates({ + markup: +// These calls are before the targeted instance, so need lateRender=true +'
                      ' + +'/
                      ' + +'{^{for #get(true, \'mytag\').tag.value tmpl=\'showVal\' lateRender=undefined/}}' + +'{^{for #childTags(\'mytag\')[0].value tmpl=\'showVal\' lateRender=null/}}' + + +// This is the targeted instance +'={^{mytag/}}', + tags: { + mytag: { + template: 'MyTag', + value: 'tagVal' + } + }, + templates: { + showVal: '-{{:}}' + } + }).link("#result", {}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "-tagVal/tagVal-tagVal-tagVal=MyTag", + "When using APIs such as #childTags() and #get() within binding expressions, to return tag instances, use lateRender=xxx (any value xxx other than false or undefined) to defer the API call until linking is complete" ); + + // ................................ Act .................................. +var myTmpl = $.templates({ + markup: +// These calls are before the targeted instance, so need lateRender=true +'
                      ' + + +// This is the targeted instance +'={^{mytag/}}', + tags: { + mytag: { + template: 'MyTag', + value: 'tagVal' + } + }, + templates: { + showVal: '-{{:}}' + } + }); + +var haserror; +try { + myTmpl.link("#result", {}); +} catch(e) { + haserror = !!e; +} + // ............................... Assert ................................. + assert.ok(haserror, + "When using APIs such as #childTags() within binding expressions, using lateRender=false does not defer the API call" ); + + // ................................ Reset ................................ + $("#result").empty(); + +}); + +QUnit.test("this= and @some.path", function(assert) { + $.views.settings.trigger(false); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: +'' + +'BEFORE:{^{:@~o1.tagCtx.props.p}}' + +'' + + +'TAGS:' + +'{^{if this=~o2 ^p=@~o3.tagCtx.props.n n="two "}}B{{/if}}' + +'{^{if this=~o3 ^p=@~o1.tagCtx.props.n n="three "}}C{{/if}}' + + +'AFTER:{^{:@~o1.tagCtx.props.p}}' + +'' + +'', + tags: { + out: { + template: "OUT:{^{:~tagCtx.props.p}}", + onUpdate: false, + } + } + }).link("#result", {}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), +"BEFORE:two two TAGS:DBCAFTER:two two ", + "Declarative this=ref binding on built-in flow tag and late path @ref... works correctly"); + + // ................................ Act .................................. + $.templates({ + markup: +'' + +'BEFORE:{^{:@~o1.tagCtx.props.p}}' + +'' + + +'TAGS:' + +'{^{out this=~o2 ^p=@~o3.tagCtx.props.n n="two "/}}' + +'{^{out this=~o3 ^p=@~o1.tagCtx.props.n n="three "/}}' + + +'AFTER:{^{:@~o1.tagCtx.props.p}}' + +'' + +'', + tags: { + out: { + template: "OUT:{^{:~tagCtx.props.p}}", + onUpdate: false, + } + } + }).link("#result", {}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), "BEFORE:two two TAGS:OUT:two OUT:three OUT:one AFTER:two two ", + "Declarative this=ref binding on custom tag and late path @ref... works correctly"); + + // ................................ Act .................................. + var input1 = $("#inp1"), + input2 = $("#inp1"), + result = ""; + + input1.val("newp "); + input1.change(); + + result += $("#result").text(); + + input2.val("newp2 "); + input2.change(); + result += "|" + $("#result").text(); + + assert.equal(result, "BEFORE:newp newp TAGS:OUT:newp OUT:three OUT:one AFTER:newp newp |BEFORE:newp2 newp2 TAGS:OUT:newp2 OUT:three OUT:one AFTER:newp2 newp2 ", + "Declarative this=ref binding on custom tag and late path @ref... works correctly even for two-way binding"); + + // ................................ Reset ................................ + $("#result").empty(); + + $.views.settings.trigger(true); +}); + +//TODO add tests for tag.refresh() + +QUnit.test("Modifying content, initializing widgets/tag controls, using data-link", function(assert) { + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: '
                      ', + tags: { + myWidget: { + init: function(tagCtx, linkCtx, ctx) { + }, + render: function() { + return " render"; + }, + onAfterLink: function() { + $(this.linkCtx.elem).append(" after"); + } + } + } + }).link("#result", person1); + + // ............................... Assert ................................. + assert.equal($("#result div").html().replace(isIE8 ? /\r\n<\/SCRIPT>|\r\n/g : /<\/script>/g, ""), isIE8 ? "render after" : " render after", 'A data-linked tag control allows setting of content on the data-linked element during render and onAfterLink'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: '
                      ', + tags: { + myRenderInLinkEventsWidget: { + init: function(tagCtx, linkCtx, ctx) { + $(linkCtx.elem).append(" init"); + }, + onAfterLink: function() { + $(this.linkCtx.elem).append(" after"); + } + } + } + }).link("#result", person1); + + // ............................... Assert ................................. + assert.equal($("#result div").html(), " init after", 'A data-linked tag control which does not render allows setting of content on the data-linked element during init and onAfterLink'); + + // ............................... Reset ................................. + $("#result").empty(); + //TODO: Add tests for attaching jQuery UI widgets or similar to tag controls, using data-link and {^{mytag}} inline data binding. +}); + +QUnit.test('two-way bound tag controls', function(assert) { +var done = assert.async(); + +$.views.settings.trigger(false); + + // =============================== Arrange =============================== + var person = {name: "Jo"}; + + cancelChange = false; + noRenderOnUpdate = true; + renders = false; + eventData = ""; + + //TODO add tests for convert and convertBack declared on tag def or on tag instance and declared dependencies on tag and/or convert - either arrays or functions. + // ELEMENT-BASED DATA-LINKED TAGS ON INPUT + // ................................ Act .................................. + $.templates('') + .link("#result", person); + + var tag = $("#result").view(true).childTags("twoWayTag")[0], + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(eventData, "init render onBind onAfterLink ", + 'Data link using: - event order for init, render, link'); + eventData = ""; + + // ................................ Act .................................. + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName"}); + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeChange onUpdate onAfterLink onAfterChange ", + 'Data link using: - event order for onUpdate (returning false) - render not called'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "JoJo|newNamenewName", + 'Data link using: - binds data to linkedElem'); + + // ................................ Act .................................. + noRenderOnUpdate = false; + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName2"}); + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeChange onUpdate onUnbind render onBind onAfterLink onAfterChange ", + 'Data link using: - event order for onUpdate (returning true) - render is called, but no render'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newNamenewName|newName2newName2", + 'Data link using: - binds data to linkedElem'); + + // ................................ Act .................................. + noRenderOnUpdate = false; + renders = true; + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName3"}); + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeChange onUpdate onUnbind render onBind onAfterLink onAfterChange ", + 'Data link using: - event order for onUpdate (returning true) - render is called'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newName2newName2|newName3newName3", + 'Data link using: - binds data to linkedElem - (replacing any value set during rendering)'); + + // ................................ Reset .................................. + noRenderOnUpdate = true; + renders = false; + + // ................................ Act .................................. + before = tag.value + person.name; + linkedEl.value = "newVal"; + $(linkedEl).change(); + after = tag.value + person.name; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal onBeforeChange onUpdate onAfterLink onAfterChange ", + 'Data link using: - event order for onChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newName3newName3|newValnewVal", + 'Data link using: - binds linkedElem back to data'); + + // ................................ Act .................................. + before = tag.value + person.name; + cancelChange = true; + linkedEl.value = "2ndNewVal"; + $(linkedEl).change(); + after = tag.value + person.name; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal onBeforeChange ", + 'Data link using: - event order for cancelled onBeforeChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newValnewVal|newVal2ndNewVal", + 'Data link using: - if onBeforeChange returns false -> data changes but no relinking of tag'); + + // ................................ Reset .................................. + cancelChange = false; + cancelUpdate = true; + + // ................................ Act .................................. + before = tag.value + person.name; + linkedEl.value = "3rdNewVal"; + $(linkedEl).change(); + after = tag.value + person.name; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal ", + 'Data link using: - event order for cancelled onBeforeUpdateVal'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newVal2ndNewVal|newVal2ndNewVal", + 'Data link using: - if onBeforeUpdateVal returns false -> data does not change, and no relinking of tag'); + + // ................................ Reset .................................. + cancelUpdate = false; + noRenderOnUpdate = true; + renders = false; + + // ................................ Act .................................. + person.name = "updatedName"; + linkedEl.value = "updatedVal"; + before = tag.value + linkedEl.value; + tag.refresh(); + linkedEl = $("#linkedElm")[0]; + after = tag.value + linkedEl.value + tag.linkedElem[0].value; + + // ............................... Assert ................................. + assert.equal(eventData, "onUnbind render onBind onAfterLink ", + 'Data link using: - event order for tag.refresh'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newValupdatedVal|updatedNameupdatedNameupdatedName", + 'Data link using: - tag.refresh() calls render and onAfterLink - reset to current data, and updates target (input value)'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(eventData, "onUnbind onDispose ", + 'Data link using: - event order for onDispose'); + eventData = ""; + + // ................................ Reset .................................. + person.name = "Jo"; + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: '', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "JO|Jo", + 'Data link using: - (tag.convert setting) - initial linking: converts the value on the target input'); + + // ................................ Act .................................. + $.observable(person).setProperty({name: "ANewName"}); + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "ANEWNAME|ANewName", + 'Data link using: - (tag.convert setting) - on data change: converts the value on the target input'); + + // ................................ Act .................................. + linkedEl.value = "ChangeTheName"; + $(linkedEl).change(); + + // ............................... Assert ................................. + assert.equal(person.name + "|" + tag.value, + "changethename|changethename", + 'Data link using: - (tag.convertBack setting) on element change: converts the data, and sets on data'); + + // ................................ Reset .................................. + $("#result").empty(); + person.name = "Jo"; + cancelChange = false; + cancelUpdate = false; + noRenderOnUpdate = true; + renders = false; + eventData = ""; + + // =============================== Arrange =============================== + + var lower = function(val) { + return val.toLowerCase(); + }, + upper = function(val) { + return val.toUpperCase(); + }, + options = {cvt: upper}; + + // ................................ Act .................................. + $.templates({ + markup: '', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, {options: options}); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "JO|Jo", + 'Data link using: - converter specified by data-linked convert property'); + + // ................................ Act .................................. + $.observable(options).setProperty({cvt: lower}); + $.observable(person).setProperty({name: "ANewName"}); + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "anewname|ANewName", + 'Data link using: - data-linked swapping of converter from one function to another'); + + // ................................ Act .................................. + $.observable(options).setProperty({cvt: "myupper"}); + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "ANEWNAME|ANewName", + 'Data link using: - data-linked swapping of converter from function to named converter'); + + // ................................ Reset .................................. + $("#result").empty(); + person.name = "Jo"; + cancelChange = false; + noRenderOnUpdate = true; + renders = false; + eventData = ""; + + // =============================== Arrange =============================== + //INLINE DATA-LINKED TAGS ON INPUT + // ................................ Act .................................. + $.templates('{^{twoWayTag name}}{{/twoWayTag}}') + .link("#result", person); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(eventData, "init render onBind onAfterLink ", + 'Data link using: {^{twoWayTag name}} - event order for init, render, link'); + eventData = ""; + + // ................................ Act .................................. + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName"}); + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(eventData + !!linkedEl.parentNode, "onBeforeChange onUpdate onAfterLink onAfterChange true", + 'Data link using: {^{twoWayTag name}} - event order for onUpdate (returning false) - render not called; linkedElem not replaced'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "JoJo|newNamenewName", + 'Data link using: {^{twoWayTag name}} - binds data to linkedElem'); + + // ................................ Act .................................. + noRenderOnUpdate = false; + before = tag.value + linkedEl.value; + $.observable(person).setProperty({name: "newName2"}); + + // ............................... Assert ................................. + assert.equal(eventData + !!linkedEl.parentNode, "onBeforeChange onUpdate onUnbind render onBind onAfterLink onAfterChange false", + 'Data link using: {^{twoWayTag name}} - event order for onUpdate (returning true) - render is called; linkedElem is replaced'); + eventData = ""; + + linkedEl = $("#linkedElm")[0]; + after = tag.value + linkedEl.value; + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newNamenewName|newName2newName2", + 'Data link using: {^{twoWayTag name}} - binds data to linkedElem'); + + // ................................ Act .................................. + noRenderOnUpdate = false; + renders = true; + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName3"}); + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(eventData + !!linkedEl.parentNode, "onBeforeChange onUpdate onUnbind render onBind onAfterLink onAfterChange false", + 'Data link using: {^{twoWayTag name}} - event order for onUpdate (returning true) - render is called; linkedElem is replaced'); + eventData = ""; + + linkedEl = $("#linkedElm")[0]; + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newName2newName2|newName3newName3", + 'Data link using: {^{twoWayTag name}} - binds data to newly rendered linkedElem'); + + // ................................ Reset .................................. + noRenderOnUpdate = true; + renders = false; + + // ................................ Act .................................. + before = tag.value + person.name; + linkedEl.value = "newVal"; + $(linkedEl).change(); + after = tag.value + person.name; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal onBeforeChange onUpdate onAfterLink onAfterChange ", + 'Data link using: {^{twoWayTag name}} - event order for onChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newName3newName3|newValnewVal", + 'Data link using: {^{twoWayTag name}} - binds linkedElem back to data'); + + // ................................ Act .................................. + before = tag.value + person.name; + cancelChange = true; + linkedEl.value = "2ndNewVal"; + $(linkedEl).change(); + after = tag.value + person.name; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal onBeforeChange ", + 'Data link using: {^{twoWayTag name}} - event order for cancelled onBeforeChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newValnewVal|newVal2ndNewVal", + 'Data link using: {^{twoWayTag name}} - if onBeforeChange returns false -> data changes but no relinking of tag'); + + // ................................ Reset .................................. + cancelChange = false; + noRenderOnUpdate = true; + renders = false; + + // ................................ Act .................................. + person.name = "updatedName"; + linkedEl.value = "updatedVal"; + before = tag.value + linkedEl.value; + tag.refresh(); + linkedEl = $("#linkedElm")[0]; + after = tag.value + linkedEl.value + tag.linkedElem[0].value; + + // ............................... Assert ................................. + assert.equal(eventData, "onUnbind render onBind onAfterLink ", + 'Data link using: {^{twoWayTag name}} - event order for tag.refresh'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newValupdatedVal|updatedNameupdatedNameupdatedName", + 'Data link using: {^{twoWayTag name}} - tag.refresh() calls onUnbind, render, onBind and onAfterLink - reset to current data, and updates target (input value)'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(eventData, "onUnbind onDispose ", + 'Data link using: {^{twoWayTag name}} - event order for onDispose'); + eventData = ""; + + // ................................ Reset .................................. + person.name = "Jo"; + + // =============================== Arrange =============================== + $.templates({ + markup: '{^{twoWayTag name convert="myupper" convertBack=~lower}}{{/twoWayTag}}', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "JO|Jo", + 'Data link using: {^{twoWayTag name convert=\'myupper\'}} - (tag.convert setting) - initial linking: converts the value on the target input'); + + // ................................ Act .................................. + $.observable(person).setProperty({name: "ANewName"}); + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "ANEWNAME|ANewName", + 'Data link using: {^{twoWayTag name convert=\'myupper\'}} - (tag.convert setting) - on data change: converts the value on the target input'); + + // ................................ Act .................................. + linkedEl = $("#linkedElm")[0]; + linkedEl.value = "ChangeTheName"; + $(linkedEl).change(); + + // ............................... Assert ................................. + assert.equal(person.name + "|" + tag.value, + "changethename|changethename", + 'Data link using: {^{twoWayTag name convertBack=~lower}} - (tag.convertBack setting) on element change: converts the data, and sets on data'); + + // ................................ Reset .................................. + $("#result").empty(); + person.name = "Jo"; + cancelChange = false; + noRenderOnUpdate = true; + renders = false; + eventData = ""; + + // =============================== Arrange =============================== + //INLINE DATA-LINKED SELF-CLOSED TAG rendering INPUT + + // ................................ Act .................................. + $.templates('{^{twoWayTag name/}}') + .link("#result", person); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + + // ............................... Assert ................................. + assert.equal(eventData, "init render onBind onAfterLink ", + 'Data link using: {^{twoWayTag name/}} - event order for init, render, link'); + eventData = ""; + + // ................................ Act .................................. + linkedEl = tag.linkedElem[0]; + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName"}); + after = tag.value + tag.linkedElem[0].value; + + // ............................... Assert ................................. + assert.equal(eventData + !!linkedEl.parentNode, "onBeforeChange onUpdate onAfterLink onAfterChange true", + 'Data link using: {^{twoWayTag name/}} - event order for onUpdate (returning false) - render not called; linkedElem not replaced'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "JoJo|newNamenewName", + 'Data link using: {^{twoWayTag name/}} - binds data to linkedElem'); + + // ................................ Act .................................. + noRenderOnUpdate = false; + linkedEl = tag.linkedElem[0]; + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName2"}); + after = tag.value + tag.linkedElem[0].value; + + // ............................... Assert ................................. + assert.equal(eventData + !!linkedEl.parentNode, "onBeforeChange onUpdate onUnbind render onBind onAfterLink onAfterChange false", + 'Data link using: {^{twoWayTag name/}} - event order for onUpdate (returning true) - render is called; linkedElem is replaced'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newNamenewName|newName2newName2", + 'Data link using: {^{twoWayTag name/}} - binds data to linkedElem'); + + // ................................ Act .................................. + noRenderOnUpdate = false; + renders = true; + linkedEl = tag.linkedElem[0]; + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName3"}); + after = tag.value + tag.linkedElem[0].value; + + // ............................... Assert ................................. + assert.equal(eventData + !!linkedEl.parentNode, "onBeforeChange onUpdate onUnbind render onBind onAfterLink onAfterChange false", + 'Data link using: {^{twoWayTag name/}} - event order for onUpdate (returning true) - render is called; linkedElem is replaced'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newName2newName2|newName3newName3", + 'Data link using: {^{twoWayTag name/}} - binds data to newly rendered linkedElem'); + + // ................................ Reset .................................. + noRenderOnUpdate = true; + renders = false; + + // ................................ Act .................................. + before = tag.value + person.name; + tag.linkedElem[0].value = "newVal"; + tag.linkedElem.change(); + after = tag.value + person.name; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal onBeforeChange onUpdate onAfterLink onAfterChange ", + 'Data link using: {^{twoWayTag name/}} - event order for onChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newName3newName3|newValnewVal", + 'Data link using: {^{twoWayTag name/}} - binds linkedElem back to dataonChange'); + + // ................................ Act .................................. + before = tag.value + person.name; + cancelChange = true; + tag.linkedElem[0].value = "2ndNewVal"; + tag.linkedElem.change(); + after = tag.value + person.name; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal onBeforeChange ", + 'Data link using: {^{twoWayTag name/}} - event order for cancelled onBeforeChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newValnewVal|newVal2ndNewVal", + 'Data link using: {^{twoWayTag name/}} - if onBeforeChange returns false -> data changes but no relinking of tag'); + + // ................................ Reset .................................. + cancelChange = false; + noRenderOnUpdate = true; + renders = false; + + // ................................ Act .................................. + person.name = "updatedName"; + tag.linkedElem[0].value = "updatedVal"; + before = tag.value + tag.linkedElem[0].value; + tag.refresh(); + after = tag.value + tag.linkedElem[0].value; + + // ............................... Assert ................................. + assert.equal(eventData, "onUnbind render onBind onAfterLink ", + 'Data link using: {^{twoWayTag name/}} - event order for tag.refresh'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "newValupdatedVal|updatedNameupdatedName", + 'Data link using: {^{twoWayTag name/}} - tag.refresh() calls render and onAfterLink - reset to current data, and updates target (input value)'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal(eventData, "onUnbind onDispose ", + 'Data link using: {^{twoWayTag name/}} - event order for onDispose'); + eventData = ""; + + // ................................ Reset .................................. + person.name = "Jo"; + + // =============================== Arrange =============================== + $.templates({ + markup: '{^{twoWayTag name convert="myupper" convertBack=~lower/}}', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + + // ............................... Assert ................................. + assert.equal(tag.linkedElem[0].value + "|" + tag.value, + "JO|Jo", + 'Data link using: {^{twoWayTag name convert="myupper"/}} - (tag.convert setting) - initial linking: converts the value on the target input'); + + // ................................ Act .................................. + $.observable(person).setProperty({name: "ANewName"}); + + // ............................... Assert ................................. + assert.equal(tag.linkedElem[0].value + "|" + tag.value, + "ANEWNAME|ANewName", + 'Data link using: {^{twoWayTag name convert="myupper"/}} - (tag.convert setting) - on data change: converts the value on the target input'); + + // ................................ Act .................................. + tag.linkedElem[0].value = "ChangeTheName"; + tag.linkedElem.change(); + + // ............................... Assert ................................. + assert.equal(person.name + "|" + tag.value, + "changethename|changethename", + 'Data link using: {^{twoWayTag name convertBack=~lower/}} - (tag.convertBack setting) on element change: converts the data, and sets on data'); + + // ................................ Reset .................................. + person.name = "Jo"; + person.name2 = "Jo"; + + // =============================== Arrange =============================== + $.templates({ + markup: '{^{textbox name /}} {^{textbox name2 convert="cvt" convertBack=~cvtBk/}}', + tags: { + textbox: { + linkedElement: "input", + template: "", + onUpdate: false, // No need to re-render whole tag, when content updates. + dataBoundOnly: true, + onAfterLink: function(tagCtx) { + this.value = tagCtx.args[0]; + }, + convert: function(val) { + return val.toUpperCase(); + }, + convertBack: function(val) { + return val.toLowerCase(); + } + } + }, + converters: { + cvt: function(val) { + return val + "cvt"; + } + } + }).link("#result", person, { + cvtBk: function(val) { + return val + "cvtBk"; + } + }); + + var tagWithDefaultConverters = $("#result").view(true).childTags("textbox")[0]; + var tagWithOverrideConverters = $("#result").view(true).childTags("textbox")[1]; + + // ............................... Assert ................................. + assert.equal(tagWithDefaultConverters.linkedElem[0].value + "|" + tagWithDefaultConverters.value + " % " + tagWithOverrideConverters.linkedElem[0].value + "|" + tagWithOverrideConverters.value, + "JO|Jo % Jocvt|Jo", + 'Data linked tag with default convert and convertBack, on initial linking: {^{textbox/}} uses default convert and {^{textbox convert=.../}} uses overridden convert'); + + // ................................ Act .................................. + $.observable(person).setProperty({name: "ANewName", name2: "ANewName2"}); + + // ............................... Assert ................................. + assert.equal(tagWithDefaultConverters.linkedElem[0].value + "|" + tagWithDefaultConverters.value + " % " + tagWithOverrideConverters.linkedElem[0].value + "|" + tagWithOverrideConverters.value, + "ANEWNAME|ANewName % ANewName2cvt|ANewName2", + 'Data linked tag with default convert and convertBack, on data change: {^{textbox/}} uses default convert and {^{textbox convert=.../}} uses overridden convert'); + + // ................................ Act .................................. + tagWithDefaultConverters.linkedElem[0].value = "ChangeTheName"; + tagWithOverrideConverters.linkedElem[0].value = "ChangeTheName2"; + tagWithDefaultConverters.linkedElem.change(); + tagWithOverrideConverters.linkedElem.change(); + + // ............................... Assert ................................. + assert.equal(person.name + "|" + tagWithDefaultConverters.value + " % " + person.name2 + "|" + tagWithOverrideConverters.value, + "changethename|changethename % ChangeTheName2cvtBk|ChangeTheName2cvtBk", + 'Data linked tag with default convert and convertBack, on element change: {^{textbox/}}uses default convertBAck and {^{textbox convertBack=.../}} uses overridden convertBack'); + + // =============================== Arrange =============================== + function conv1(val) { + return "ONE(" + val + " " + this.tagCtx.props.type + ")"; + } + conv1.depends = function(data) { + return [data, "foo"]; + } + + function conv2(val) { + return "TWO(" + val + " " + this.tagCtx.props.type + ")"; + } + conv2.depends = function(data) { + return [data, "foo"]; + } + + function conv3(val) { + return "THREE(" + val + " " + this.tagCtx.props.type + ")"; + } + conv3.depends = function(data) { + return [data, "foo"]; + } + var person = {name: "Jo", foo: "foo1", bar: "bar1"}; + + $.templates({ + markup: '{^{:name type=foo convert=~cvt}} {^{:name type=foo convert="cvt"}} {^{cvt:name type=foo }}', + converters: { + cvt: conv1 + } + }).link("#result", person, { + cvt: conv2 + }); + + // ................................ Act .................................. + var result = $("#result").text(); + $.observable(person).setProperty({name: "Jo2"}); + result += "\nChangeData-name: " + $("#result").text(); + + $.observable(person).setProperty({foo: "foo2"}); + result += "\nChangeConverterDepends-foo: " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, isIE8 ? "TWO(Jo foo1) ONE(Jo foo1) ONE(Jo foo1)\n" + + "ChangeData-name: TWO(Jo2 foo1)ONE(Jo2 foo1)ONE(Jo2 foo1)\n" + + "ChangeConverterDepends-foo: TWO(Jo2 foo2)ONE(Jo2 foo2)ONE(Jo2 foo2)" + : "TWO(Jo foo1) ONE(Jo foo1) ONE(Jo foo1)\n" + + "ChangeData-name: TWO(Jo2 foo1) ONE(Jo2 foo1) ONE(Jo2 foo1)\n" + + "ChangeConverterDepends-foo: TWO(Jo2 foo2) ONE(Jo2 foo2) ONE(Jo2 foo2)", + '{^{:...}} tag with converters with depends - updates correctly in response to dependent observable change'); + + // =============================== Arrange =============================== + var person = {name: "Jo", foo: "foo1", bar: "bar1"}; + + $.templates({ + markup: '{^{textbox name type=foo convert=~cvt/}} {^{textbox name type=foo convert="cvt"/}} {^{textbox name type=foo /}}', + tags: { + textbox: { + state: "state1", + template: "{{:}} {{:#parent.data.bar}} {{:~tag.state}} {{:~tagCtx.props.type}}", + convert: conv3, + depends: function(data) { + return [data, "bar", this, "state" ]; + } + } + }, + converters: { + cvt: conv1 + } + }).link("#result", person, { + cvt: conv2 + }); + + var textbox2 = $("#result").view().childTags("textbox")[1]; + + // ................................ Act .................................. + result = $("#result").text(); + + result = $("#result").text(); + $.observable(person).setProperty({name: "Jo2"}); + result += "\nChangeData-name: " + $("#result").text(); + + $.observable(person).setProperty({foo: "foo2"}); + result += "\nChangeConverterDepends-foo: " + $("#result").text(); + + $.observable(person).setProperty({bar: "bar2"}); + result += "\nChangeTagDependsData-bar: " + $("#result").text(); + + $.observable(textbox2).setProperty({state: "state2"}); + result += "\nChangeTagDependsState-state: " + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, isIE8 ? "TWO(Jo foo1) bar1 state1 foo1 ONE(Jo foo1) bar1 state1 foo1 THREE(Jo foo1) bar1 state1 foo1\n" + + "ChangeData-name: TWO(Jo2 foo1) bar1 state1 foo1ONE(Jo2 foo1) bar1 state1 foo1THREE(Jo2 foo1) bar1 state1 foo1\n" + + "ChangeConverterDepends-foo: TWO(Jo2 foo2) bar1 state1 foo2ONE(Jo2 foo2) bar1 state1 foo2THREE(Jo2 foo2) bar1 state1 foo2\n" + + "ChangeTagDependsData-bar: TWO(Jo2 foo2) bar2 state1 foo2ONE(Jo2 foo2) bar2 state1 foo2THREE(Jo2 foo2) bar2 state1 foo2\n" + + "ChangeTagDependsState-state: TWO(Jo2 foo2) bar2 state1 foo2ONE(Jo2 foo2) bar2 state2 foo2THREE(Jo2 foo2) bar2 state1 foo2" + : "TWO(Jo foo1) bar1 state1 foo1 ONE(Jo foo1) bar1 state1 foo1 THREE(Jo foo1) bar1 state1 foo1\n" + + "ChangeData-name: TWO(Jo2 foo1) bar1 state1 foo1 ONE(Jo2 foo1) bar1 state1 foo1 THREE(Jo2 foo1) bar1 state1 foo1\n" + + "ChangeConverterDepends-foo: TWO(Jo2 foo2) bar1 state1 foo2 ONE(Jo2 foo2) bar1 state1 foo2 THREE(Jo2 foo2) bar1 state1 foo2\n" + + "ChangeTagDependsData-bar: TWO(Jo2 foo2) bar2 state1 foo2 ONE(Jo2 foo2) bar2 state1 foo2 THREE(Jo2 foo2) bar2 state1 foo2\n" + + "ChangeTagDependsState-state: TWO(Jo2 foo2) bar2 state1 foo2 ONE(Jo2 foo2) bar2 state2 foo2 THREE(Jo2 foo2) bar2 state1 foo2", + '{^{textbox}} tag with depends, and with converters with depends - updates correctly in response to dependent observable changes'); + + // =============================== Arrange =============================== + var res = ""; + + $.templates('{^{twoWayTag name trigger="keydown mouseup"/}}').link("#result", person); + + var linkedElem = $("#result input")[0], + events = $._data(linkedElem).events, + handlers = "|" + events.mouseup.length + events.keydown.length; + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + + $.observable(person).setProperty({name: "FirstName"}); + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ................................ Act .................................. + res += " 1: " + person.name + "|" + tag.value; + + tag.linkedElem[0].value = "SecondName"; + + tag.linkedElem.keydown(); + +setTimeout(function() { + res += " 2: " + person.name + "|" + tag.value; + + tag.linkedElem[0].value = "ThirdName"; + + tag.linkedElem.mouseup(); + +setTimeout(function() { + res += " 3: " + person.name + "|" + tag.value; + + tag.linkedElem[0].value = "FourthName"; + + tag.linkedElem.keydown(); + +setTimeout(function() { + res += " 4: " + person.name + "|" + tag.value; + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ............................... Assert ................................. + assert.equal(res, + " 1: FirstName|FirstName 2: SecondName|SecondName 3: ThirdName|ThirdName 4: FourthName|FourthName", + 'Data link, global trigger false, using: {^{twoWayTag name trigger="event1 event2"/}} triggers on specified events'); + + // ............................... Assert ................................. + assert.equal(handlers, + "|11|11|11", + 'Data link, global trigger false, using: {^{twoWayTag name trigger="event1 event2"/}} has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Data link, global trigger false, using: {^{twoWayTag name trigger="event1 event2"/}}: handlers are removed by $.unlink(container)'); + + // =============================== Arrange =============================== + res = ""; + + $.templates('').link("#result", person); + + linkedElem = $("#result input")[0]; + + events = $._data(linkedElem).events; + handlers = "|" + events.mouseup.length + events.keydown.length; + + $.observable(person).setProperty({name: "FirstName"}); + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ................................ Act .................................. + res += " 1: " + person.name; + + linkedElem.value = "SecondName"; + + $(linkedElem).keydown(); + +setTimeout(function() { + res += " 2: " + person.name; + + linkedElem.value = "ThirdName"; + + $(linkedElem).mouseup(); + +setTimeout(function() { + res += " 3: " + person.name; + + linkedElem.value = "FourthName"; + + $(linkedElem).keydown(); + +setTimeout(function() { + res += " 4: " + person.name; + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ............................... Assert ................................. + assert.equal(res, + " 1: FirstName 2: SecondName 3: ThirdName 4: FourthName", + 'Data link, global trigger false, using: triggers on specified events'); + + // ............................... Assert ................................. + assert.equal(handlers, + "|11|11|11", + 'Data link, global trigger false, using: has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Data link, global trigger false, using: : handlers are removed by $.unlink(container)'); + + // =============================== Arrange =============================== + res = ""; + + $.templates('
                      some content
                      ').link("#result", person); + + linkedElem = $("#result div")[0]; + + events = $._data(linkedElem).events; + handlers = "|" + events.mouseup.length + events.keydown.length; + + $.observable(person).setProperty({name: "First Name"}); + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ................................ Act .................................. + res += " 1: " + person.name; + + linkedElem.innerHTML = "Second Name2"; + + $(linkedElem).keydown(); + +setTimeout(function() { + res += " 2: " + person.name; + + linkedElem.innerHTML = "Third Name3"; + + $(linkedElem).mouseup(); + +setTimeout(function() { + res += " 3: " + person.name; + + linkedElem.innerHTML = "Fourth Name4"; + + $(linkedElem).keydown(); + +setTimeout(function() { + res += " 4: " + person.name; + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ............................... Assert ................................. + assert.equal(res, + isIE8 ? " 1: First Name 2: Second Name2 3: Third Name3 4: Fourth Name4" + : " 1: First Name 2: Second Name2 3: Third Name3 4: Fourth Name4", + 'Data link, global trigger false, using:
                      triggers on specified events'); + + // ............................... Assert ................................. + assert.equal(handlers, + "|11|11|11", + 'Data link, global trigger false, using:
                      has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Data link, global trigger false, using:
                      : handlers are removed by $.unlink(container)'); + + // =============================== Arrange =============================== + res = ""; + $("#result").html(''); + + linkedElem = $("#result input")[0]; + + $.link(true, "#result", person); + + events = $._data(linkedElem).events; + handlers = "|" + events.mouseup.length + events.keydown.length; + + $.observable(person).setProperty({name: "FirstName"}); + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ................................ Act .................................. + res += " 1: " + person.name; + + linkedElem.value = "SecondName"; + + $(linkedElem).keydown(); + +setTimeout(function() { + res += " 2: " + person.name; + + linkedElem.value = "ThirdName"; + + $(linkedElem).mouseup(); + +setTimeout(function() { + res += " 3: " + person.name; + + linkedElem.value = "FourthName"; + + $(linkedElem).keydown(); + +setTimeout(function() { + res += " 4: " + person.name; + + handlers += "|" + events.mouseup.length + events.keydown.length; + + // ............................... Assert ................................. + assert.equal(res, + " 1: FirstName 2: SecondName 3: ThirdName 4: FourthName", + 'Top-level data link, global trigger false, using: triggers on specified events'); + + // ............................... Assert ................................. + assert.equal(handlers, + "|11|11|11", + 'Top-level data link, global trigger false, using: has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Top-level data link using: : handlers are removed by $.unlink(container)'); + + $("#result").empty(); + + $.views.settings.trigger(true); + +done(); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}, 0); +}); + +QUnit.test("Tag options versus setting in init()", function(assert) { + $.views.settings.trigger(false); + + // =============================== Arrange =============================== + var getValues = function() { + result += "{{mytag}}: " + inputs[0].value + " " + inputs[1].value + " " + inputs[2].value + " " + inputs[3].value + + " {{else}}: " + inputs[4].value + " " + inputs[5].value + " " + inputs[6].value + " " + inputs[7].value + + " |data: " + inputs[8].value + " " + inputs[9].value + " " + inputs[10].value + " |text: " + $("#result").text() + "\n"; + } + + var person = {first: "Jo", last: "Blow", title: "Sir"}; + $.views.templates({ + markup: '{^{mytag 0 prop=first last title=title}}{{else 0 prop=last first title=title}}{{/mytag}}' + + '', + tags: { + mytag: { + init: function(tagCtx) { + this.bindTo = ["prop", 1]; + this.linkedElement = [".a", ".b"]; + this.linkedCtxParam = ["a", "b"]; + this.template = '{^{:~tagCtx.props.title}}'; + this.boundProps = ["title"]; + //this.depends = "title"; + }, + onUpdate: false + } + } + }).link("#result", person); + + // ................................ Act .................................. + var container = $("#result")[0], + inputs = $("input:text", container), + result = ""; + + getValues(); + + $(inputs[0]).val("Jo0").change(); + getValues(); + + $(inputs[1]).val("Blow1").change(); + getValues(); + + $(inputs[2]).val("Jo2").change(); + getValues(); + + $(inputs[3]).val("Blow3").change(); + getValues(); + + $(inputs[4]).val("Blow4").change(); + getValues(); + + $(inputs[5]).val("Jo5").change(); + getValues(); + + $(inputs[8]).val("Jo8").change(); + getValues(); + + $(inputs[9]).val("Blow9").change(); + getValues(); + + $(inputs[10]).val("Sir10").change(); + getValues(); + + // ............................... Assert ................................. + assert.equal(result, "{{mytag}}: Jo Blow Jo Blow {{else}}: Blow Jo Blow Jo |data: Jo Blow Sir |text: SirSir\n" + + "{{mytag}}: Jo0 Blow Jo0 Blow {{else}}: Blow Jo Blow Jo0 |data: Jo0 Blow Sir |text: SirSir\n" + + "{{mytag}}: Jo0 Blow1 Jo0 Blow1 {{else}}: Blow Jo Blow1 Jo0 |data: Jo0 Blow1 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow1 Jo2 Blow1 {{else}}: Blow Jo Blow1 Jo2 |data: Jo2 Blow1 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow3 Jo2 Blow3 {{else}}: Blow Jo Blow3 Jo2 |data: Jo2 Blow3 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow3 Jo2 Blow4 {{else}}: Blow4 Jo Blow4 Jo2 |data: Jo2 Blow4 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow3 Jo5 Blow4 {{else}}: Blow4 Jo5 Blow4 Jo5 |data: Jo5 Blow4 Sir |text: SirSir\n" + + "{{mytag}}: Jo8 Blow4 Jo8 Blow4 {{else}}: Blow4 Jo8 Blow4 Jo8 |data: Jo8 Blow4 Sir |text: SirSir\n" + + "{{mytag}}: Jo8 Blow9 Jo8 Blow9 {{else}}: Blow9 Jo8 Blow9 Jo8 |data: Jo8 Blow9 Sir |text: SirSir\n" + + "{{mytag}}: Jo8 Blow9 Jo8 Blow9 {{else}}: Blow9 Jo8 Blow9 Jo8 |data: Jo8 Blow9 Sir10 |text: Sir10Sir10\n", + "Setting bindTo, linkedElement, linkedCtxParam, template and boundProps in init(), and using two-way binding" + + " including on {{else}}, works correctly (onUpdate set to false)"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow", title: "Sir"}; + $.views.templates({ + markup: '{^{mytag 0 prop=first last title=title}}{{else 0 prop=last first title=title}}{{/mytag}}' + + '', + tags: { + mytag: { + init: function(tagCtx) { + this.bindTo = ["prop", 1]; + this.linkedElement = [".a", ".b"]; + this.linkedCtxParam = ["a", "b"]; + this.template = '{{:~tagCtx.props.title}}'; + //this.boundProps = ["title"]; + this.depends = "title"; + } + //onUpdate: false + } + } + }).link("#result", person); + + // ................................ Act .................................. + container = $("#result")[0]; + inputs = $("input:text", container); + result = ""; + + getValues(); + + $(inputs[0]).val("Jo0").change(); + inputs = $("input:text", container); // Refresh inputs array, since onUpdate is true, so input will have been rerendered + getValues(); + + $(inputs[1]).val("Blow1").change(); + inputs = $("input:text", container); + getValues(); + + $(inputs[2]).val("Jo2").change(); + inputs = $("input:text", container); + getValues(); + + $(inputs[3]).val("Blow3").change(); + inputs = $("input:text", container); + getValues(); + inputs = $("input:text", container); + + $(inputs[4]).val("Blow4").change(); + inputs = $("input:text", container); + getValues(); + + $(inputs[5]).val("Jo5").change(); + inputs = $("input:text", container); + getValues(); + + $(inputs[8]).val("Jo8").change(); + inputs = $("input:text", container); + getValues(); + + $(inputs[9]).val("Blow9").change(); + inputs = $("input:text", container); + getValues(); + + $(inputs[10]).val("Sir10").change(); + inputs = $("input:text", container); + getValues(); + + // ............................... Assert ................................. + assert.equal(result, "{{mytag}}: Jo Blow Jo Blow {{else}}: Blow Jo Blow Jo |data: Jo Blow Sir |text: SirSir\n" + + "{{mytag}}: Jo0 Blow Jo0 Blow {{else}}: Blow Jo Blow Jo0 |data: Jo0 Blow Sir |text: SirSir\n" + + "{{mytag}}: Jo0 Blow1 Jo0 Blow1 {{else}}: Blow Jo Blow1 Jo0 |data: Jo0 Blow1 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow1 Jo2 Blow1 {{else}}: Blow Jo Blow1 Jo2 |data: Jo2 Blow1 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow3 Jo2 Blow3 {{else}}: Blow Jo Blow3 Jo2 |data: Jo2 Blow3 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow3 Jo2 Blow4 {{else}}: Blow4 Jo Blow4 Jo2 |data: Jo2 Blow4 Sir |text: SirSir\n" + + "{{mytag}}: Jo2 Blow3 Jo5 Blow4 {{else}}: Blow4 Jo5 Blow4 Jo5 |data: Jo5 Blow4 Sir |text: SirSir\n" + + "{{mytag}}: Jo8 Blow4 Jo8 Blow4 {{else}}: Blow4 Jo8 Blow4 Jo8 |data: Jo8 Blow4 Sir |text: SirSir\n" + + "{{mytag}}: Jo8 Blow9 Jo8 Blow9 {{else}}: Blow9 Jo8 Blow9 Jo8 |data: Jo8 Blow9 Sir |text: SirSir\n" + + "{{mytag}}: Jo8 Blow9 Jo8 Blow9 {{else}}: Blow9 Jo8 Blow9 Jo8 |data: Jo8 Blow9 Sir10 |text: Sir10Sir10\n", + "Setting bindTo, linkedElement, linkedCtxParam, template and depends in init(), and using two-way binding including on {{else}}," + + " works correctly (onUpdate set to true)"); + + // =============================== Arrange =============================== + person = {heading: "HEAD"}; + + $.views.templates({ + markup: '
                      One
                      ' + + '
                      Two
                      ' + + '
                      Two
                      ' + + '
                      Three
                      ', + tags: { + mytag: { + init: function(tagCtx, linkCtx) { + this.template = (linkCtx.attr||tagCtx.props.attr||this.attr) + ': {{:heading}}'; + if (tagCtx.props.attr) { + this.attr = tagCtx.props.attr; + } + }, + onUpdate: false, + attr: "data-foo" // Default + } + }, + }).link("#result", person); + + // ............................... Assert ................................. + assert.equal( + $("#result div").eq(0).prop("foo") + " " + + $("#result div").eq(1).attr("title") + " " + + $("#result div").eq(2).prop("bar") + " " + + $("#result div").eq(3).attr("data-foo"), + "prop-foo: HEAD title: HEAD prop-bar: HEAD data-foo: HEAD", + "Setting attr in init() works correctly - including specifying prop - to set a property as target"); + + // =============================== Arrange =============================== + person = {first: "Jo", width: 32}; + + $.views.templates({ + markup: '{^{mytag first width=width height=66 class="box" id="a"}}' + + '{{else first id="b"}}' + + '{{else first width=width-10 height=46 id="c"}}{{/mytag}}', + tags: { + mytag: { + init: function(tagCtx) { + this.boundProps = ["width"]; + this.linkedElement = "input"; + this.displayElement = ".foot"; + this.mainElement = ".head"; // + this.template = '
                      head
                      foot
                      '; +// this.width = 55; // We set this in onBind instead - either will work +// this.className = "myclass"; // We set this in onBind instead - either will work + this.setSize = true; + }, + onBind: function(tagCtx) { + this.tagCtxs[2].mainElem = this.tagCtxs[2].contents(true, ".foot"); + this.tagCtxs[0].props.width = 102; + this.width = 300; + this.className = "myclass"; + }, + width: "155px", + height: "10em", + onUpdate: true, + } + } + }).link("#result", person); + + // ............................... Assert ................................. + var result = ""; + + $("#result div").each(function(i, elem) { + result += " |" + i + ": " + + (elem.id ? " id: " + elem.id : "") + + (elem.className ? " class: " + elem.className : "") + + (elem.style.width ? " width: " + elem.style.width : "") + + (elem.style.height ? " height: " + elem.style.height : ""); + }) + assert.equal(result, + " |0: class: top |1: id: a class: head width: 102px height: 66px |2: class: foot box" ++ " |3: class: top |4: id: b class: head width: 300px height: 10em |5: class: foot myclass" ++ " |6: class: top |7: class: head |8: id: c class: foot myclass width: 22px height: 46px", + "Setting width, height, class, setSize, as tag options or in init()/onBind()," + + " or setting width height or class as props, or setting displayElement or mainElemet as tag option or in init() all work correctly"); + + // =============================== Arrange =============================== + person = {first: "Jo", width: 32}; + + $.views.templates({ + markup: '
                      ', + tags: { + mytag: { + init: function(tagCtx) { + this.boundProps = ["width"]; + this.linkedElement = "input"; + this.displayElement = ".foot"; + this.mainElement = ".head"; // + this.template = '
                      head
                      foot
                      '; +// this.width = 55; // We set this in onBind instead - either will work +// this.className = "myclass"; // We set this in onBind instead - either will work + this.setSize = true; + }, + onBind: function(tagCtx) { + this.tagCtxs[2].mainElem = this.tagCtxs[2].contents(true, ".foot"); + this.tagCtxs[0].props.width = 102; + this.width = 300; + this.className = "myclass"; + }, + width: "155px", + height: "10em", + onUpdate: true, + } + } + }).link("#result", person); + + // ............................... Assert ................................. + result = ""; + + $("#result div div").each(function(i, elem) { + result += " |" + i + ": " + + (elem.id ? " id: " + elem.id : "") + + (elem.className ? " class: " + elem.className : "") + + (elem.style.width ? " width: " + elem.style.width : "") + + (elem.style.height ? " height: " + elem.style.height : ""); + }) + assert.equal(result, + " |0: class: top |1: id: a class: head width: 102px height: 66px |2: class: foot box" ++ " |3: class: top |4: id: b class: head width: 300px height: 10em |5: class: foot myclass" ++ " |6: class: top |7: class: head |8: id: c class: foot myclass width: 22px height: 46px", + "Setting width, height, class, setSize, as tag options or in init()/onBind()," + + " or setting width height or class as props, or setting displayElement as tag option or in init() all work correctly. (With data-linked div)"); + +// =============================== Arrange =============================== + person = {first: "Jo"}; + + $.views.templates({ + markup: '1
                      {^{mytag useData=false/}}' + + '2
                      {^{mytag useData=true/}}' + + '3
                      {^{mytag ~person2 useOuterCtx=false}}{{else ~person2 useOuterCtx=false}}{{/mytag}}' + + '4
                      {^{mytag ~person2 useOuterCtx=true}}{{else ~person2 useOuterCtx=true}}{{/mytag}}', + tags: { + mytag: { + init: function(tagCtx) { + this.argDefault = tagCtx.props.useData; + this.contentCtx = tagCtx.props.useOuterCtx; + }, + onUpdate: false, + template: '{{:!!~tagCtx.args[0] && ~tagCtx.args[0].first}} {{:first}} ' + } + } + }).link("#result", {first: "Jo"}, {person2: {first: "Fred"}}); + + // ............................... Assert ................................. + result = ""; + + assert.equal($("#result").text(), + "1 false Jo false Jo " + + "2 Jo Jo Jo Jo " + + "3 Fred Fred Fred Fred Fred Fred Fred Fred " + + "4 Fred Jo Fred Jo Fred Jo Fred Jo ", + "Setting argDefault or contentCtx in init() work correctly."); + +// =============================== Arrange =============================== + person = {first: "Jo"}; + + $.views.templates({ + markup: "1: {{mytag person=~person2/}} " + + "2: {{mytag person=~person2}}inner block: {{:first}}{{/mytag}} " + + "3: {{myrendertag person=~person2}}inner block: {{:first}}{{/myrendertag}}", + tags: { + mytag: { + contentCtx: function() { + return this.tagCtx.props.person; + }, + onUpdate: false, + template: 'In template: {{:first}} {{include tmpl=#content/}}' + }, + myrendertag: { + contentCtx: function() { + return this.tagCtx.props.person; + }, + onUpdate: false, + render: function() { + return this.tagCtx.render(); + } + } + } + }).link("#result", {first: "Jo"}, {person2: {first: "Fred"}}); + + // ............................... Assert ................................. + result = ""; + + assert.equal($("#result").text(), + "1: In template: Fred " + (isIE8 ? "" : " ") + + "2: In template: Fred inner block: Fred " + + "3: inner block: Fred", + "contentCtx as a function returns the data context both for the template and for block content."); + + $.views.settings.trigger(true); +}); + +QUnit.test("Global trigger=false local trigger=true - triggers after keydown: ", function(assert) { + // =============================== Arrange =============================== + $.views.settings.trigger(false); + var done = assert.async(), + res = "", + person = {name: "Jo"}; + + $.templates('').link("#result", person); + + var linkedElem = $("#result input")[0]; + + var events = $._data(linkedElem).events, + handlers = "|" + events[inputOrKeydown].length; + + $.observable(person).setProperty({name: "FirstName"}); + + events = $._data(linkedElem).events; + handlers += "|" + events[inputOrKeydown].length; + + // ................................ Act .................................. + res += " 1: " + person.name; + + linkedElem.value = "SecondName"; + + keydown($(linkedElem)); + $.views.settings.trigger(true); + + setTimeout(function() { + res += " 2: " + person.name; + + handlers += "|" + events[inputOrKeydown].length; + + // ............................... Assert ................................. + assert.equal(res, + " 1: FirstName 2: SecondName", + 'Data link using: triggers after keydown'); + + // ............................... Assert ................................. + assert.equal(handlers, + "|1|1|1", + 'Data link using: has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Data link using: : handlers are removed by $.unlink(container)'); + + done(); + }, 0); +}); + +QUnit.test("Global trigger=true local trigger=false - does not trigger after keydown: ", function(assert) { + // =============================== Arrange =============================== + var done = assert.async(), + res = "", + person = {name: "Jo"}; + + $.templates('').link("#result", person); + + var linkedElem = $("#result input")[0]; + + var events = $._data(linkedElem).events; + + $.observable(person).setProperty({name: "FirstName"}); + + // ................................ Act .................................. + res += " 1: " + person.name; + + linkedElem.value = "SecondName"; + + keydown($(linkedElem)); + + setTimeout(function() { + res += " 2: " + person.name; + + // ............................... Assert ................................. + assert.equal(res, + " 1: FirstName 2: FirstName", + 'Data link using: does not trigger after keydown'); + + // ............................... Assert ................................. + assert.equal(!events && !$._data(linkedElem).events, + true, + 'Data link using: has no handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Data link using: : No handlers after $.unlink(container)'); + + done(); + }, 0); +}); + +QUnit.test("Global trigger=true - triggers after keydown: ", function(assert) { + // =============================== Arrange =============================== + var done = assert.async(), + res = "", + person = {name: "Jo"}; + + $.templates('').link("#result", person); + + var linkedElem = $("#result input")[0]; + + var events = $._data(linkedElem).events, + handlers = "|" + events[inputOrKeydown].length; + + $.observable(person).setProperty({name: "FirstName"}); + + events = $._data(linkedElem).events; + handlers += "|" + events[inputOrKeydown].length; + + // ................................ Act .................................. + res += " 1: " + person.name; + + linkedElem.value = "SecondName"; + + keydown($(linkedElem)); + + setTimeout(function() { + res += " 2: " + person.name; + + handlers += "|" + events[inputOrKeydown].length; + + // ............................... Assert ................................. + assert.equal(res, + " 1: FirstName 2: SecondName", + 'Data link using: triggers after keydown'); + + // ............................... Assert ................................. + assert.equal(handlers, + "|1|1|1", + 'Data link using: has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Data link using: : handlers are removed by $.unlink(container)'); + + done(); + }, 0); +}); + +QUnit.test("Global trigger=true - ", function(assert) { + // =============================== Arrange =============================== + var done = assert.async(), + res = "", + person = {member: true}; + + $.templates('').link("#result", person); + var linkedElem = $("#result input")[0]; + + var events = $._data(linkedElem).events; + + $.observable(person).setProperty({member: false}); + + events = $._data(linkedElem).events; + + // ................................ Act .................................. + res += " 1: " + person.member; + + linkedElem.checked = true; + + $(linkedElem).change(); + + setTimeout(function() { + res += " 2: " + person.member; + + // ............................... Assert ................................. + assert.equal(res, + " 1: false 2: true", + 'Data link using: triggers after change'); + + // ............................... Assert ................................. + assert.equal(events, + undefined, + 'Data link using: has no events'); + + // ................................ Act .................................. + $.unlink("#result"); + + done(); + }, 0); +}); + +QUnit.test("trigger=\'keydown\' - triggers after keydown: ", function(assert) { + // =============================== Arrange =============================== + + var done = assert.async(), + res = "", + person = {name: "Jo"}; + + $.templates('').link("#result", person); + + var linkedElem = $("#result input")[0]; + + var events = $._data(linkedElem).events, + handlers = "|" + events.keydown.length; + + $.observable(person).setProperty({name: "FirstName"}); + + events = $._data(linkedElem).events; + handlers += "|" + events.keydown.length; + + // ................................ Act .................................. + res += " 1: " + person.name; + + linkedElem.value = "SecondName"; + + $(linkedElem).keydown(); + + setTimeout(function() { + res += " 2: " + person.name; + + handlers += "|" + events.keydown.length; + + // ............................... Assert ................................. + assert.equal(res, + " 1: FirstName 2: SecondName", + 'Data link using: triggers after keydown'); + + // ............................... Assert ................................. + assert.equal(handlers, + "|1|1|1", + 'Data link using: has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Data link using: : handlers are removed by $.unlink(container)'); + + done(); + }, 0); +}); + +QUnit.test("Global trigger=true - triggers after keydown: {^{twoWayTag}}", function(assert) { + // =============================== Arrange =============================== + + var done = assert.async(), + before = "", + person = {name: "Jo"}; + + $.templates({ + markup: '{^{twoWayTag name convert="myupper" convertBack=~lower/}}', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + var tag = $("#result").view(true).childTags("twoWayTag")[0], + + linkedElem = tag.linkedElem[0], + events = $._data(linkedElem).events, + handlers = "|" + events[inputOrKeydown].length; + + // ................................ Act .................................. + before = linkedElem.value; + linkedElem.value = "ChangeTheName"; + + keydown(tag.linkedElem); + + setTimeout(function() { + // ............................... Assert ................................. + assert.equal(before + "|" + person.name, + "JO|changethename", + 'Data link using: {^{twoWayTag name convertBack=~lower/}} - triggers after keydown, converts the data, and sets on data'); + + handlers += "|" + events[inputOrKeydown].length; + + // ............................... Assert ................................. + assert.equal(handlers, + "|1|1", + 'Top-level data link using: {^{twoWayTag name convertBack=~lower/}} has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Top-level data link using: {^{twoWayTag name convertBack=~lower/}}: handlers are removed by $.unlink(container)'); + + done(); + }, 0); +}); + +QUnit.test("Global trigger=true - triggers - after keydown: {^{textbox}}", function(assert) { + // =============================== Arrange =============================== + + var done = assert.async(), + before = "", + person = {name: "Jo"}; + + $.views.tags({ + textbox: { + onAfterLink: function() { + // Find input in contents, if not already found + this.linkedElem = this.linkedElem || this.contents("input"); + }, + onUpdate: function() { + // No need to re-render whole tag, when content updates. + return false; // + }, + template: "" + } + }); + + $.templates({ + markup: '{^{textbox name convert="myupper" convertBack=~lower/}}', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + var tag = $("#result").view(true).childTags("textbox")[0]; + + var linkedElem = tag.linkedElem[0], + events = $._data(linkedElem).events, + handlers = "|" + events[inputOrKeydown].length; + + // ................................ Act .................................. + before = linkedElem.value; + linkedElem.value = "ChangeTheName"; + + keydown(tag.linkedElem); + + setTimeout(function() { + // ............................... Assert ................................. + assert.equal(before + "|" + person.name, + "JO|changethename", + 'Data link using: {^{textbox name convertBack=~lower/}} - triggers after keydown, converts the data, and sets on data'); + + handlers += "|" + events[inputOrKeydown].length; + + // ............................... Assert ................................. + assert.equal(handlers, + "|1|1", + 'Top-level data link using: {^{textbox name convertBack=~lower/}} has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Top-level data link using: {^{textbox name convertBack=~lower/}}: handlers are removed by $.unlink(container)'); + + done(); + }, 0); + +}); + +QUnit.test("Custom tag trigger:... option", function(assert) { + // =============================== Arrange =============================== + + var done = assert.async(), + before = "", + person = {name: "Jo", trig:true}; + + $.views.tags({ + textbox: { + linkedElement: "input", + onUpdate: false, + template: "", + trigger: false, + } + }); + + $.templates({ + markup: '{^{textbox name/}} {^{textbox name trigger=true/}}', + }).link("#result", person); + + var tags = $("#result").view(true).childTags("textbox"); + + var linkedElem1 = $("#result input")[0]; + var linkedElem2 = $("#result input")[1]; + + // ................................ Act .................................. + before = person.name; + + linkedElem1.value = "NewName1"; + keydown($(linkedElem1)); + + setTimeout(function() { + + before += "|" + person.name; + + linkedElem2.value = "NewName2"; + keydown($(linkedElem2)); + + setTimeout(function() { + + before += "|" + person.name; + + linkedElem1.value = "AnotherNewName1"; + $(linkedElem1).change(); + + before += "|" + person.name; + + // ............................... Assert ................................. + assert.equal(before, + "Jo|Jo|NewName2|AnotherNewName1", + '{^{textbox/}} with option trigger:false - triggers after change, not after keydown. But {^{textbox trigger=true/}} overrides option and triggers on keydown'); + + done(); + }, 0); + }, 0); + +}); + +QUnit.test("Global trigger=true - triggers after keydown: {^{contentEditable}}", function(assert) { + // =============================== Arrange =============================== +$.views.settings.trigger(true); + + var done = assert.async(), + before = "", + person = {name: "Jo Smith"}; + + $.views.tags({ + contentEditable: { + onAfterLink: function() { + // Find contentEditable div in contents, if not already found + this.linkedElem = this.linkedElem || this.contents("[contentEditable]"); + }, + onUpdate: function() { + // No need to re-render whole tag, when content updates. + return false; + }, + template: "
                      " + } + }); + + $.templates({ + markup: '{^{contentEditable name convert="myupper" convertBack=~lower/}}', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + var tag = $("#result").view(true).childTags("contentEditable")[0], + + linkedElem = tag.linkedElem[0], + events = $._data(linkedElem).events, + handlers = "|" + events[inputOrKeydownContentEditable].length; + + // ................................ Act .................................. + before = linkedElem.innerHTML; + linkedElem.innerHTML = "New Name"; + + tag.linkedElem.trigger(inputOrKeydownContentEditable); + +setTimeout(function() { + before += "|" + person.name; + linkedElem.innerHTML = "New2

                      Name2

                      "; + + tag.linkedElem.trigger(inputOrKeydownContentEditable); + +setTimeout(function() { + before += "|" + person.name; + linkedElem.innerHTML = "New3
                      Name3
                      "; + + tag.linkedElem.trigger(inputOrKeydownContentEditable); + +setTimeout(function() { + // ............................... Assert ................................. + assert.equal(before + "|" + person.name, + isIE8 ? "JO SMITH|new name|new2 \r\n

                      name2

                      |new3 \r\n
                      name3
                      " + : "JO SMITH|new name|new2

                      name2

                      |new3
                      name3
                      ", + 'Data link using: {^{contentEditable name convertBack=~lower/}} - triggers after keydown, converts the data, and sets on data'); + + handlers += "|" + events[inputOrKeydownContentEditable].length; + + // ............................... Assert ................................. + assert.equal(handlers, + "|1|1", + 'Top-level data link using: {^{contentEditable name convertBack=~lower/}} has no duplicate handlers after relinking'); + + // ................................ Act .................................. + $.unlink("#result"); + + // ............................... Assert ................................. + assert.ok($._data(linkedElem).events === undefined, + 'Top-level data link using: {^{contentEditable name convertBack=~lower/}}: handlers are removed by $.unlink(container)'); + +$.views.settings.trigger(true); + + done(); + }, 0); + }, 0); + }, 0); + +}); + +QUnit.test('linkTo for {:source linkTo=target:} or {twoWayTag source linkTo=target}', function(assert) { +$.views.settings.trigger(false); + + // =============================== Arrange =============================== + var before, after, person = {name: "Jo", name2: "Jo2"}, + cancelChange = false, + eventData = ""; + + $.views.tags({ + twoWayTag: { + init: function(tagCtx, linkCtx, ctx) { + eventData += "init "; + if (this.inline && !tagCtx.content) { + this.template = ""; + } + }, + render: function(val) { + eventData += "render "; + }, + onAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onAfterLink "; + this.value = tagCtx.args[0]; + this.linkedElem = this.linkedElem || (this.inline ? this.contents("input,div") : $(linkCtx.elem)); + }, + onBeforeUpdateVal: function(ev, eventArgs) { + eventData += "onBeforeUpdateVal "; + }, + onUpdate: function(ev, eventArgs, newTagCtxs) { + eventData += "onUpdate "; + return false; + }, + onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onBind "; + }, + onUnbind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onUnbind "; + }, + onBeforeChange: function(ev, eventArgs) { + eventData += "onBeforeChange "; + return !cancelChange; + }, + onAfterChange: function(ev, eventArgs) { + eventData += "onAfterChange "; + return !cancelChange; + }, + onDispose: function() { + eventData += "onDispose "; + } + } + }); + + // ELEMENT-BASED DATA-LINKED TAGS ON INPUT - WITH linkTo EXPRESSION + $.templates('') + .link("#result", person); + + var linkedEl = $("#linkedElm")[0]; + + // ................................ Act .................................. + before = linkedEl.value; + + $.observable(person).setProperty({name: "newName"}); + after = linkedEl.value; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "Jo|newName", + 'Data link using: - binds data to linkedElem'); + + // ................................ Act .................................. + before = "name:" + person.name + " name2:" + person.name2; + linkedEl.value = "newVal"; + $(linkedEl).change(); + after = "name:" + person.name + " name2:" + person.name2; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "name:newName name2:Jo2|name:newName name2:newVal", + 'Data link using: - binds linkedElem back to "linkTo" target data - using return value of onChange'); + + // ................................ Act .................................. + before = "name:" + person.name + " name2:" + person.name2; + cancelChange = true; + linkedEl.value = "2ndNewVal"; + $(linkedEl).change(); + after = "name:" + person.name + " name2:" + person.name2; + + // =============================== Arrange =============================== + + person.name = "Jo"; + person.name2 = "Jo2"; + + $.templates('') + .link("#result", person); + + linkedEl = $("#linkedElm")[0]; + + // ................................ Act .................................. + before = "value: " + linkedEl.value + " name:" + person.name + " name2:" + person.name2; + linkedEl.value = "3rdNewVal"; + $(linkedEl).change(); + after = "name:" + person.name + " name2:" + person.name2; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "value: initialValue name:Jo name2:Jo2|name:Jo name2:3rdNewVal", + 'Data link using: - Initializes to provided string, and binds updated value of linkedElem back to "linkTo" target'); + + // =============================== Arrange =============================== + + person.name = "Jo"; + person.name2 = "Jo2"; + + $.templates('') + .link("#result", person); + + linkedEl = $("#linkedElm")[0]; + + // ................................ Act .................................. + before = "value: " + linkedEl.value + " name:" + person.name + " name2:" + person.name2; + linkedEl.value = "4thNewVal"; + $(linkedEl).change(); + after = "name:" + person.name + " name2:" + person.name2; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "value: [object Object] name:Jo name2:Jo2|name:Jo name2:4thNewVal", + 'Data link using: - Initializes to current data item, and binds updated value of linkedElem back to "linkTo" target'); + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: '', + converters: { + myupper: function(val) { + return val.toUpperCase(); + }, + mylower: function(val) { + return val.toLowerCase(); + } + } + }).link("#result", person); + + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(linkedEl.value, "JO", + 'Data link using: - (tag.convert setting) - on data change: converts the value on the target input'); + + // ................................ Act .................................. + linkedEl.value = "ChangeTheName"; + $(linkedEl).change(); + + // ............................... Assert ................................. + assert.equal("name:" + person.name + " name2:" + person.name2, + "name:ANewName name2:changethename", + 'Data link using: ') + .link("#result", person); + + var tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(eventData, "init render onBind onAfterLink ", + 'Data link using: - event order for init, render, link'); + eventData = ""; + + // ................................ Act .................................. + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName"}); + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeChange onUpdate onAfterLink onAfterChange ", + 'Data link using: - event order for onUpdate'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "JoJo|newNamenewName", + 'Data link using: - binds data to linkedElem'); + + // ................................ Act .................................. + before = "value:" + tag.value + " name:" + person.name + " name2:" + person.name2; + linkedEl.value = "newVal"; + $(linkedEl).change(); + after = "value:" + tag.value + " name:" + person.name + " name2:" + person.name2; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal ", + 'Data link using: - event order for onChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "value:newName name:newName name2:Jo2|value:newName name:newName name2:newVal", + 'Data link using: - binds linkedElem back to "linkTo" target dataonChange'); + eventData = ""; + + // ................................ Reset .................................. + cancelChange = false; + person.name = "Jo"; + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: '', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "JO|Jo", + 'Data link using: - (tag.convert setting) - initial linking: converts the value on the target input'); + + // ................................ Act .................................. + $.observable(person).setProperty({name: "ANewName"}); + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "ANEWNAME|ANewName", + 'Data link using: - (tag.convert setting) - on data change: converts the value on the target input'); + + // ................................ Act .................................. + linkedEl.value = "ChangeTheName"; + $(linkedEl).change(); + + // ............................... Assert ................................. + assert.equal("name:" + person.name + " name2:" + person.name2 + " value:" + tag.value, + "name:ANewName name2:changethename value:ANewName", + 'Data link using: - (tag.convertBack setting) on element change: converts the data, and sets on "linkTo" target data'); + + // ................................ Reset .................................. + $("#result").empty(); + person.name = "Jo"; + person.name2 = "Jo2"; + cancelChange = false; + eventData = ""; + + // =============================== Arrange =============================== + //INLINE DATA-LINKED TAGS ON INPUT - WITH linkTo EXPRESSION + // ................................ Act .................................. + $.templates('{^{twoWayTag name linkTo=name2}}{{/twoWayTag}}') + .link("#result", person); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(eventData, "init render onBind onAfterLink ", + 'Data link using: {^{twoWayTag name linkTo=name2}} - event order for init, render, link'); + eventData = ""; + + // ................................ Act .................................. + before = tag.value + linkedEl.value; + + $.observable(person).setProperty({name: "newName"}); + after = tag.value + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeChange onUpdate onAfterLink onAfterChange ", + 'Data link using: {^{twoWayTag name linkTo=name2}} - event order for onUpdate'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "JoJo|newNamenewName", + 'Data link using: {^{twoWayTag name linkTo=name2}} - binds data to linkedElem'); + + // ................................ Act .................................. + before = "value:" + tag.value + " name:" + person.name + " name2:" + person.name2; + linkedEl.value = "newVal"; + $(linkedEl).change(); + after = "value:" + tag.value + " name:" + person.name + " name2:" + person.name2; + + // ............................... Assert ................................. + assert.equal(eventData, "onBeforeUpdateVal ", + 'Data link using: {^{twoWayTag name linkTo=name2}} - event order for onChange'); + eventData = ""; + + // ............................... Assert ................................. + assert.equal(before + "|" + after, + "value:newName name:newName name2:Jo2|value:newName name:newName name2:newVal", + 'Data link using: {^{twoWayTag name linkTo=name2}} - binds linkedElem back to "linkTo" target data'); + + // ................................ Reset .................................. + person.name = "Jo"; + person.name2 = "Jo2"; + + // =============================== Arrange =============================== + $.templates({ + markup: '{^{twoWayTag name linkTo=name2 convert="myupper" convertBack=~lower}}{{/twoWayTag}}', + converters: { + myupper: function(val) { + return val.toUpperCase(); + } + } + }).link("#result", person, { + lower: function(val) { + return val.toLowerCase(); + } + }); + + tag = $("#result").view(true).childTags("twoWayTag")[0]; + linkedEl = $("#linkedElm")[0]; + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "JO|Jo", + 'Data link using: {^{twoWayTag name linkTo=name2 convert="myupper"}} - (tag.convert setting) - initial linking: converts the value on the target input'); + + // ................................ Act .................................. + $.observable(person).setProperty({name: "ANewName"}); + + // ............................... Assert ................................. + assert.equal(linkedEl.value + "|" + tag.value, + "ANEWNAME|ANewName", + 'Data link using: {^{twoWayTag name linkTo=name2 convert="myupper"} - (tag.convert setting) - on data change: converts the value on the target input'); + + // ................................ Act .................................. + linkedEl = $("#linkedElm")[0]; + linkedEl.value = "ChangeTheName"; + $(linkedEl).change(); + + // ............................... Assert ................................. + assert.equal("name:" + person.name + " name2:" + person.name2 + " value:" + tag.value, + "name:ANewName name2:changethename value:ANewName", + 'Data link using: {^{twoWayTag name linkTo=name2 convertBack=~lower}} - (tag.convertBack setting) on element change: converts the data, and sets on "linkTo" target data'); + + // ............................... Reset ................................. + $("#result").empty(); + $.views.settings.trigger(true); +}); + +QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function(assert) { + $.views.settings.trigger(false); + + // =============================== Arrange =============================== + var person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag first/}}', + tags: { + mytag: { + template: ' {^{on ~tag.doupdate id="updateBtn"}}Update{{/on}}', + onBind: function() { + this.linkedElem = this.contents("input").first(); // Programmatically set linkedElem + }, + onAfterLink: function() { + this.contents(".nm").text(this.bndArgs()[0]); // Programmatically update span content + }, + doupdate: function() { + var val = this.bndArgs()[0] + this.cnt++ + this.updateValue(val).setValue(val); // Programmatically call update() from within tag + }, + onUpdate: false, + cnt: 0 // Counter for programmatically updated content + } + } + }).link("#result", person); + + var mytag = $.view().childTags("mytag")[0]; + var linkedEl = $("#linkedElm")[0]; + + var result = mytag.bndArgs() + "|" + linkedEl.value; + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob"}); + + result += "--" + mytag.bndArgs() + "|" + linkedEl.value; + + linkedEl.value = "newName" + + $(linkedEl).change(); + + result += "--" + mytag.bndArgs() + "|" + person.first; + + // ............................... Assert ................................. + assert.equal(result, "Jo|Jo--Bob|Bob--newName|newName", + "linkedElem set in onBind"); + + // ................................ Act .................................. + result = "" + mytag.bndArgs(); + + mytag.updateValue("updatedFirst").setValue("updatedFirst"); + + result += "--" + mytag.bndArgs() + "|" + linkedEl.value + "|" + person.first + "|" + $("#result").text(); + + // ................................ Act .................................. + + $("#updateBtn").click(); + + result += "--" + mytag.bndArgs() + "|" + linkedEl.value + "|" + person.first + "|" + $("#result").text(); + + assert.equal(result, + isIE8 ? "newName--updatedFirst|updatedFirst|updatedFirst|updatedFirstUpdate" + + "--updatedFirst0|updatedFirst0|updatedFirst0|updatedFirst0Update" + : "newName--updatedFirst|updatedFirst|updatedFirst|updatedFirst Update" + + "--updatedFirst0|updatedFirst0|updatedFirst0|updatedFirst0 Update", + "With linkedElem set in onBind, mytag.bndArgs() and mytag.updateValue().setValue() correctly access/update two-way bound values"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag first last/}}', + tags: { + mytag: { + bindTo: [0, 1], + template: ' ', + onBind: function(tagCtx) { + var inputs = tagCtx.contentView.contents("input"); + tagCtx.linkedElems = [$(inputs[0]), $(inputs[1])]; // Programmatically set linkedElems + }, + onAfterLink: function() { + this.contents(".nm").text(this.bndArgs()[0] + " " + this.bndArgs()[1]); // Programmatically update span content + }, + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + var linkedEl1 = $("#linkedElm1")[0]; + var linkedEl2 = $("#linkedElm2")[0]; + + result = mytag.bndArgs() + "|" + linkedEl1.value + "|" + linkedEl2.value; + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob", last: "Puff"}); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + linkedEl2.value + "|" + $("#result").text(); + + linkedEl1.value = "newFirst" + linkedEl2.value = "newLast" + + $(linkedEl1).change(); + $(linkedEl2).change(); + + result += "--" + mytag.bndArgs() + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo,Blow|Jo|Blow--Bob,Puff|Bob|Puff| Bob Puff--newFirst,newLast|newFirst|newLast| newFirst newLast", + 'With bindTo: [0, 1], and 2 linkedElems set in onBind, mytag.bndArgs() and mytag.updateValue() ' + + 'correctly access/update two-way bound values'); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag 1 first/}}', + tags: { + mytag: { + bindTo: 1, + template: ' ', + onBind: function() { + var inputs = this.contents("input"); + this.linkedElem = $(inputs[0]); // Programmatically set linkedElems + }, + onAfterLink: function() { + this.contents(".nm").text(this.bndArgs()[0]); // Programmatically update span content + }, + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + + result = mytag.bndArgs() + "|" + linkedEl1.value ; + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob"}); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + $("#result").text(); + + linkedEl1.value = "newFirst" + + $(linkedEl1).change(); + + result += "--" + mytag.bndArgs() + "|" + person.first + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo|Jo--Bob|Bob| Bob--newFirst|newFirst| newFirst", + 'With bindTo: 1, and linkedElem set in onBind, mytag.bndArgs() and mytag.updateValue()' + + 'correctly access/update two-way bound values'); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag name1=first name2=last/}}', + tags: { + mytag: { + bindTo: ["name1", "name2"], + template: ' ', + onBind: function(tagCtx) { + var inputs = tagCtx.contentView.contents("input"); + tagCtx.linkedElems = [$(inputs[0]), $(inputs[1])]; // Programmatically set linkedElems + }, + onAfterLink: function() { + this.contents(".nm").text(this.bndArgs()[0] + " " + this.bndArgs()[1]); // Programmatically update span content + }, + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + linkedEl2 = $("#linkedElm2")[0]; + + result = mytag.bndArgs() + "|" + linkedEl1.value + "|" + linkedEl2.value; + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob", last: "Puff"}); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + linkedEl2.value + "|" + $("#result").text(); + + linkedEl1.value = "newFirst" + linkedEl2.value = "newLast" + + $(linkedEl1).change(); + $(linkedEl2).change(); + + result += "--" + mytag.bndArgs() + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo,Blow|Jo|Blow--Bob,Puff|Bob|Puff| Bob Puff--newFirst,newLast|newFirst|newLast| newFirst newLast", + 'With bindTo: ["name1", "name2"], and 2 linkedElems set in onBind, mytag.bndArgs() and mytag.updateValue())' + + 'correctly access/update two-way bound values'); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag first/}}', + tags: { + mytag: { + linkedElement: "input", + template: '', + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl = $("#linkedElm")[0]; + + result = linkedEl.value; + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob"}); + + result += "--" + linkedEl.value; + + linkedEl.value = "newName" + + $(linkedEl).change(); + + result += "--" + person.first; + + mytag.updateValue("updatedFirst").setValue("updatedFirst"); + + result += "--" + person.first + "|" + linkedEl.value; + + // ............................... Assert ................................. + assert.equal(result, "Jo--Bob--newName--updatedFirst|updatedFirst", + "linkedElem set using linkedElement declaration"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag first/}}', + tags: { + mytag: { + linkedCtxParam: "frst", + template: '{^{:~frst}}', + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl = $("#linkedElm")[0]; + + result = linkedEl.value + "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob"}); + + result += "--" + linkedEl.value + "|" + $("#result").text(); + + linkedEl.value = "newName" + + $(linkedEl).change(); + + result += "--" + person.first + "|" + $("#result").text(); + + mytag.updateValue("updatedFirst").setValue("updatedFirst"); + + result += "--" + person.first + "|" + linkedEl.value + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo|Jo--Bob|Bob--newName|newName--updatedFirst|updatedFirst|updatedFirst", + "linkedCtxParam declaring a tag contextual parameter"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag first/}}', + tags: { + mytag: { + bindTo: [0], + linkedCtxParam: ["frst"], + template: '{^{:~frst}}', + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl = $("#linkedElm")[0]; + + result = linkedEl.value + "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob"}); + + result += "--" + linkedEl.value + "|" + $("#result").text(); + + linkedEl.value = "newName" + + $(linkedEl).change(); + + result += "--" + person.first + "|" + $("#result").text(); + + mytag.updateValue("updatedFirst"); + + result += "--" + person.first + "|" + linkedEl.value + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo|Jo--Bob|Bob--newName|newName--updatedFirst|updatedFirst|updatedFirst", + "bindTo and linkedCtxParam as arrays, declaring a tag contextual parameter"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag first last/}}', + tags: { + mytag: { + bindTo: [1, 0], + linkedCtxParam: ["lst", "frst"], + template: '{^{:~frst}} {^{:~lst}}', + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + linkedEl2 = $("#linkedElm2")[0]; + + result = linkedEl1.value + "|" + linkedEl2.value + "|" + $("#result").text(); + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob", last: "Puff"}); + + result += "--" + linkedEl1.value + "|" + linkedEl2.value + "|" + $("#result").text(); + + linkedEl1.value = "newFirst" + linkedEl2.value = "newLast" + + $(linkedEl1).change(); + $(linkedEl2).change(); + + result += "--" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo|Blow|Jo Blow--Bob|Puff|Bob Puff--newFirst|newLast|newFirst newLast", + "bindTo and linkedCtxParam as arrays, declaring tag contextual parameters"); + + // ................................ Act .................................. + result = "" + mytag.bndArgs(); + + mytag.updateValues("updatedFirst", "updatedLast").setValues("updatedFirst", "updatedLast"); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + linkedEl2.value + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + assert.equal(result, "newLast,newFirst--updatedFirst,updatedLast|updatedLast|updatedFirst|updatedLast|updatedFirst|updatedLast updatedFirst", + "mytag.bndArgs() and mytag.updateValues().setValues() work correctly for accessing/updating two-way bound tag contextual parameters"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag name1=first 1 last/}}', + tags: { + mytag: { + bindTo: ["name1", "1"], + linkedElement: ["input", "#linkedElm2"], + template: ' ', + onAfterLink: function() { + this.linkedElems[1].text(this.bndArgs()[1]); + } + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + linkedEl2 = $("#linkedElm2")[0]; + + result = linkedEl1.value + "|" + linkedEl2.innerText + "|" + $("#result").text(); + + // ................................ Act .................................. + mytag.updateValues("updatedFirst", "updatedLast").setValues("updatedFirst", "updatedLast"); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo|Blow| Blow--updatedFirst,updatedLast|updatedFirst|updatedFirst|updatedLast| updatedLast", + "mytag.bndArgs() and mytag.updateValues().setValues() work correctly for accessing/updating two-way bound linkedElems"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag name1=first 1 last/}}', + tags: { + mytag: { + bindTo: ["name1", "1"], + linkedElement: [undefined, "#linkedElm2"], + template: ' ', + onBind: function() { + var inputs = this.contents("input"); + this.linkedElems[0] = $(inputs[0]); // Programmatically set linkedElems + //}, + //onAfterLink: function() { + // this.linkedElems[1].text(this.bndArgs()[1]); + } + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + linkedEl2 = $("#linkedElm2")[0]; + + result = "" + + (linkedEl1 === mytag.linkedElems[0][0]) + + (linkedEl2 === mytag.linkedElems[1][0]) + + (linkedEl1 === mytag.linkedElem[0]) + + linkedEl1.value + "|" + linkedEl2.innerText + "|" + $("#result").text(); + + // ................................ Act .................................. + mytag.updateValues("updatedFirst", "updatedLast").setValues("updatedFirst", "updatedLast"); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "truetruetrueJo|Blow| Blow--updatedFirst,updatedLast|updatedFirst|updatedFirst|updatedLast| updatedLast", + "Mixed declarative linkedElement and programmatic onBind approaches for defining linkedElems"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag name1=first 1 last/}}', + tags: { + mytag: { + bindTo: ["name1", "1"], + linkedElement: [undefined, "#linkedElm2"], + template: ' ', + onBind: function() { + var inputs = this.contents("input"); + this.linkedElems[0] = $(inputs[0]); // Programmatically set linkedElems + //}, + //onAfterLink: function() { + // this.linkedElems[1].text(this.bndArgs()[0]); + } + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + linkedEl2 = $("#linkedElm2")[0]; + + result = linkedEl1.value + "|" + linkedEl2.innerText + "|" + $("#result").text(); + + // ................................ Act .................................. + mytag.updateValues("updatedFirst", "updatedLast").setValues("updatedFirst", "updatedLast"); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Jo|Blow| Blow--updatedFirst,updatedLast|updatedFirst|updatedFirst|updatedLast| updatedLast", + "Mixed declarative linkedElement and programmatic onBind approaches for defining linkedElems"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag name1=first 1 last/}}', + tags: { + mytag: { + bindTo: ["name1", "1"], + linkedElement: [undefined, "input"], + linkedCtxParam: ["foo", undefined], + template: ' ' + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + linkedEl2 = $("#linkedElm2")[0]; + + result = linkedEl1.value + "|" + linkedEl2.innerText + "|" + $("#result").text(); + + // ................................ Act .................................. + mytag.updateValues("updatedFirst", "updatedLast").setValues("updatedFirst", "updatedLast"); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Blow|Jo| Jo--updatedFirst,updatedLast|updatedLast|updatedFirst|updatedLast| updatedFirst", + "linkedCtxParam and linkedElem"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag first last/}}', + tags: { + mytag: { + bindTo: [0, 1], + linkedCtxParam: ["foo", undefined], + template: ' ', + onBind: function(tagCtx) { + var inputs = tagCtx.contentView.contents("input"); + tagCtx.linkedElems = [undefined, $(inputs[0])]; // Programmatically set linkedElems + }, + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = $("#linkedElm1")[0]; + linkedEl2 = $("#linkedElm2")[0]; + + result = linkedEl1.value + "|" + linkedEl2.innerText + "|" + $("#result").text(); + + // ................................ Act .................................. + mytag.updateValues("updatedFirst", "updatedLast").setValues("updatedFirst", "updatedLast"); + + result += "--" + mytag.bndArgs() + "|" + linkedEl1.value + "|" + person.first + "|" + person.last + "|" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(result, "Blow|Jo| Jo--updatedFirst,updatedLast|updatedLast|updatedFirst|updatedLast| updatedFirst", + "linkedCtxParam plus programmatic setting of linkedElem"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow", + cvt: function(first) { + return first.toUpperCase(); // bindTo: 1 (or [1]) so only one parameter + }, + cvtbk: function(first) { + return first.toLowerCase(); + } + }; + + $.templates({ + markup: '{^{mytag 1 first convert=cvt convertBack=cvtbk/}}', + tags: { + mytag: { + bindTo: 1, + linkedElement: ["input"], + template: '', + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl = mytag.linkedElem[0]; + + result = linkedEl.value; + + linkedEl.value += "+"; + mytag.linkedElem.change(); + + result = person.first + "|" + person.last; + + // ................................ Act .................................. + mytag.updateValue("updatedFirst").setValue(mytag.bndArgs()[0]); + + result += "--" + mytag.bndArgs() + "|" + linkedEl.value + "|" + person.first + "|" + person.last; + + // ............................... Assert ................................. + assert.equal(result, "jo+|Blow--UPDATEDFIRST|UPDATEDFIRST|updatedfirst|Blow", + "bindTo:1 with converters, using linkedElement with selector"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow", + cvt: function(arg1, arg2) { + return arg1.toUpperCase(); // No bindTo specified, so parameters are all the args + }, + cvtbk: function(first) { + return first.toLowerCase(); // No bindTo specified, so parameter is the linkedElem value + } + }; + + $.templates({ + markup: '{^{mytag first last convert=cvt convertBack=cvtbk/}}', + tags: { + mytag: { + linkedElement: ["input"], + template: '', + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl = mytag.linkedElem[0]; + + linkedEl.value += "+"; + mytag.linkedElem.change(); + + result = person.first + "|" + person.last; + + // ................................ Act .................................. + mytag.updateValues("updatedFirst", "updatedLast").setValues(mytag.bndArgs()[0], mytag.bndArgs()[1]); + + result += "--" + mytag.bndArgs() + "|" + linkedEl.value + "|" + person.first + "|" + person.last; + + // ............................... Assert ................................. + assert.equal(result, "jo+|Blow--UPDATEDFIRST|UPDATEDFIRST|updatedfirst|Blow", + "linkedEl with converters (no bindTo), using linkedElement with selector"); + + // =============================== Arrange =============================== + person = {first: "Jo", last: "Blow", + cvt: function(first, last) { + return [first + "*", last.toUpperCase()]; // bindTo: ["name1", 1] so two parameters - the bound args (as returned by tag.bndArgs()) + }, + cvtbk: function(first, last) { + return [first, last.toLowerCase()]; + } + }; + + $.templates({ + markup: '{^{mytag name1=first 1 last convert=cvt convertBack=cvtbk/}}', + tags: { + mytag: { + bindTo: ["name1", "1"], + linkedElement: [undefined, "input"], + linkedCtxParam: ["foo", undefined], + template: ' ' + } + } + }).link("#result", person); + + mytag = $.view().childTags("mytag")[0]; + linkedEl1 = mytag.contents("#linkedElm1")[0]; // first - param + linkedEl2 = mytag.linkedElems[1][0]; // last - el + + result = linkedEl1.innerText + "," + linkedEl2.value; // Jo*, BLOW + + linkedEl2.value += "+"; // BLOW+ + mytag.linkedElems[1].change(); + + result += "|" + person.first + "," + person.last; + + // ................................ Act .................................. + mytag.updateValues("updatedFirst", "updatedLast"); + mytag.setValues(mytag.bndArgs()[0], mytag.bndArgs()[1]); + + result += "|" + mytag.bndArgs() + "|" + linkedEl1.innerText + "," + linkedEl2.value + "|" + person.first + "," + person.last; + + // ............................... Assert ................................. + assert.equal(result, "Jo*,BLOW|Jo,blow+|updatedFirst*,UPDATEDLAST|updatedFirst*,UPDATEDLAST|updatedFirst,updatedlast", + "bindTo with converters, using linkedElement and linkedCtxParam"); + + // =============================== Arrange =============================== + $.views.tags("mytag", { + bindTo: ["height", "width"], + linkedElement: [".ht", ".wd"], + linkedCtxParam: ["ht", "wd"], + mainElement: "div", + template: "
                      {{include tmpl=#content/}}
                      ", + onBind: function() { + var tag = this; + tag.mainElem.mousedown(function(ev) { + var mainElem = tag.mainElem[0], + addedWidth = tag.mainElem.width() - ev.clientX, + addedHeight = tag.mainElem.height() - ev.clientY; + if (document.elementFromPoint(ev.clientX, ev.clientY) === mainElem) { + $(document.body).mousemove(function(ev2) { + var moveToX = ev2.clientX + addedWidth; + var moveToY = ev2.clientY + addedHeight; + tag.updateValues(moveToY, moveToX); + }); + } + }); + $(document.body).mouseup(function() { + $(document.body).off("mousemove"); + }); + }, + setValue: function(val, index, tagElse) { + if (val === undefined) { + val = this.getValue(tagElse)[index]; + } else { + this.mainElem[index ? "width" : "height"](val || 0); + } + this.tagCtxs[tagElse].ctxPrm(this.linkedCtxParam[index], val); + return val; + }, + getValue: function() { + var mainElem = this.mainElem; + return [mainElem.height(), mainElem.width()]; + }, + onUpdate: false, + setSize: true + }); + + var tmpl = $.templates('{^{mytag}}' + + ' ' + + ' ' + + '{{/mytag}}'); + + // ................................ Act .................................. + tmpl.link("#result"); + + mytag = $.view().childTags("mytag")[0]; + var linkedElHt = mytag.contents(true, ".ht")[0]; + var linkedElHt2 = mytag.linkedElems[0][0]; + var linkedElWd = mytag.contents(true, ".wd")[0]; + var linkedElWd2 = mytag.linkedElems[1][0]; + var linkedCtxPrmHts = mytag.contents(true, ".htc"); + var linkedCtxPrmWds = mytag.contents(true, ".wdc"); + + result = linkedElHt === linkedElHt2 && linkedElWd === linkedElWd2 + && linkedElHt.value === linkedCtxPrmHts[0].value && linkedElHt.value === linkedCtxPrmHts[1].value + && linkedElWd.value === linkedCtxPrmWds[0].value && linkedElWd.value === linkedCtxPrmWds[1].value; + + // ............................... Assert ................................. + assert.ok(result, + "linkedElement and linkedCtxParam for unset params are initialized by getValue"); + + // ................................ Act .................................. + linkedElHt.value = 40; + $(linkedElHt).change(); + linkedCtxPrmWds[1].value = 60; + $(linkedCtxPrmWds[1]).change(); + + result = linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElWd.value === "60" && linkedCtxPrmWds[0].value === "60" && linkedCtxPrmWds[1].value === "60"; + + result += "|" + mytag.getValue(); + + assert.equal(result, "true|40,60", + "linkedElement and linkedCtxParam for unset params continue to 2way-bind to shared value which is the tag.setValue/getValue"); + + // ................................ Act .................................. + tmpl = $.templates('{^{mytag height=30 width=40}}' + + ' ' + + ' ' + + '{{/mytag}}'); + + tmpl.link("#result"); + + mytag = $.view().childTags("mytag")[0]; + linkedElHt = mytag.contents(true, ".ht")[0]; + linkedElWd = mytag.contents(true, ".wd")[0]; + linkedCtxPrmHts = mytag.contents(true, ".htc"); + linkedCtxPrmWds = mytag.contents(true, ".wdc"); + + result = linkedElHt.value === "30" && linkedCtxPrmHts[0].value === "30" && linkedCtxPrmHts[1].value === "30" + && linkedElWd.value === "40" && linkedCtxPrmWds[0].value === "40" && linkedCtxPrmWds[1].value === "40"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|30,40", + "linkedElement and linkedCtxParam and tag.getValue() for static initial values initialize correctly"); + + // ................................ Act .................................. + linkedElHt.value = 40; + $(linkedElHt).change(); + linkedCtxPrmWds[1].value = 60; + $(linkedCtxPrmWds[1]).change(); + + result = linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElWd.value === "60" && linkedCtxPrmWds[0].value === "60" && linkedCtxPrmWds[1].value === "60"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|40,60", + "linkedElement and linkedCtxParam for static initial values continue to 2way-bind to shared value which is the tag.setValue/getValue value"); + + // ................................ Act .................................. + mytag.setValues(140, 160); + mytag.updateValues(140, 160); + + result = linkedElHt.value === "140" && linkedCtxPrmHts[0].value === "140" && linkedCtxPrmHts[1].value === "140" + && linkedElWd.value === "160" && linkedCtxPrmWds[0].value === "160" && linkedCtxPrmWds[1].value === "160"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|140,160", + "linkedElement and linkedCtxParam for static initial values continue to 2way-bind to shared value set by tag.setValues(), mytag.updateValues()"); + + // ................................ Act .................................. + tmpl = $.templates(' ' + + '{^{mytag height=cy width=cx}}' + + ' ' + + ' ' + + '{{/mytag}}'); + + tmpl.link("#result", {cx: 40, cy: 30}); + + mytag = $.view().childTags("mytag")[0]; + linkedElHt = mytag.contents(true, ".ht")[0]; + linkedElWd = mytag.contents(true, ".wd")[0]; + linkedCtxPrmHts = mytag.contents(true, ".htc"); + linkedCtxPrmWds = mytag.contents(true, ".wdc"); + var linkedElCx = $(".cx")[0], + linkedElCy = $(".cy")[0]; + + result = linkedElCy.value === "30" && linkedElHt.value === "30" && linkedCtxPrmHts[0].value === "30" && linkedCtxPrmHts[1].value === "30" + && linkedElCx.value === "40" && linkedElWd.value === "40" && linkedCtxPrmWds[0].value === "40" && linkedCtxPrmWds[1].value === "40"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|30,40", + "linkedElement and linkedCtxParam and tag.getValue() initialize correctly"); + + // ................................ Act .................................. + linkedElHt.value = 40; + $(linkedElHt).change(); + linkedCtxPrmWds[1].value = 60; + $(linkedCtxPrmWds[1]).change(); + + result = linkedElCy.value === "40" && linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElCx.value === "60" && linkedElWd.value === "60" && linkedCtxPrmWds[0].value === "60" && linkedCtxPrmWds[1].value === "60"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|40,60", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value which is the tag.setValue/getValue value"); + + // ................................ Act .................................. + linkedElCy.value = 50; + $(linkedElCy).change(); + linkedElCx.value = 70; + $(linkedElCx).change(); + + result = linkedElCy.value === "50" && linkedElHt.value === "50" && linkedCtxPrmHts[0].value === "50" && linkedCtxPrmHts[1].value === "50" + && linkedElCx.value === "70" && linkedElWd.value === "70" && linkedCtxPrmWds[0].value === "70" && linkedCtxPrmWds[1].value === "70"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|50,70", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value when external bindTo target value changes"); + + // ................................ Act .................................. + mytag.setValues(140, 160); + mytag.updateValues(140, 160); + + result = linkedElCy.value === "140" && linkedElHt.value === "140" && linkedCtxPrmHts[0].value === "140" && linkedCtxPrmHts[1].value === "140" + && linkedElCx.value === "160" && linkedElWd.value === "160" && linkedCtxPrmWds[0].value === "160" && linkedCtxPrmWds[1].value === "160"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|140,160", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value set by tag.setValues() - tag.updateValues()"); + + // ................................ Act .................................. + tmpl = $.templates('{^{mytag convert=~plus convertBack=~minus}}' + + ' ' + + ' ' + + '{{/mytag}}'); + var data = {cx: 100, cy: 200}; + tmpl.link("#result", data, { + plus: function(height, width) { + return [height !== undefined ? parseInt(height)+5 : height, width !== undefined ? parseInt(width)+10 : width]; + }, + minus: function(height, width) { + return [height !== undefined ? parseInt(height)-5 : height, width !== undefined ? parseInt(width)-10 : width]; + } + }); + + mytag = $.view().childTags("mytag")[0]; + var linkedElHt = mytag.contents(true, ".ht")[0]; + var linkedElHt2 = mytag.linkedElems[0][0]; + var linkedElWd = mytag.contents(true, ".wd")[0]; + var linkedElWd2 = mytag.linkedElems[1][0]; + var linkedCtxPrmHts = mytag.contents(true, ".htc"); + var linkedCtxPrmWds = mytag.contents(true, ".wdc"); + + result = linkedElHt === linkedElHt2 && linkedElWd === linkedElWd2 + && linkedElHt.value === linkedCtxPrmHts[0].value && linkedElHt.value === linkedCtxPrmHts[1].value + && linkedElWd.value === linkedCtxPrmWds[0].value && linkedElWd.value === linkedCtxPrmWds[1].value + && linkedElWd.value === "" + mytag.getValue()[1] && linkedElHt.value === "" + mytag.getValue()[0]; + + // ............................... Assert ................................. + assert.ok(result, + "linkedElement and linkedCtxParam for unset params are initialized by getValue (with converters)"); + + // ................................ Act .................................. + linkedElHt.value = 40; + $(linkedElHt).change(); + linkedCtxPrmWds[1].value = 60; + $(linkedCtxPrmWds[1]).change(); + + result = linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElWd.value === "60" && linkedCtxPrmWds[0].value === "60" && linkedCtxPrmWds[1].value === "60"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|40,60", + "linkedElement and linkedCtxParam for unset params continue to 2way-bind to shared value which is the tag.setValue/getValue (with converters)"); + + // ................................ Act .................................. + tmpl = $.templates('{^{mytag height=30 width=40 convert=~plus convertBack=~minus}}' + + ' ' + + ' ' + + '{{/mytag}}'); + + tmpl.link("#result", {}, { + plus: function(height, width) { + return [height !== undefined ? parseInt(height)+5 : height, width !== undefined ? parseInt(width)+10 : width]; + }, + minus: function(height, width) { + return [height !== undefined ? parseInt(height)-5 : height, width !== undefined ? parseInt(width)-10 : width]; + } + }); + + mytag = $.view().childTags("mytag")[0]; + linkedElHt = mytag.contents(true, ".ht")[0]; + linkedElWd = mytag.contents(true, ".wd")[0]; + linkedCtxPrmHts = mytag.contents(true, ".htc"); + linkedCtxPrmWds = mytag.contents(true, ".wdc"); + + result = linkedElHt.value === "35" && linkedCtxPrmHts[0].value === "35" && linkedCtxPrmHts[1].value === "35" + && linkedElWd.value === "50" && linkedCtxPrmWds[0].value === "50" && linkedCtxPrmWds[1].value === "50"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|35,50", + "linkedElement and linkedCtxParam and tag.getValue() for static initial values initialize correctly (with converters)"); + + // ................................ Act .................................. + linkedElHt.value = 40; + $(linkedElHt).change(); + linkedCtxPrmWds[1].value = 60; + $(linkedCtxPrmWds[1]).change(); + + result = linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElWd.value === "60" && linkedCtxPrmWds[0].value === "60" && linkedCtxPrmWds[1].value === "60"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|40,60", + "linkedElement and linkedCtxParam for static initial values continue to 2way-bind to shared value which is the tag.setValue/getValue value (with converters)"); + + // ................................ Act .................................. + mytag.setValue(140, 0); + mytag.setValue(160, 1); + mytag.updateValues(140, 160); + + result = linkedElHt.value === "140" && linkedCtxPrmHts[0].value === "140" && linkedCtxPrmHts[1].value === "140" + && linkedElWd.value === "160" && linkedCtxPrmWds[0].value === "160" && linkedCtxPrmWds[1].value === "160"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|140,160", + "linkedElement and linkedCtxParam for static initial values continue to 2way-bind to shared value set by tag.setValue(), mytag.updateValues() (with converters)"); + + // ................................ Act .................................. + tmpl = $.templates(' ' + + '{^{mytag height=cy width=cx convert=~plus convertBack=~minus}}' + + ' ' + + ' ' + + '{{/mytag}}'); + + tmpl.link("#result", {cx: 40, cy: 30}, { + plus: function(height, width) { + return [height !== undefined ? parseInt(height)+5 : height, width !== undefined ? parseInt(width)+10 : width]; + }, + minus: function(height, width) { + return [height !== undefined ? parseInt(height)-5 : height, width !== undefined ? parseInt(width)-10 : width]; + } + }); + + mytag = $.view().childTags("mytag")[0]; + linkedElHt = mytag.contents(true, ".ht")[0]; + linkedElWd = mytag.contents(true, ".wd")[0]; + linkedCtxPrmHts = mytag.contents(true, ".htc"); + linkedCtxPrmWds = mytag.contents(true, ".wdc"); + linkedElCx = $(".cx")[0]; + linkedElCy = $(".cy")[0]; + + result = linkedElCy.value === "30" && linkedElHt.value === "35" && linkedCtxPrmHts[0].value === "35" && linkedCtxPrmHts[1].value === "35" + && linkedElCx.value === "40" && linkedElWd.value === "50" && linkedCtxPrmWds[0].value === "50" && linkedCtxPrmWds[1].value === "50"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|35,50", + "linkedElement and linkedCtxParam and tag.getValue() initialize correctly (with converters)"); + + // ................................ Act .................................. + linkedElHt.value = 40; + $(linkedElHt).change(); + linkedCtxPrmWds[1].value = 60; + $(linkedCtxPrmWds[1]).change(); + + result = linkedElCy.value === "35" && linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElCx.value === "50" && linkedElWd.value === "60" && linkedCtxPrmWds[0].value === "60" && linkedCtxPrmWds[1].value === "60"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|40,60", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value which is the tag.setValue/getValue value (with converters)"); + + // ................................ Act .................................. + linkedElCy.value = 50; + $(linkedElCy).change(); + linkedElCx.value = 70; + $(linkedElCx).change(); + + result = linkedElCy.value === "50" && linkedElHt.value === "55" && linkedCtxPrmHts[0].value === "55" && linkedCtxPrmHts[1].value === "55" + && linkedElCx.value === "70" && linkedElWd.value === "80" && linkedCtxPrmWds[0].value === "80" && linkedCtxPrmWds[1].value === "80"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|55,80", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value when external bindTo target value changes (with converters)"); + + // ................................ Act .................................. + mytag.setValue(140, 0); + mytag.setValue(160, 1); + mytag.updateValues(140, 160); + + result = linkedElCy.value === "135" && linkedElHt.value === "140" && linkedCtxPrmHts[0].value === "140" && linkedCtxPrmHts[1].value === "140" + && linkedElCx.value === "150" && linkedElWd.value === "160" && linkedCtxPrmWds[0].value === "160" && linkedCtxPrmWds[1].value === "160"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|140,160", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value set by tag.setValue() - tag.updateValues() (with converters)"); + + // ................................ Act .................................. + tmpl = $.templates(' ' + + '{^{mytag width=cx convert=~plus convertBack=~minus}}' + + ' ' + + ' ' + + '{{/mytag}}'); + + tmpl.link("#result", {cx: 40, cy: 30}, { + plus: function(height, width) { + return [height !== undefined ? parseInt(height)+5 : height, width !== undefined ? parseInt(width)+10 : width]; + }, + minus: function(height, width) { + return [height !== undefined ? parseInt(height)-5 : height, width !== undefined ? parseInt(width)-10 : width]; + } + }); + + mytag = $.view().childTags("mytag")[0]; + linkedElHt = mytag.contents(true, ".ht")[0]; + linkedElWd = mytag.contents(true, ".wd")[0]; + linkedCtxPrmHts = mytag.contents(true, ".htc"); + linkedCtxPrmWds = mytag.contents(true, ".wdc"); + linkedElCx = $(".cx")[0]; + linkedElCy = $(".cy")[0]; + + result = linkedElHt.value === linkedCtxPrmHts[0].value && linkedElHt.value === linkedCtxPrmHts[1].value && Math.round(10*linkedElHt.value) === Math.round(10*mytag.getValue()[0]) + && linkedElCx.value === "40" && linkedElWd.value === "50" && linkedCtxPrmWds[0].value === "50" && linkedCtxPrmWds[1].value === "50"; + + result += "|" + mytag.getValue()[1]; + + // ............................... Assert ................................. + assert.equal(result, "true|50", + "linkedElement and linkedCtxParam and tag.getValue() initialize correctly (One bindTo param bound, other uninitialized. With converters)"); + + // ................................ Act .................................. + linkedElHt.value = 40; + $(linkedElHt).change(); + linkedCtxPrmWds[1].value = 60; + $(linkedCtxPrmWds[1]).change(); + + result = linkedElCy.value === "30" && linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElCx.value === "50" && linkedElWd.value === "60" && linkedCtxPrmWds[0].value === "60" && linkedCtxPrmWds[1].value === "60"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|40,60", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value which is the tag.setValue/getValue value (One bindTo param bound, other uninitialized. With converters)"); + + // ................................ Act .................................. + linkedElCy.value = 50; + $(linkedElCy).change(); + linkedElCx.value = 70; + $(linkedElCx).change(); + + result = linkedElCy.value === "50" && linkedElHt.value === "40" && linkedCtxPrmHts[0].value === "40" && linkedCtxPrmHts[1].value === "40" + && linkedElCx.value === "70" && linkedElWd.value === "80" && linkedCtxPrmWds[0].value === "80" && linkedCtxPrmWds[1].value === "80"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|40,80", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value when external bindTo target value changes (One bindTo param bound, other uninitialized. With converters)"); + + // ................................ Act .................................. + mytag.setValues(140, 160); + mytag.updateValues(140, 160); + + result = linkedElCy.value === "50" && linkedElHt.value === "140" && linkedCtxPrmHts[0].value === "140" && linkedCtxPrmHts[1].value === "140" + && linkedElCx.value === "150" && linkedElWd.value === "160" && linkedCtxPrmWds[0].value === "160" && linkedCtxPrmWds[1].value === "160"; + + result += "|" + mytag.getValue(); + + // ............................... Assert ................................. + assert.equal(result, "true|140,160", + "linkedElement and linkedCtxParam continue to 2way-bind to shared value set by tag.setValues() - tag.updateValues() (One bindTo param bound, other uninitialized. With converters)"); + + // =============================== Arrange =============================== + person = {first: "Jo", middle: "Herbert", last: "Blow"}; + + $.templates({ + markup: + '{^{textbox first label="First"}} {^{child ~nm/}}' + + '{{else middle label="Middle"}} {^{child ~nm/}}' + + '{{else last label="Last"}} {^{child ~nm/}}' + + '{{/textbox}}' + + '' + + '' + + ': ' + + '{^{:first}} {^{:middle}} {^{:last}}', + tags: { + textbox: { + linkedCtxParam: "nm", + onBind: function() { + // Find input in contents + var l = this.tagCtxs.length; + while (l--) { + var tagCtx = this.tagCtxs[l]; + tagCtx.linkedElems = [tagCtx.contents("input")]; + } + }, + template: " {{:~tagCtx.props.label}}{^{include tmpl=#content/}}", + onUpdate: false, // No need to re-render whole tag, when content updates. + }, + child: function(val) { + return val; + } + } + }).link("#result", person); + + var linkedElFirst = $("#First")[0], + linkedElMiddle = $("#Middle")[0], + linkedElLast = $("#Last")[0], + mytag = $.view(linkedElFirst).tag; + + function getResult() { + return "Data: " + person.first + "-" + person.middle + "-" + person.last + + " Inputs: " + linkedElFirst.value + "-" + linkedElMiddle.value + "-" + linkedElLast.value + + " Text:" + $("#result").text() + "|"; + } + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text:First Jo Middle Herbert Last Blow: Jo Herbert Blow|" + : "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text: First Jo Middle Herbert Last Blow: Jo Herbert Blow|", + "Two-way bound tag with multiple else blocks - initial render"); + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob", middle: "Xavier", last: "Smith"}); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text:FirstBob MiddleXavier LastSmith:BobXavierSmith|" + : "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text: First Bob Middle Xavier Last Smith: Bob Xavier Smith|", + "Two-way bound tag with multiple else blocks - observable update"); + + // ................................ Act .................................. + linkedElFirst.value = "newJo" + linkedElMiddle.value = "newHerbert" + linkedElLast.value = "newBlow" + $(linkedElFirst).change(); + $(linkedElMiddle).change(); + $(linkedElLast).change(); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + + " Text:FirstnewJo MiddlenewHerbert LastnewBlow:newJonewHerbertnewBlow|" + : "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + + " Text: First newJo Middle newHerbert Last newBlow: newJo newHerbert newBlow|", + "Two-way bound tag with multiple else blocks - updated inputs"); + + // ................................ Act .................................. + mytag.updateValue("updatedFirst", 0, 0); + mytag.updateValue("updatedMiddle", 0, 1); + mytag.updateValue("updatedLast", 0, 2); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text:FirstupdatedFirst MiddleupdatedMiddle LastupdatedLast:updatedFirstupdatedMiddleupdatedLast|" + : "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text: First updatedFirst Middle updatedMiddle Last updatedLast: updatedFirst updatedMiddle updatedLast|", + "Two-way bound tag with multiple else blocks - tag.updateValue() updates outer bindings and linkedCtxPrm, but not linkedElems"); + + // ................................ Act .................................. + mytag.updateValues("updatedFirst2"); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" + : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", + "Two-way bound tag with multiple else blocks - tag.updateValues() updates outer bindings and linkedCtxPrm, but not linkedElems"); + + // ................................ Act .................................. + mytag.setValue("changedFirst", 0, 0); + mytag.setValue("changedMiddle", 0, 1); + mytag.setValue("changedLast", 0, 2); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" + : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", + "Two-way bound tag with multiple else blocks - tag.setValue() updates linkedElems only"); + + // ................................ Act .................................. + mytag.setValues("changedFirst2"); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" + : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", + "Two-way bound tag with multiple else blocks - tag.setValues() updates linkedElems only"); + + // ............................... Assert ................................. + assert.ok(mytag.contents("input")[1] === mytag.tagCtxs[1].contents("input")[0] + && mytag.nodes()[isIE8 ? 4 : 5] === mytag.tagCtxs[1].nodes()[1] + && mytag.nodes()[isIE8 ? 4 : 5] === mytag.tagCtxs[1].contentView.nodes()[1] + && mytag.childTags("child")[1] === mytag.tagCtxs[1].childTags("child")[0] + && mytag.childTags("child").length === mytag.tagCtxs[0].childTags("child").length + mytag.tagCtxs[1].childTags("child").length + mytag.tagCtxs[2].childTags("child").length, + "Two-way bound tag, multiple else blocks: calls tagCtx.contents() tagCtx.nodes() tagCtx.childTags() return from one else block." + + " (Whereas tag.contents() etc returns from all else blocks)"); + + // =============================== Arrange =============================== + person = {first: "Jo", middle: "Herbert", last: "Blow"}; + + $.templates({ + markup: + '{^{textbox first label="First"}} {^{child ~nm/}}' + + '{{else middle label="Middle"}} {^{child ~nm/}}' + + '{{else last label="Last"}} {^{child ~nm/}}' + + '{{/textbox}}' + + '' + + '' + + ': ' + + '{^{:first}} {^{:middle}} {^{:last}}', + tags: { + textbox: { + render: function() { + return " " + this.tagCtx.props.label + "" + this.tagCtx.render(); + }, + linkedCtxParam: "nm", + onBind: function() { + // Find input in contents + var l = this.tagCtxs.length; + while (l--) { + var tagCtx = this.tagCtxs[l]; + tagCtx.linkedElems = [tagCtx.contents("input")]; + } + }, + onUpdate: false, // No need to re-render whole tag, when content updates. + }, + child: function(val) { + return val; + } + } + }).link("#result", person); + + linkedElFirst = $("#First")[0]; + linkedElMiddle = $("#Middle")[0]; + linkedElLast = $("#Last")[0]; + mytag = $.view(linkedElFirst).tag; + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text:First Jo Middle Herbert Last Blow: Jo Herbert Blow|" + : "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text: First Jo Middle Herbert Last Blow: Jo Herbert Blow|", + "Two-way bound tag (using render method) with multiple else blocks - initial render"); + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob", middle: "Xavier", last: "Smith"}); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text:FirstBob MiddleXavier LastSmith:BobXavierSmith|" + : "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text: First Bob Middle Xavier Last Smith: Bob Xavier Smith|", + "Two-way bound tag (using render method) with multiple else blocks - observable update"); + + // ................................ Act .................................. + linkedElFirst.value = "newJo" + linkedElMiddle.value = "newHerbert" + linkedElLast.value = "newBlow" + $(linkedElFirst).change(); + $(linkedElMiddle).change(); + $(linkedElLast).change(); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + + " Text:FirstnewJo MiddlenewHerbert LastnewBlow:newJonewHerbertnewBlow|" + : "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + + " Text: First newJo Middle newHerbert Last newBlow: newJo newHerbert newBlow|", + "Two-way bound tag (using render method) with multiple else blocks - updated inputs"); + + // ................................ Act .................................. + mytag.updateValue("updatedFirst", 0, 0); + mytag.updateValue("updatedMiddle", 0, 1); + mytag.updateValue("updatedLast", 0, 2); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text:FirstupdatedFirst MiddleupdatedMiddle LastupdatedLast:updatedFirstupdatedMiddleupdatedLast|" + : "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text: First updatedFirst Middle updatedMiddle Last updatedLast: updatedFirst updatedMiddle updatedLast|", + "Two-way bound tag (using render method) with multiple else blocks - tag.updateValue() updates outer bindings and linkedCtxPrm, but not linkedElems"); + + // ................................ Act .................................. + mytag.updateValues("updatedFirst2"); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" + : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", + "Two-way bound tag (using render method) with multiple else blocks - tag.updateValues() updates outer bindings and linkedCtxPrm, but not linkedElems"); + + // ................................ Act .................................. + mytag.setValue("changedFirst", 0, 0); + mytag.setValue("changedMiddle", 0, 1); + mytag.setValue("changedLast", 0, 2); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" + : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", + "Two-way bound tag (using render method) with multiple else blocks - tag.setValue() updates linkedElems only"); + + // ................................ Act .................................. + mytag.setValues("changedFirst2"); + + // ............................... Assert ................................. + assert.equal(getResult(), isIE8 + ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" + : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", + "Two-way bound tag (using render method) with multiple else blocks - tag.setValues() updates linkedElems only"); + + // ............................... Assert ................................. + assert.ok(mytag.contents("input")[1] === mytag.tagCtxs[1].contents("input")[0] + && mytag.nodes()[isIE8 ? 4 : 5] === mytag.tagCtxs[1].nodes()[1] + && mytag.childTags("child")[1] === mytag.tagCtxs[1].childTags("child")[0], + "Two-way bound tag (using render method) with multiple else blocks - calls to tagCtx.contents() tagCtx.nodes() tagCtx.childTags() work correctly"); + + // =============================== Arrange =============================== + var person = {first: "Jo", last: "Blow"}; + + $.templates({ + markup: '{^{mytag 0 prop=first last}}{{else 0 prop=last first}}{{/mytag}} {^{:first}} {^{:last}}', + tags: { + mytag: { + bindTo: ["prop", 1], + template: '
                      ', + onBind: function() { + var tagCtx0 = this.tagCtxs[0]; + var tagCtx1 = this.tagCtxs[1]; + var inputs0 = tagCtx0.contents("input"); + var inputs1 = tagCtx1.contents("input"); + tagCtx0.linkedElems = [$(inputs0[0]), $(inputs0[1])]; // Programmatically set linkedElems + tagCtx1.linkedElems = [$(inputs1[0]), $(inputs1[1])]; // Programmatically set linkedElems + }, + onAfterLink: function() { + var tagCtx0 = this.tagCtxs[0]; + var tagCtx1 = this.tagCtxs[1]; + var span0 = tagCtx0.contents(".nm"); + var span1 = tagCtx1.contents(".nm"); + span0.text(tagCtx0.bndArgs()[0] + " " + tagCtx0.bndArgs()[1]); // Programmatically update span content + span1.text(tagCtx1.bndArgs()[0] + " " + tagCtx1.bndArgs()[1]); // Programmatically update span content + }, + onUpdate: false + } + } + }).link("#result", person); + + mytag = $.view().childTags()[0]; + var linkedElems0 = mytag.tagCtx.contents("input"); + var linkedElems1 = mytag.tagCtxs[1].contents("input"); + + function getResult2() { + return "Data: " + person.first + "-" + person.last + + " Inputs: " + linkedElems0[0].value + "-" + linkedElems0[1].value + "-" + linkedElems1[0].value + "-" + linkedElems1[1].value + + " Text:" + $("#result").text() + "|"; + } + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: Jo-Blow Inputs: Jo-Blow-Blow-Jo Text: Jo Blow Blow JoJo Blow|" + : "Data: Jo-Blow Inputs: Jo-Blow-Blow-Jo Text: Jo Blow Blow Jo Jo Blow|", + "Two-way tag with multiple bindings and multiple else blocks - initial render"); + + // ................................ Act .................................. + $.observable(person).setProperty({first: "Bob", last: "Smith"}); + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: Bob-Smith Inputs: Bob-Smith-Smith-Bob Text: Bob Smith Smith BobBobSmith|" + : "Data: Bob-Smith Inputs: Bob-Smith-Smith-Bob Text: Bob Smith Smith Bob Bob Smith|", + "Two-way tag with multiple bindings and multiple else blocks - observable update"); + + // ................................ Act .................................. + // Change inputs of {{else}} block + linkedElems1[0].value = "newBlow" + linkedElems1[1].value = "newJo" + $(linkedElems1[0]).change(); + $(linkedElems1[1]).change(); + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: newJo-newBlow Inputs: Bob-Smith-newBlow-newJo Text: newJo newBlow newBlow newJonewJonewBlow|" + : "Data: newJo-newBlow Inputs: Bob-Smith-newBlow-newJo Text: newJo newBlow newBlow newJo newJo newBlow|", + "Two-way tag with multiple bindings and multiple else blocks - updated inputs"); + + // ................................ Act .................................. + // Update each value for {{else}} block + mytag.updateValue("updatedLast", 0, 1); + mytag.updateValue("updatedFirst", 1, 1); + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: updatedFirst-updatedLast Inputs: Bob-Smith-newBlow-newJo" + + " Text: updatedFirst updatedLast updatedLast updatedFirstupdatedFirstupdatedLast|" + : "Data: updatedFirst-updatedLast Inputs: Bob-Smith-newBlow-newJo" + + " Text: updatedFirst updatedLast updatedLast updatedFirst updatedFirst updatedLast|", + "Two-way tag with multiple bindings and multiple else blocks - tag.updateValue() updates outer bindings but not linkedElems"); + + // ................................ Act .................................. + // Update values for tag (main block) + mytag.updateValues("updatedFirst2", "updatedLast2"); + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-newBlow-newJo" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" + : "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-newBlow-newJo" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", + "Two-way tag with multiple bindings and multiple else blocks - tag.updateValues() updates outer bindings but not linkedElems"); + + // ................................ Act .................................. + // Set each value for {{else}} block + mytag.setValue("changedLast", 0, 1); + mytag.setValue("changedFirst", 1, 1); + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast-changedFirst" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" + : "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast-changedFirst" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", + "Two-way tag with multiple bindings and multiple else blocks - tag.setValue() updates linkedElems only"); + + // ................................ Act .................................. + // Set values for {{else}} block + mytag.tagCtxs[1].setValues("changedLast2", "changedFirst2"); + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast2-changedFirst2" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" + : "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast2-changedFirst2" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", + "Two-way tag with multiple bindings and multiple else blocks - tagCtx.setValues() updates linkedElems only"); + + // ................................ Act .................................. + // Set values for tag (main block) + mytag.setValues("changedFirst3", "changedLast3"); + + // ............................... Assert ................................. + assert.equal(getResult2(), isIE8 + ? "Data: updatedFirst2-updatedLast2 Inputs: changedFirst3-changedLast3-changedLast2-changedFirst2" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" + : "Data: updatedFirst2-updatedLast2 Inputs: changedFirst3-changedLast3-changedLast2-changedFirst2" + + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", + "Two-way tag with multiple bindings and multiple else blocks - tag.setValues() updates linkedElems only"); + + // ............................... Assert ................................. + assert.ok(mytag.contents("input")[3] === mytag.tagCtxs[1].contents("input")[1] + && mytag.nodes()[6] === mytag.tagCtxs[1].nodes()[1], + "Two-way tag with multiple bindings and multiple else blocks - calls to tagCtx.contents() tagCtx.nodes() work correctly"); + + // ............................... Assert ................................. + assert.equal("" + mytag.cvtArgs() + "|" + mytag.tagCtxs[0].cvtArgs() + "|" + mytag.tagCtxs[1].cvtArgs() + + "--" + mytag.bndArgs() + "|" + mytag.tagCtxs[0].bndArgs() + "|" + mytag.tagCtxs[1].bndArgs(), + "0,updatedLast2|0,updatedLast2|0,updatedFirst2--updatedFirst2,updatedLast2|updatedFirst2,updatedLast2|updatedLast2,updatedFirst2", + "Two-way tag with multiple bindings and multiple else blocks - calls to tag.cvtArgs(), tagCtx.cvtArgs() tag.bndArgs() tagCtx.bndArgs() work correctly"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + + $("#result").html( + '
                      ' + + '
                      ' + ); + + $.views.tags("namebox", { + setSize: true, + template: '
                      X
                      ', + linkedElement: "input", + displayElement: "span", + mainElement: "div", + onBind: function(tagCtx) { + var tagCtx1 = this.tagCtxs[1]; + logElems && logElems(this.linkedElems, this.linkedElem, this.mainElem, this.displayElem, + tagCtx.linkedElems, tagCtx.mainElem, tagCtx.displayElem, + tagCtx1.linkedElems, tagCtx1.mainElem, tagCtx1.displayElem); + } + }); + + ret = ""; + data = { + first: "Jo", + last: "Blow" + }; + + // ................................ Act .................................. + var logElems = function(linkedElems, linkedElem, mainElem, displayElem, + linkedElems0, mainElem0, displayElem0, + linkedElems1, mainElem1, displayElem1 ) { + ret += "|" + (linkedElems === linkedElems0) + + " " + (linkedElem === linkedElems[0]) + + " " + (mainElem === mainElem0) + + " " + (displayElem === displayElem0) + + " " + linkedElem[0].tagName + mainElem[0].tagName + displayElem[0].tagName + }; + + $.templates('' + + '{^{namebox first class="nm1" id="id1" width=66}}{{else last width=24 class="nm2" id="id2" }}{{/namebox}}' + + '

                      ') + .link("#page", data); + + $.link(true, ".top", data); + + logElems = undefined; + + // ............................... Assert ................................. + assert.equal(ret, "|true true true true INPUTDIVSPAN|true true true true INPUTDIVSPAN|true true true true INPUTDIVSPAN", + "Two-way tag: linkedElements|displayElement|mainElement settings lead to appropriate linkedElems|linkedElem|displayElem|mainElem values on tag and on tagCtx, in onBind()"); + + assert.ok($(".nm1").length === 3 && $(".nm2").length === 3 && $("#id1")[0].tagName === "DIV" && $("#id2")[0].tagName === "DIV" && $("#id3")[0].tagName === "DIV" && $("#id4")[0].tagName === "DIV" && $("#id6")[0].tagName === "DIV" && !$("#id5")[0], + "Two-way tag: displayElement and mainElement settings lead to class and id assignment as expected on displayElem and mainElem"); + + // ................................ Act .................................. + var inputs = $("#result input"); + ret = inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $.observable(data).setProperty({first: "Jeff", last: "Blye"}); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[0]).val("Pete").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[3]).val("Bains").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[4]).val("Bill").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + + $(inputs[7]).val("Banks").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + + // ............................... Assert ................................. + assert.equal(ret, "JoBlowJoBlowJoBlowJoBlow|JeffBlyeJeffBlyeJeffBlyeJeffBlye|PeteBlyePeteBlyePeteBlyePeteBlye|PeteBainsPeteBainsPeteBainsPeteBains|BillBainsBillBainsBillBainsBillBains|BillBanksBillBanksBillBanksBillBanks", + "Two-way tag: linkedElems 2-way binding is correct whether inline, data-linked, or top-level data-linked tag"); + + // =============================== Arrange =============================== + + $("#result").html( + '
                      ' + + '
                      ' + ); + + $.views.tags("namebox", { + onUpdate: false, + setSize: true, + template: '
                      X
                      ', + linkedElement: "input", + displayElement: "span", + mainElement: "div", + onBind: function(tagCtx) { + var tagCtx1 = this.tagCtxs[1]; + logElems && logElems(this.linkedElems, this.linkedElem, this.mainElem, this.displayElem, + tagCtx.linkedElems, tagCtx.mainElem, tagCtx.displayElem, + tagCtx1.linkedElems, tagCtx1.mainElem, tagCtx1.displayElem); + } + }); + + ret = ""; + data = { + first: "Jo", + last: "Blow" + }; + + logElems = function(linkedElems, linkedElem, mainElem, displayElem, + linkedElems0, mainElem0, displayElem0, + linkedElems1, mainElem1, displayElem1 ) { + ret += "|" + (linkedElems === linkedElems0) + + " " + (linkedElem === linkedElems[0]) + + " " + (mainElem === mainElem0) + + " " + (displayElem === displayElem0) + + " " + linkedElem[0].tagName + mainElem[0].tagName + displayElem[0].tagName + }; + + $.templates('' + + '{^{namebox first class="nm1" id="id1" width=66}}{{else last width=24 class="nm2" id="id2" }}{{/namebox}}' + + '

                      ') + .link("#page", data); + + $.link(true, ".top", data); + + logElems = undefined; + + // ............................... Assert ................................. + assert.equal(ret, "|true true true true INPUTDIVSPAN|true true true true INPUTDIVSPAN|true true true true INPUTDIVSPAN", + "Two-way tag (onUpdate false): linkedElements|displayElement|mainElement settings lead to appropriate linkedElems|linkedElem|displayElem|mainElem values on tag and on tagCtx, in onBind()"); + + assert.ok($(".nm1").length === 3 && $(".nm2").length === 3 && $("#id1")[0].tagName === "DIV" && $("#id2")[0].tagName === "DIV" && $("#id3")[0].tagName === "DIV" && $("#id4")[0].tagName === "DIV" && $("#id6")[0].tagName === "DIV" && !$("#id5")[0], + "Two-way tag (onUpdate false): displayElement and mainElement settings lead to class and id assignment as expected on displayElem and mainElem"); + + // ................................ Act .................................. + inputs = $("#result input"); + ret = inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $.observable(data).setProperty({first: "Jeff", last: "Blye"}); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[0]).val("Pete").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[3]).val("Bains").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[4]).val("Bill").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[7]).val("Banks").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + + // ............................... Assert ................................. + assert.equal(ret, "JoBlowJoBlowJoBlowJoBlow|JeffBlyeJeffBlyeJeffBlyeJeffBlye|PeteBlyePeteBlyePeteBlyePeteBlye|PeteBainsPeteBainsPeteBainsPeteBains|BillBainsBillBainsBillBainsBillBains|BillBanksBillBanksBillBanksBillBanks", + "Two-way tag (onUpdate false): linkedElems 2-way binding is correct whether inline, data-linked, or top-level data-linked tag"); + + // =============================== Arrange =============================== + + $("#result").html( + '
                      ' + + '
                      ' + ); + + $.views.tags("namebox", { + setSize: true, + template: '
                      X
                      ', + onBind: function(tagCtx) { + this.tagCtxs[0].linkedElems=[this.tagCtxs[0].contents(true, "input")]; + this.tagCtxs[0].displayElem=this.tagCtxs[0].contents(true, "span"); + this.tagCtxs[0].mainElem=this.tagCtxs[0].contents(true, "div"); + this.tagCtxs[1].linkedElems=[this.tagCtxs[1].contents(true, "input")]; + this.tagCtxs[1].displayElem=this.tagCtxs[1].contents(true, "div"); + this.tagCtxs[1].mainElem=this.tagCtxs[1].contents(true, "span"); + } + }); + + ret = ""; + data = { + first: "Jo", + last: "Blow" + }; + + $.templates('' + + '{^{namebox first class="nm1" id="id1" width=66}}{{else last width=24 class="nm2" id="id2" }}{{/namebox}}' + + '

                      ') + .link("#page", data); + + $.link(true, ".top", data); + + // ............................... Assert ................................. + assert.ok( $(".nm1").length === 3 && $(".nm2").length === 3 && $("#id1")[0].tagName === "DIV" && $("#id2")[0].tagName === "SPAN" && $("#id3")[0].tagName === "DIV" && $("#id4")[0].tagName === "SPAN" && $("#id5")[0].tagName === "DIV" && $("#id6")[0].tagName === "SPAN", + "Two-way tag: setting tagCtx.linkedElems|displayElem|mainElem in onBind lead to class and id assignment as expected on displayElem and mainElem"); + + // ................................ Act .................................. + inputs = $("#result input"); + ret = inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $.observable(data).setProperty({first: "Jeff", last: "Blye"}); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[0]).val("Pete").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[3]).val("Bains").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[4]).val("Bill").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[7]).val("Banks").change(); + inputs = $("#result input"); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + + // ............................... Assert ................................. + assert.equal(ret, "JoBlowJoBlowJoBlowJoBlow|JeffBlyeJeffBlyeJeffBlyeJeffBlye|PeteBlyePeteBlyePeteBlyePeteBlye|PeteBainsPeteBainsPeteBainsPeteBains|BillBainsBillBainsBillBainsBillBains|BillBanksBillBanksBillBanksBillBanks", + "Two-way tag: setting tagCtx.linkedElems|displayElem|mainElem in onBind lead to correct 2-way binding, whether inline, data-linked, or top-level data-linked tag"); + + // =============================== Arrange =============================== + + $("#result").html( + '
                      ' + + '
                      ' + ); + + $.views.tags("namebox", { + onUpdate: false, + setSize: true, + template: '
                      X
                      ', + onBind: function(tagCtx) { + this.linkedElems=[this.tagCtxs[0].contents(true, "input")]; + // this.linkedElem=this.tagCtxs[0].contents(true, "input"); // also works + this.displayElem=this.tagCtxs[0].contents(true, "span"); + this.mainElem=this.tagCtxs[0].contents(true, "div"); + + this.tagCtxs[1].linkedElems=[this.tagCtxs[1].contents(true, "input")]; + this.tagCtxs[1].displayElem=this.tagCtxs[1].contents(true, "div"); + this.tagCtxs[1].mainElem=this.tagCtxs[1].contents(true, "span"); + } + }); + + ret = ""; + data = { + first: "Jo", + last: "Blow" + }; + + $.templates('' + + '{^{namebox first class="nm1" id="id1" width=66}}{{else last width=24 class="nm2" id="id2" }}{{/namebox}}' + + '

                      ') + .link("#page", data); + + $.link(true, ".top", data); + + // ............................... Assert ................................. + assert.ok( $(".nm1").length === 3 && $(".nm2").length === 3 && $("#id1")[0].tagName === "DIV" && $("#id2")[0].tagName === "SPAN" && $("#id3")[0].tagName === "DIV" && $("#id4")[0].tagName === "SPAN" && $("#id5")[0].tagName === "DIV" && $("#id6")[0].tagName === "SPAN", + "Two-way tag: setting tag.linkedElem(s) and tagCtx|displayElem|mainElem in onBind lead to class and id assignment as expected on displayElem and mainElem"); + + // ................................ Act .................................. + inputs = $("#result input"); + ret = inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $.observable(data).setProperty({first: "Jeff", last: "Blye"}); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[0]).val("Pete").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[3]).val("Bains").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[4]).val("Bill").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + $(inputs[7]).val("Banks").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value + inputs[4].value + inputs[5].value + inputs[6].value + inputs[7].value; + + // ............................... Assert ................................. + assert.equal(ret, "JoBlowJoBlowJoBlowJoBlow|JeffBlyeJeffBlyeJeffBlyeJeffBlye|PeteBlyePeteBlyePeteBlyePeteBlye|PeteBainsPeteBainsPeteBainsPeteBains|BillBainsBillBainsBillBainsBillBains|BillBanksBillBanksBillBanksBillBanks", + "Two-way tag: setting tag.linkedElem(s) and tagCtx|displayElem|mainElem in onBind lead to correct 2-way binding, whether inline, data-linked, or top-level data-linked tag"); + + // =============================== Arrange =============================== + + $.views.tags("namebox", { + onUpdate: false, + setSize: true, + onBind: function(tagCtx) { + this.linkedElems=[this.tagCtxs[0].contents(true, "input")]; + // this.linkedElem=this.tagCtxs[0].contents(true, "input"); // also works + this.displayElem=this.tagCtxs[0].contents(true, "span"); + this.mainElem=this.tagCtxs[0].contents(true, "div"); + + this.tagCtxs[1].linkedElems=[this.tagCtxs[1].contents(true, "input")]; + this.tagCtxs[1].displayElem=this.tagCtxs[1].contents(true, "div"); + this.tagCtxs[1].mainElem=this.tagCtxs[1].contents(true, "span"); + } + }); + + ret = ""; + data = { + first: "Jo", + last: "Blow" + }; + + $.templates('' + + '{^{namebox first class="nm1" id="id1" width=66}}
                      X
                      {{else last width=24 class="nm2" id="id2" }}
                      X
                      {{/namebox}}') + .link("#result", data); + + // ............................... Assert ................................. + assert.ok( $(".nm1").length === 1 && $(".nm2").length === 1 && $("#id1")[0].tagName === "DIV" && $("#id2")[0].tagName === "SPAN", + "Two-way tag, no template: setting tag.linkedElem(s) and tagCtx|displayElem|mainElem in onBind lead to class and id assignment as expected on displayElem and mainElem, within wrapped content"); + + // ................................ Act .................................. + inputs = $("#result input"); + ret = inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value; + $.observable(data).setProperty({first: "Jeff", last: "Blye"}); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value; + $(inputs[0]).val("Pete").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value; + $(inputs[1]).val("Bains").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value; + $(inputs[2]).val("Jim").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value; + $(inputs[3]).val("Banks").change(); + ret += "|" + inputs[0].value + inputs[1].value + inputs[2].value + inputs[3].value; + + // ............................... Assert ................................. + assert.equal(ret, "JoBlowJoBlow|JeffBlyeJeffBlye|PeteBlyePeteBlye|PeteBainsPeteBains|JimBainsJimBains|JimBanksJimBanks", + "Two-way tag, no template: setting tag.linkedElem(s) and tagCtx|displayElem|mainElem in onBind lead to correct 2-way binding, on inputs in wrapped content"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + var ret, + data = {current: "cur", modified: "mod"}; + + $.templates({ + markup: '{^{mytag current modified/}}', + tags: { + mytag: { + onUpdate: false, + bindTo: 1, + bindFrom: 0, + linkedElement: "input", + linkedCtxParam: "fm", + template: "", + update: function(val) { + this.updateValue(val); // Update external data, through two-way binding + } + } + } + }).link("#result", data); + + mytag = $.view().childTags()[0]; + var linkedElem = mytag.tagCtx.contents("input")[0]; + + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur-mod:cur", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): initial render"); + + // ................................ Act .................................. + $.observable(data).setProperty({current: "cur2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod:cur2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): bindFrom binding updates from data"); + + // ................................ Act .................................. + $.observable(data).setProperty({modified: "mod2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod2:cur2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): bindTo binding does not update from data"); + + // ................................ Act .................................. + linkedElem.value = "set1"; + $(linkedElem).change(); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:set1", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): bindTo binding updates to data - bindFrom binding does not"); + + // ................................ Act .................................. + mytag.setValue("setval", 0, 0); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:setval", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): setValue works"); + + // ................................ Act .................................. + mytag.setValues("setval2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:setval2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): setValues works"); + + // ................................ Act .................................. + mytag.update("updated1"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated1:setval2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): update() updates bindTo target"); + + // ................................ Act .................................. + mytag.updateValue("updated2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated2:setval2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): update() updates bindTo target (variant)"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + + data = {current: "cur", modified: "mod"}; + + $.templates({ + markup: '{^{mytag modified current/}}', + tags: { + mytag: { + onUpdate: false, + bindTo: 0, + bindFrom: 1, + linkedElement: "input", + linkedCtxParam: "fm", + template: "", + update: function(val) { + this.updateValue(val); // Update external data, through two-way binding + } + } + } + }).link("#result", data); + + mytag = $.view().childTags()[0]; + var linkedElem = mytag.tagCtx.contents("input")[0]; + + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur-mod:cur", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): initial render"); + + // ................................ Act .................................. + $.observable(data).setProperty({current: "cur2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod:cur2", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): bindFrom binding updates from data"); + + // ................................ Act .................................. + $.observable(data).setProperty({modified: "mod2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod2:cur2", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): bindTo binding does not update from data"); + + // ................................ Act .................................. + linkedElem.value = "set1"; + $(linkedElem).change(); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:set1", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): bindTo binding updates to data - bindFrom binding does not"); + + // ................................ Act .................................. + mytag.setValue("setval", 0, 0); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:setval", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): setValue works"); + + // ................................ Act .................................. + mytag.setValues("setval2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:setval2", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): setValues works"); + + // ................................ Act .................................. + mytag.update("updated1"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated1:setval2", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): update() updates bindTo target"); + + // ................................ Act .................................. + mytag.updateValue("updated2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated2:setval2", + "Two-way tag with bindTo and bindFrom to different paths (0, 1): update() updates bindTo target (variant)"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + + data = {current: "cur", modified: "mod"}; + + $.templates({ + markup: '{^{mytag modified current convert=~cvt convertBack=~cvb/}}', + tags: { + mytag: { + onUpdate: false, + bindTo: 0, + bindFrom: 1, + linkedElement: "input", + linkedCtxParam: "fm", + template: "", + update: function(val) { + this.updateValue(val); // Update external data, through two-way binding + } + } + } + }).link("#result", data, { + cvt: function(val) { + return val; + }, + cvb: function(val) { + return val; + } +}); + + mytag = $.view().childTags()[0]; + var linkedElem = mytag.tagCtx.contents("input")[0]; + + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur-mod:cur", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): initial render"); + + // ................................ Act .................................. + $.observable(data).setProperty({current: "cur2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod:cur2", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): bindFrom binding updates from data"); + + // ................................ Act .................................. + $.observable(data).setProperty({modified: "mod2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod2:cur2", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): bindTo binding does not update from data"); + + // ................................ Act .................................. + linkedElem.value = "set1"; + $(linkedElem).change(); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:set1", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): bindTo binding updates to data - bindFrom binding does not"); + + // ................................ Act .................................. + mytag.setValue("setval", 0, 0); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:setval", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): setValue works"); + + // ................................ Act .................................. + mytag.setValues("setval2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:setval2", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): setValues works"); + + // ................................ Act .................................. + mytag.update("updated1"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated1:setval2", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): update() updates bindTo target"); + + // ................................ Act .................................. + mytag.updateValue("updated2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value; + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated2:setval2", + "Two-way tag plus cvt/cvtback with bindTo and bindFrom to different paths (0, 1): update() updates bindTo target (variant)"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + + data = {current: "cur", modified: "mod"}; + + $.templates({ + markup: '{^{mytag modified fm=current/}}', + tags: { + mytag: { + onUpdate: false, + bindTo: 0, + bindFrom: "fm", + linkedElement: "input", + linkedCtxParam: "fm", + template: "", + update: function(val) { + this.updateValue(val); // Update external data, through two-way binding + } + } + } + }).link("#result", data); + + mytag = $.view().childTags()[0]; + var linkedElem = mytag.tagCtx.contents("input")[0]; + + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur-mod:-cur", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): initial render"); + + // ................................ Act .................................. + $.observable(data).setProperty({current: "cur2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod:-cur2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): bindFrom binding updates from data"); + + // ................................ Act .................................. + $.observable(data).setProperty({modified: "mod2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod2:-cur2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): bindTo binding does not update from data"); + + // ................................ Act .................................. + linkedElem.value = "set1"; + $(linkedElem).change(); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:set1-cur2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): bindTo binding updates to data - bindFrom binding does not"); + + // ................................ Act .................................. + mytag.setValue("setval", 0, 0); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:set1-setval", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): setValue sets the bindFrom linkedPrm but not the bindTo linkedElem"); + + // ................................ Act .................................. + mytag.setValues("setval2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1:set1-setval2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): setValues sets the bindFrom linkedPrm but not the bindTo linkedElem"); + + // ................................ Act .................................. + mytag.update("updated1"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated1:set1-setval2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): update() updates bindTo target"); + + // ................................ Act .................................. + mytag.updateValue("updated2"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updated2:set1-setval2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0): update() updates bindTo target (variant)"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + + data = {current: "cur", modified: "mod", two: 2, title: "Title"}; + + $.templates({ + markup: '{^{mytag modified 1 two fm=current title=title/}}', + tags: { + mytag: { + onUpdate: false, + bindTo: [0, "title"], + bindFrom: ["fm", 1, 2], + linkedElement: ["input", ".title"], + linkedCtxParam: ["fm", undefined, "arg2"], + template: "{^{:~arg2}}", + convert: function(from, one, two) { + return [from + "F", one + "O", two + "T"]; + }, + setValue: function(val, ind, tagElse) { + return val + "V" + ind; + }, + convertBack: function(val, one) { + return [ + val ? val + "V" : undefined, + one ? one + "O" : undefined + ]; + } + } + } + }).link("#result", data); + + mytag = $.view().childTags()[0]; + var linkedElem = mytag.tagCtx.contents("input")[0]; + + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur-mod:curFV0-2TV2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: initial render"); + + // ................................ Act .................................. + $.observable(data).setProperty({current: "cur2", two: "two2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod:cur2FV0-two2TV2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: bindFrom binding updates from data"); + + // ................................ Act .................................. + $.observable(data).setProperty({modified: "mod2"}); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-mod2:cur2FV0-two2TV2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: bindTo binding does not update from data"); + + // ................................ Act .................................. + linkedElem.value = "set1"; + $(linkedElem).change(); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1V:set1-two2TV2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: bindTo binding updates to data - bindFrom binding does not"); + + // ................................ Act .................................. + mytag.setValue("setval", 0, 0); + mytag.setValue("setval2", 2, 0); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1V:setvalV0-setval2V2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: setValue sets the bindFrom linkedPrm but not the bindTo linkedElem"); + + // ................................ Act .................................. + mytag.setValues("setval3", "setval4", "setval5"); + ret = data.current + "-" + data.modified + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-set1V:setval3V0-setval5V2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: setValues sets the bindFrom linkedPrm but not the bindTo linkedElem"); + + // ................................ Act .................................. + mytag.updateValue("updatedMod2", 0); + mytag.updateValue("updatedTitle2", 1); + ret = data.current + "-" + data.modified + "-" + data.title + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updatedMod2V-updatedTitle2O:setval3V0-setval5V2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: update() updates bindTo target (variant)"); + + // ................................ Act .................................. + mytag.updateValues("updateMod3", "updateTitle3"); + ret = data.current + "-" + data.modified + "-" + data.title + ":" + linkedElem.value + "-" + $("#result").text(); + + // ............................... Assert ................................. + assert.equal(ret, "cur2-updateMod3V-updateTitle3O:setval3V0-setval5V2", + "Two-way tag with bindTo and bindFrom to different paths ('fm', 0) and convert/convertBack: update() updates bindTo target (variant)"); + +// ............................... Reset ................................. + $("#result").empty(); + + // =============================== Arrange =============================== + + data = {current1: "cur1", modified1: "mod1", current2: "cur2", modified2: "mod2"}; + $.templates({ + markup: "
                      " + + "
                      " + + "{^{mytag current1 modified1}}" + + "{{else current2 modified2 }}" + + "{{/mytag}}", + tags: { + mytag: { + onUpdate: false, + bindTo: 1, + bindFrom: 0, + linkedElement: "input", + linkedCtxParam: "fm", + template: "
                      ", + update: function(index, val) { + this.updateValue(val, 0, index); + }, + set: function(index, val) { + this.tagCtxs[index].setValues(val); + }, + convert: function(val) { + return val + "C"; + }, + convertBack: function(val) { + return val + "B"; + } + } + } + }).link("#result", data); + + mytag = $.view().childTags()[0]; + var fromCur1 = $("#result .fromCur1")[0], + toMod1 = $("#result .toMod1")[0], + fromCur2 = $("#result .fromCur2")[0], + toMod2 = $("#result .toMod2")[0], + linkedEl1 = mytag.tagCtx.contents(".linkedEl")[0], + linkedPrm1 = mytag.tagCtx.contents(".linkedPrm")[0], + linkedEl2 = mytag.tagCtxs[1].contents(".linkedEl")[0], + linkedPrm2 = mytag.tagCtxs[1].contents(".linkedPrm")[0], + getRet = function() { + return fromCur1.value + "|" + toMod1.value + "|" + fromCur2.value + "|" + toMod2.value + "|" + + linkedEl1.value + "|" + linkedPrm1.value + "|" + linkedEl2.value + "|" + linkedPrm2.value; + }; + + // ............................... Assert ................................. + assert.equal(getRet(), "cur1|mod1|cur2|mod2||cur1C||cur2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): initial render"); + + // ................................ Act .................................. + fromCur1.value = "from1"; + $(fromCur1).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|mod1|cur2|mod2||from1C||cur2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change from"); + + // ................................ Act .................................. + toMod1.value = "to1"; + $(toMod1).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|to1|cur2|mod2||from1C||cur2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change to"); + + // ................................ Act .................................. + fromCur2.value = "from2"; + $(fromCur2).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|to1|from2|mod2||from1C||from2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change from {{else}}"); + + // ................................ Act .................................. + toMod2.value = "to2"; + $(toMod2).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|to1|from2|to2||from1C||from2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change to {{else}}"); + + // ................................ Act .................................. + linkedEl1.value = "el1"; + $(linkedEl1).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|el1B|from2|to2|el1|from1C||from2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change linked"); + + // ................................ Act .................................. + linkedPrm1.value = "prm1"; + $(linkedPrm1).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|el1B|from2|to2|el1|prm1||from2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change ctx prm"); + + // ................................ Act .................................. + linkedEl2.value = "el2"; + $(linkedEl2).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|el1B|from2|el2B|el1|prm1|el2|from2C", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change linked {{else}}"); + + // ................................ Act .................................. + linkedPrm2.value = "prm2"; + $(linkedPrm2).change(); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|el1B|from2|el2B|el1|prm1|el2|prm2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): change ctx prm {{else}}"); + + // ................................ Act .................................. + mytag.update(0, "upd1"); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|upd1B|from2|el2B|el1|prm1|el2|prm2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): updateValue"); + + // ................................ Act .................................. + mytag.update(1, "upd2"); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|upd1B|from2|upd2B|el1|prm1|el2|prm2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): updateValue {{else}}"); + + // ................................ Act .................................. + mytag.set(0, "set1"); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|upd1B|from2|upd2B|el1|set1|el2|prm2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): setValues"); + + // ................................ Act .................................. + mytag.set(1, "set2"); + + // ............................... Assert ................................. + assert.equal(getRet(), "from1|upd1B|from2|upd2B|el1|set1|el2|set2", + "Two-way tag with bindTo and bindFrom to different paths (1, 0): setValues {{else}}"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + + data = { + arrA:[{val:'value 1'}], + objA2:{0: {val:'value 2'}}, + objA3:{x: {val:'value 3'}}, + objA4:{x: {val:'value 4'}}, + arrB:[{val:'value 1'}], + objB2:{0: {val:'value 2'}}, + objB3:{x: {val:'value 3'}}, + objB4:{x: {val:'value 4'}}, + arrC:[{val:'value 1'}], + objC2:{0: {val:'value 2'}}, + objC3:{x: {val:'value 3'}}, + objC4:{x: {val:'value 4'}}, + arrD:[{val:'value 1'}], + objD2:{0: {val:'value 2'}}, + objD3:{x: {val:'value 3'}}, + objD4:{x: {val:'value 4'}} + }; + + $.templates({ + markup: + "{^{mytag arrA[0].val objA2['0'].val objA3['x'].val objA4.x.val p1=arrB[0].val p2=objB2['0'].val p3=objB3['x'].val p4=objB4.x.val}}" + + "{{else arrC[0].val objC2['0'].val objC3['x'].val objC4.x.val p1=arrD[0].val p2=objD2['0'].val p3=objD3['x'].val p4=objD4.x.val}}" + + "{{/mytag}}", + tags: { + mytag: { + onUpdate: false, + bindTo: [0 ,1, 2, 3, 'p1', 'p2', 'p3', 'p4'], + template: "" + } + } + }).link("#result", data); + + mytag = $.view().childTags()[0]; + + // ................................ Act .................................. + mytag.updateValue("new1").updateValue("new2", 1).updateValue("new3", 2).updateValue("new4", 3) + .updateValue("new5", 4).updateValue("new6", 5).updateValue("new7", 6).updateValue("new8", 7) + .updateValue("new9", 0, 1).updateValue("new10", 1, 1).updateValue("new11", 2, 1).updateValue("new12", 3, 1) + .updateValue("new13", 4, 1).updateValue("new14", 5, 1).updateValue("new15", 6, 1).updateValue("new16", 7, 1); + + // ............................... Assert ................................. + assert.equal(data.arrA[0].val + data.objA2['0'].val + data.objA3.x.val + data.objA4.x.val + data.arrB[0].val + data.objB2['0'].val + data.objB3.x.val + data.objB4.x.val + data.arrC[0].val + data.objC2['0'].val + data.objC3.x.val + data.objC4.x.val + data.arrD[0].val + data.objD2['0'].val + data.objD3.x.val + data.objD4.x.val, + "new1new2new3new4new5new6new7new8new9new10new11new12new13new14new15new16", "updateValue() binds to paths with [...].val accessors"); + + // ................................ Act .................................. + + mytag.updateValues("more1", "more2", "more3", "more4", "more5", "more6", "more7", "more8"); + + // ............................... Assert ................................. + assert.equal(data.arrA[0].val + data.objA2['0'].val + data.objA3.x.val + data.objA4.x.val + data.arrB[0].val + data.objB2['0'].val + data.objB3.x.val + data.objB4.x.val + data.arrC[0].val + data.objC2['0'].val + data.objC3.x.val + data.objC4.x.val + data.arrD[0].val + data.objD2['0'].val + data.objD3.x.val + data.objD4.x.val, + "more1more2more3more4more5more6more7more8new9new10new11new12new13new14new15new16", "updateValues() binds to paths with [...].val accessors"); + +// ............................... Reset ................................. + + $("#result").empty(); + + // =============================== Arrange =============================== + var store = { + arrA: {val:'value 1'}, + objA2: {val:'value 2'}, + objA3: {val:'value 3'}, + objA4: {val:'value 4'}, + arrB: {val:'value 1'}, + objB2: {val:'value 2'}, + objB3: {val:'value 3'}, + objB4: {val:'value 4'}, + arrC: {val:'value 1'}, + objC2: {val:'value 2'}, + objC3: {val:'value 3'}, + objC4: {val:'value 4'}, + arrD: {val:'value 1'}, + objD2: {val:'value 2'}, + objD3: {val:'value 3'}, + objD4: {val:'value 4'} + }; + + data = { + arrA: function() { return store.arrA }, + objA2: function() { return store.objA2 }, + objA3: function() { return store.objA3 }, + objA4: function() { return store.objA4 }, + arrB: function() { return store.arrB }, + objB2: function() { return store.objB2 }, + objB3: function() { return store.objB3 }, + objB4: function() { return store.objB4 }, + arrC: function() { return store.arrC }, + objC2: function() { return store.objC2 }, + objC3: function() { return store.objC3 }, + objC4: function() { return store.objC4 }, + arrD: function() { return store.arrD }, + objD2: function() { return store.objD2 }, + objD3: function() { return store.objD3 }, + objD4: function() { return store.objD4 }, + }; + + $.templates({ + markup: + "{^{mytag arrA().val objA2().val objA3().val objA4().val p1=arrB().val p2=objB2().val p3=objB3().val p4=objB4().val}}" + + "{{else arrC().val objC2().val objC3().val objC4().val p1=arrD().val p2=objD2().val p3=objD3().val p4=objD4().val}}" + + "{{/mytag}}", + tags: { + mytag: { + onUpdate: false, + bindTo: [0 ,1, 2, 3, 'p1', 'p2', 'p3', 'p4'], + template: "" + } + } + }).link("#result", data); + + mytag = $.view().childTags()[0]; + + // ................................ Act .................................. + mytag.updateValue("new1").updateValue("new2", 1).updateValue("new3", 2).updateValue("new4", 3) + .updateValue("new5", 4).updateValue("new6", 5).updateValue("new7", 6).updateValue("new8", 7) + .updateValue("new9", 0, 1).updateValue("new10", 1, 1).updateValue("new11", 2, 1).updateValue("new12", 3, 1) + .updateValue("new13", 4, 1).updateValue("new14", 5, 1).updateValue("new15", 6, 1).updateValue("new16", 7, 1); + + // ............................... Assert ................................. + assert.equal(store.arrA.val + store.objA2.val + store.objA3.val + store.objA4.val + store.arrB.val + store.objB2.val + store.objB3.val + store.objB4.val + store.arrC.val + store.objC2.val + store.objC3.val + store.objC4.val + store.arrD.val + store.objD2.val + store.objD3.val + store.objD4.val, + "new1new2new3new4new5new6new7new8new9new10new11new12new13new14new15new16", "updateValue() binds to paths with computed().val paths"); + + // ................................ Act .................................. + + mytag.updateValues("more1", "more2", "more3", "more4", "more5", "more6", "more7", "more8"); + + // ............................... Assert ................................. + assert.equal(store.arrA.val + store.objA2.val + store.objA3.val + store.objA4.val + store.arrB.val + store.objB2.val + store.objB3.val + store.objB4.val + store.arrC.val + store.objC2.val + store.objC3.val + store.objC4.val + store.arrD.val + store.objD2.val + store.objD3.val + store.objD4.val, + "more1more2more3more4more5more6more7more8new9new10new11new12new13new14new15new16", "updateValues() binds to paths computed().val paths"); + +// ............................... Reset ................................. + + $("#result").empty(); + $.views.settings.trigger(true); +}); + +QUnit.test("Tag control events", function(assert) { + + // =============================== Arrange =============================== + var eventData = ""; + model.things = [{thing: "box"}]; // reset Prop + + // ................................ Act .................................. + $.templates({ + markup: '
                      {^{myWidget person1.lastName things/}}
                      ', + tags: { + myWidget: { + init: function(tagCtx, linkCtx, ctx) { + eventData += "init "; + }, + render: function(name, things) { + eventData += "render "; + return "" + name + " " + things.length + " " + this.getType() + ""; + }, + onBeforeUpdateVal: function(ev, eventArgs) { + eventData += "onBeforeUpdateVal "; + }, + onUpdate: function(ev, eventArgs, newTagCtxs) { + eventData += "update "; + }, + onArrayChange: function(ev, eventArgs) { + eventData += "onArrayChange "; + }, + onAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + var tag = this, + data = tagCtx.args[1]; + if (tag._boundArray && data !== tag._boundArray) { + $.unobserve(tag._boundArray, tag._arCh); // Different array, so remove handler from previous array + tag._boundArray = undefined; + } + if (!tag._boundArray && $.isArray(data)) { + $.observe(tag._boundArray = data, tag._arCh = function(ev, eventArgs) { // Store array data as tag._boundArray, and arrayChangeHandler as tag._arCh + tag.onArrayChange(ev, eventArgs); + }); + } + eventData += "after "; + }, + onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onBind "; + }, + onUnbind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onUnbind "; + }, + onBeforeChange: function(ev, eventArgs) { + eventData += "onBeforeChange "; + }, + onAfterChange: function(ev, eventArgs) { + eventData += "onAfterChange "; + }, + onDispose: function() { + var tag = this; + if (tag._boundArray) { + $.unobserve(tag._boundArray, tag._arCh); // Remove arrayChange handler from bound array + } + eventData += "dispose "; + }, + getType: function() { + eventData += "getType "; + return this.type; + }, + type: "special" + } + } + }).link("#result", model); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "One 1 special|init render getType onBind after ", '{^{myWidget/}} - Events fire in order during rendering: render and onAfterLink'); + + // ................................ Act .................................. + $.observable(person1).setProperty("lastName", "Two"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "Two 1 special|init render getType onBind after onBeforeChange update onUnbind render getType onBind after onAfterChange ", '{^{myWidget/}} - Events fire in order during update: update, render and onAfterLink'); + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "tree"}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "Two 1 special|init render getType onBind after onBeforeChange update onUnbind render getType onBind after onAfterChange onArrayChange ", '{^{myWidget/}} - Events fire in order during update: update, render and onAfterLink'); + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "|init render getType onBind after onBeforeChange update onUnbind render getType onBind after onAfterChange onArrayChange onUnbind dispose ", '{^{myWidget/}} - onDispose fires when container element is emptied or removed'); + + // ................................ Reset ................................ + person1.lastName = "One"; + model.things = []; + eventData = ""; + + // =============================== Arrange =============================== + + // ................................ Act .................................. + $.templates({ + markup: '
                      {^{myNoRenderWidget/}}
                      ', + tags: { + myNoRenderWidget: { + init: function(tagCtx, linkCtx, ctx) { + eventData += "init "; + }, + onAfterLink: function() { + eventData += "after "; + }, + onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onBind "; + }, + onUnbind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onUnbind "; + }, + onBeforeChange: function(ev, eventArgs) { + eventData += "onBeforeChange "; + }, + onAfterChange: function(ev, eventArgs) { + eventData += "onAfterChange "; + } + } + } + }).link("#result", person1); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "|init onBind after ", '{^{myNoRenderWidget/}} - A data-linked tag control which does not render fires init and onAfterLink'); + + $("#result").empty(); + + //TODO: Add tests for attaching jQuery UI widgets or similar to tag controls, using data-link and {^{mytag}} inline data binding. + +}); + +})(this, this.jQuery); \ No newline at end of file diff --git a/test/unit-tests/tests-jsviews.js b/test/unit-tests/tests-jsviews.js index e6b1dbe..4a25a6d 100644 --- a/test/unit-tests/tests-jsviews.js +++ b/test/unit-tests/tests-jsviews.js @@ -4,13 +4,9 @@ /* Setup */ var inputOrKeydownContentEditable, - isIE8 = window.attachEvent && !window.addEventListener, - isIE = window.navigator.userAgent, useInput = "oninput" in document, inputOrKeydown = useInput ? "input" : "keydown"; - - isIE = isIE.indexOf('MSIE ') > 0 || isIE.indexOf('Trident/') > 0; - inputOrKeydownContentEditable = isIE ? "keydown" : "input"; + inputOrKeydownContentEditable = "input"; function keydown(elem) { if (useInput) { @@ -435,15 +431,26 @@ function reset() { // End Setup -//test("TEST", function() { -//}); -//return; QUnit.module("Template structure"); QUnit.test("Template validation", function(assert) { $.views.settings.advanced({_jsv: true}); // For using window._jsv + // =============================== Arrange =============================== + $.templates('
                      {{if 1}}X{{:a}}{{/if}}
                      ') + .link("#result", {a: "yes"}); + + // ............................... Assert ................................. + assert.ok($("#result div").text() === "Xyes" && $("#result div").prop("title") === "yes", "Tag markup works within element content, or within element markup, for non element-only elements (
                      )"); + + // =============================== Arrange =============================== + $.templates('
                      • {{if 1}}X{{:a}}{{/if}}
                      ') + .link("#result", {a: "yes"}); + + // ............................... Assert ................................. + assert.ok($("#result ul").text() === "Xyes" && $("#result ul").prop("title") === "yes", "Tag markup works within element content, or within element markup, for element-only elements (
                        )"); + // =============================== Arrange =============================== try { $.templates('' @@ -599,10 +606,10 @@ QUnit.test("Template validation", function(assert) { .link("#result", markupData); // ................................ Act .................................. - res = "" + ($("#result").html().indexOf(isIE8 ? "": "")>60); + res = "" + ($("#result").html().indexOf("")>60); $.observable(markupData).setProperty("markup", "

                        "); - res += "|" + ($("#result").html().indexOf(isIE8 ? "

                        ": "

                        ")>60); + res += "|" + ($("#result").html().indexOf("

                        ")>60); // ............................... Assert ................................. assert.equal(res, "true|true", "Validation - void elements inserted from data can have self-close slashes, or not..."); @@ -816,8 +823,8 @@ var tmpl1 = $.templates( ); var tmpl2 = $.templates( - '
                      • ' - + '
                      • click me
                      • ' + '
                      • ' + + '
                      • click me
                      • ' + '
                      • ' + '{^{for things}}
                      • inserted
                      • {{/for}}' ), @@ -825,7 +832,7 @@ var tmpl2 = $.templates( data = {name:"Jo", things:[]}, clicked = 0, helpers = { - clicked: function() { + clicked: function(val) { clicked += 1; } }; @@ -1172,8 +1179,7 @@ QUnit.test("Top-level linking", function(assert) { res += "|" + $("#result").text(); // ............................... Assert ................................. - assert.equal(res, (isIE8 ? "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName -newName lead:newName - " - : "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName - newName lead:newName - "), + assert.equal(res, ("Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName - newName lead:newName - "), "Top level bindings allow passing in new contextual parameters to template: data-link=\"{for people ~team=#data tmpl=..."); // ................................ Reset ................................ @@ -1269,9 +1275,7 @@ setTimeout(function() { after += "|" + $("#result").text() + $("#result input").val(); // ............................... Assert ................................. - assert.equal(before + "|" + after, - (isIE8 ? 'OneOneOne|newLastnewLastnewLast|modLastmodLastmodLast' - : 'One One One|newLast newLast newLast|modLast modLast modLast'), + assert.equal(before + "|" + after, 'One One One|newLast newLast newLast|modLast modLast modLast', '$.link(expression, ".target", data, helpers) links expression to multiple target elements, including two-way bindings (equivalent to data-link="expression" on each element)'); // ................................ Act .................................. @@ -1301,9 +1305,7 @@ setTimeout(function() { after += "|" + $("#result").text() + $("#result input").val(); // ............................... Assert ................................. - assert.equal(before + "|" + after, - (isIE8 ? 'OneOneOne|newLastnewLastnewLast|modLastmodLastmodLast' - : 'One One One|newLast newLast newLast|modLast modLast modLast'), + assert.equal(before + "|" + after, 'One One One|newLast newLast newLast|modLast modLast modLast', '$(".target").link(expression, data, helpers) links expression to multiple target elements, including two-way bindings (equivalent to data-link="expression" on each element)'); // ................................ Act .................................. @@ -1344,12 +1346,9 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'NAME: OneNAME: OneOne One One One|' - + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' - + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast', '$.link(expression, selector, data, helpers) links expression to multiple targets on multiple target elements, including two-way bindings'); // ................................ Act .................................. @@ -1383,14 +1382,10 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'NAME: OneNAME: OneOne One One One|' - + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast|' - + 'NEWTMPLNAME: modLastNEWTMPLNAME: modLastmodLast modLast modLast modLast' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + ' NAME: modLast NAME: modLast modLast modLast modLast modLast|' - + ' NEWTMPLNAME: modLast NEWTMPLNAME: modLast modLast modLast modLast modLast'), + + ' NEWTMPLNAME: modLast NEWTMPLNAME: modLast modLast modLast modLast modLast', '$(selector).link(expression, data, helpers) links expression to multiple targets on multiple target elements, including binding to passed in templates'); // ................................ Act .................................. @@ -1424,12 +1419,9 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'NAME: One NAME: OneOne One One One|' - + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' - + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast', '$.link(true, ".inner", data, helpers) links multiple targets on multiple target elements, including two-way bindings'); // ................................ Act .................................. @@ -1462,12 +1454,9 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'NAME: One NAME: OneOne One One One|' - + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' - + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast', '$(".inner").link(true, data, helpers) links multiple targets on multiple target elements, including two-way bindings'); // ................................ Act .................................. @@ -1500,12 +1489,9 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'NAME: One NAME: OneOne One One One|' - + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' - + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast', '$(container).link(true, data, helpers) links multiple targets on multiple target elements, including two-way bindings'); // ................................ Act .................................. @@ -1538,12 +1524,9 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'NAME: One NAME: OneOne One One One|' - + 'NAME:newLast NAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLast NAME:modLastmodLast modLast modLast modLast' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' - + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast', '$(container).link(true, data, helpers) links multiple targets on multiple target elements, including two-way bindings'); // ................................ Act .................................. @@ -1576,12 +1559,9 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'NAME: OneNAME: OneOne One One One|' - + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' - + ' NAME: modLast NAME: modLast modLast modLast modLast modLast'), + + ' NAME: modLast NAME: modLast modLast modLast modLast modLast', '$.link(expression, selector, data, helpers) links correctly to multiple targets on multiple target elements within a linked rendered template'); // ................................ Act .................................. @@ -1619,14 +1599,10 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 ? 'green outerVal |' - + 'green outerVal Inside green outerVal Foo NAME: One|' - + 'green outerVal Inside green outerVal Foo NAME:newLast|' - + 'red outerVal Insidered outerVal Foo NAME:newLast' - : 'green outerVal |' + 'green outerVal |' + 'green outerVal Inside green outerVal Foo NAME: One|' + 'green outerVal Inside green outerVal Foo NAME: newLast|' - + 'red outerVal Inside red outerVal Foo NAME: newLast'), + + 'red outerVal Inside red outerVal Foo NAME: newLast', '$.link(expression, selector, data, helpers) links correctly to target elements within a linked rendered template - and extends the context of the target view'); // ................................ Act .................................. @@ -1671,15 +1647,10 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after + " - Model1: " + model.person1.lastName + "- Model2: " + model2.person1.lastName, - (isIE8 - ? 'NAME: OneNAME: OneOne One One One|' - + 'NAME:newLastNAME:newLastnewLast newLast newLast newLast|' - + 'NAME:modLastNAME:modLastmodLast modLast modLast modLast' - + ' - Model1: modLast- Model2: lastModel2Name' - : ' NAME: One NAME: One One One One One|' + ' NAME: One NAME: One One One One One|' + ' NAME: newLast NAME: newLast newLast newLast newLast newLast|' + ' NAME: modLast NAME: modLast modLast modLast modLast modLast' - + ' - Model1: modLast- Model2: lastModel2Name'), + + ' - Model1: modLast- Model2: lastModel2Name', '$.link(true, selector, data, helpers) is a no-op when targeting within a previously linked rendered template'); // ................................ Act .................................. @@ -1692,13 +1663,9 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after, - (isIE8 - ? 'NAME:modLastNAME:modLastmodLast modLast modLast modLast|' - + 'NAME:new_ORIGMOD_LastNAME:new_ORIGMOD_Lastnew_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last|' - + 'NAME:new_ORIGMOD_LastNAME_ORIGMOD_NewTmpl: new_ORIGMOD_Lastnew_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last' - : ' NAME: modLast NAME: modLast modLast modLast modLast modLast|' +' NAME: modLast NAME: modLast modLast modLast modLast modLast|' + ' NAME: new_ORIGMOD_Last NAME: new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last|' - + ' NAME: new_ORIGMOD_Last NAME_ORIGMOD_NewTmpl: new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last'), + + ' NAME: new_ORIGMOD_Last NAME_ORIGMOD_NewTmpl: new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last new_ORIGMOD_Last', 'Continue: $.link(true, selector, data, helpers) is a no-op when targeting within a previously linked rendered template'); // ................................ Act .................................. @@ -1751,15 +1718,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + after + " - Model1: " + model.person1.lastName + "- Model2: " + model2.person1.lastName, - isIE8 - ? "modLast title:modLast|" - + "Model2Tmpl: newLast2 title2:newLast2|" - + "Model2Tmpl:last2B title2:last2B|" - + "last1A title:last1A|" - + "modMoreLast title:modMoreLast|" - + "Model2NEWTmpl: last2B title:modMoreLast" - + " - Model1: modMoreLast- Model2: last2B" - : "modLast title:modLast|" + "modLast title:modLast|" + "Model2Tmpl: newLast2 title2:newLast2|" + "Model2Tmpl: last2B title2:last2B|" + "last1A title:last1A|" @@ -2263,9 +2222,7 @@ setTimeout(function() { // ............................... Assert ................................. var html = $("#result span")[0].outerHTML; assert.equal(html, - isIE8 - ? "x\\x', + 'x\\x', 'Escaping of characters: data-link="foo(\'x\\x\').b"'); // ................................ Reset ................................ @@ -2370,8 +2327,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(res, - isIE8 ? "1new 2new 3 new 4 new 5 new 6 new INPUTS new new new new new new new new " - : "1 new 2 new 3 new 4 new 5 new 6 new INPUTS new new new new new new new new ", + "1 new 2 new 3 new 4 new 5 new 6 new INPUTS new new new new new new new new ", 'Duplicate paths bind correctly (https://github.com/BorisMoore/jsviews/issues/250)'); // ................................ Reset ................................ @@ -2419,8 +2375,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(res, - isIE8 ? "0 aa 1 22 2 0 3 false 4 5 true " - : "0 aa 1 22 2 0 3 false 4 5 true ", + "0 aa 1 22 2 0 3 false 4 5 true ", 'with link, {{:#data}} within {{for}} is correct for different data types'); // ................................ Act .................................. @@ -2440,8 +2395,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(res, - isIE8 ? "0 aa 1 22 2 0 3 false 4 5 true " - : "0 aa 1 22 2 0 3 false 4 5 true ", + "0 aa 1 22 2 0 3 false 4 5 true ", 'with link, {^{:#data}} within {^{for}} is correct for different data types'); // ................................ Act .................................. @@ -2612,8 +2566,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { var html = $("#result span")[0].outerHTML; // ............................... Assert ................................. - assert.ok(before === 'One' && after === null && html === (isIE8 ? (""), + assert.ok(before === 'One' && after === null && html === "", 'Data link using: , and setting lastName to null - removes title attribute'); // ................................ Reset ................................ @@ -2632,8 +2585,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { var html = $("#result span")[0].outerHTML; // ............................... Assert ................................. - assert.ok(before === 'One' && after === null && html === (isIE8 ? (""), + assert.ok(before === 'One' && after === null && html === "", 'Data link using: , and setting lastName to undefined - removes title attribute'); // ................................ Reset ................................ @@ -2688,8 +2640,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { var html = $("#result span")[0].outerHTML; // ............................... Assert ................................. - assert.ok(before === 'One' && after === null && html === (isIE8 ? (""), + assert.ok(before === 'One' && after === null && html === "", 'Data link using: , and removing lastName - removes title attribute'); // ................................ Reset ................................ @@ -3110,7 +3061,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { function divProps() { var div = $("#result div")[0]; - return "title: " + div.title + " - innerHTML: " + div.innerHTML.replace(isIE8 ? /\r\n<\/SCRIPT>|\r\n/g : /<\/script>/g, "") + " - display: " + div.style.display; + return "title: " + div.title + " - innerHTML: " + div.innerHTML.replace(/<\/script>/g, "") + " - display: " + div.style.display; } // ................................ Act .................................. @@ -3134,7 +3085,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { .link("#result", thing); // ............................... Assert ................................. - assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
                        " : "box
                        ") + " - display: ", + assert.equal(divProps(), "title: - innerHTML: " + "box
                        " + " - display: ", "{chooseAttr tagAttr=\'html\'} overrides tag.attr, and has target 'html'"); // ................................ Act .................................. @@ -3150,7 +3101,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { .link("#result", thing); // ............................... Assert ................................. - assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
                        " : "box
                        ") + " - display: ", + assert.equal(divProps(), "title: - innerHTML: " + "box
                        " + " - display: ", "html{chooseAttr} has target 'html'"); // ................................ Act .................................. @@ -3158,7 +3109,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { .link("#result", thing); // ............................... Assert ................................. - assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
                        " : "box
                        ") + " - display: ", + assert.equal(divProps(), "title: - innerHTML: " + "box
                        " + " - display: ", "html{chooseAttr tagAttr =\'title\'} overrides tag.attr, but still has target 'html'"); // ................................ Act .................................. @@ -3198,7 +3149,7 @@ QUnit.test('data-link="attr{:expression}"', function(assert) { .link("#result", thing); // ............................... Assert ................................. - assert.equal(divProps(), "title: - innerHTML: " + (isIE8 ? "box
                        " : "box
                        ") + " - display: ", + assert.equal(divProps(), "title: - innerHTML: " + "box
                        " + " - display: ", "visible{chooseAttr tagAttr=\'title\' linkCtxAttr=\'html\'} overrides tag.attr and linkCtx.attr, and has target 'html'"); // ................................ Act .................................. @@ -4471,8 +4422,8 @@ QUnit.test('data-link="{tag...}"', function(assert) { after = $("#result div").html(); // ............................... Assert ................................. - assert.equal((before + "|" + after).replace(isIE8 ? /\r\n<\/SCRIPT>|\r\n/g : /<\/script>/g, ""), - isIE8 ? 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40' : 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + assert.equal((before + "|" + after).replace(/<\/script>/g, ""), + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', 'Data link fnTagEl rendering , using:
                        '); // ................................ Reset ................................ @@ -5417,10 +5368,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(res, - isIE8 - ? "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirstnewLastnewFirst newLastnewLast newFirst newFirst newLast|compFirstcompLastcompFirst" - + " compLastcompLast compFirst compFirst compLast|2wayFirst2wayLast2wayFirst 2wayLast2wayLast 2wayFirst 2wayFirst 2wayLast" - : "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirst newLast newFirst newLast newLast newFirst newFirst newLast|compFirst compLast compFirst" + "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirst newLast newFirst newLast newLast newFirst newFirst newLast|compFirst compLast compFirst" + " compLast compLast compFirst compFirst compLast|2wayFirst 2wayLast 2wayFirst 2wayLast 2wayLast 2wayFirst 2wayFirst 2wayLast", 'Two-way binding to a computed observable data property correctly calls the setter'); @@ -5489,10 +5437,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(res, - isIE8 - ? "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirstnewLastnewFirst newLastnewLast newFirst newFirst newLast|compFirstcompLastcompFirst" - + " compLastcompLast compFirst compFirst compLast|2wayFirst2wayLast2wayFirst 2wayLast2wayLast 2wayFirst 2wayFirst 2wayLast" - : "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirst newLast newFirst newLast newLast newFirst newFirst newLast|compFirst compLast compFirst" + "Jeff Smith Jeff Smith Smith Jeff Jeff Smith|newFirst newLast newFirst newLast newLast newFirst newFirst newLast|compFirst compLast compFirst" + " compLast compLast compFirst compFirst compLast|2wayFirst 2wayLast 2wayFirst 2wayLast 2wayLast 2wayFirst 2wayFirst 2wayLast", 'Two-way binding to a computed observable data property defined on the prototype correctly calls the setter'); @@ -5548,11 +5493,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(res, - isIE8 - ? "Jeff Friedman Jeff Friedman Friedman Jeff Rose Lee Rose Lee Lee Rose :Jeff Friedman|" - + "newFirstnewLastnewFirst newLastnewLast newFirst Rose LeeRose LeeLee Rose :newFirst newLast|" - + "2wayFirst2wayLast2wayFirst 2wayLast2wayLast 2wayFirst Rose LeeRose LeeLee Rose :2wayFirst 2wayLast" - : "Jeff Friedman Jeff Friedman Friedman Jeff Rose Lee Rose Lee Lee Rose :Jeff Friedman|" + "Jeff Friedman Jeff Friedman Friedman Jeff Rose Lee Rose Lee Lee Rose :Jeff Friedman|" + "newFirst newLast newFirst newLast newLast newFirst Rose Lee Rose Lee Lee Rose :newFirst newLast|" + "2wayFirst 2wayLast 2wayFirst 2wayLast 2wayLast 2wayFirst Rose Lee Rose Lee Lee Rose :2wayFirst 2wayLast", 'Two-way binding to a computed observable data property passed in as helper calls the setter'); @@ -7441,9 +7382,7 @@ QUnit.test("Chained computed observables in template expressions", function(asse getResult("Change e"); // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "None: a a a a a a |Change a: AAAAAA |Change b: ABBBBB |Change c: ABCCCC |Change d: ABCDDD |Change e: ABCDEE |" - : "None: a a a a a a |Change a: A A A A A A |Change b: A B B B B B |Change c: A B C C C C |Change d: A B C D D D |Change e: A B C D E E |", + assert.equal(res, "None: a a a a a a |Change a: A A A A A A |Change b: A B B B B B |Change c: A B C C C C |Change d: A B C D D D |Change e: A B C D E E |", "{{: ...}} expressions with deeply chained computed observables"); // =============================== Arrange =============================== @@ -7698,9 +7637,7 @@ QUnit.test("Chained computed observables in template expressions", function(asse getResult("Change e1"); // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "None: a a a a a a a a a a |Change a: AAAAAAAAAA |Change a1: AA1A1A1A1A1A1A1A1A1 |Change b: AA1BBBBBBBB |Change b1: AA1BB1B1B1B1B1B1B1 |Change c: AA1BB1CCCCCC |Change c1: AA1BB1CC1C1C1C1C1 |Change d: AA1BB1CC1DDDD |Change d1: AA1BB1CC1DD1D1D1 |Change e: AA1BB1CC1DD1EE |Change e1: AA1BB1CC1DD1EE1 |" - : "None: a a a a a a a a a a |Change a: A A A A A A A A A A |Change a1: A A1 A1 A1 A1 A1 A1 A1 A1 A1 |Change b: A A1 B B B B B B B B |Change b1: A A1 B B1 B1 B1 B1 B1 B1 B1 |Change c: A A1 B B1 C C C C C C |Change c1: A A1 B B1 C C1 C1 C1 C1 C1 |Change d: A A1 B B1 C C1 D D D D |Change d1: A A1 B B1 C C1 D D1 D1 D1 |Change e: A A1 B B1 C C1 D D1 E E |Change e1: A A1 B B1 C C1 D D1 E E1 |", + assert.equal(res, "None: a a a a a a a a a a |Change a: A A A A A A A A A A |Change a1: A A1 A1 A1 A1 A1 A1 A1 A1 A1 |Change b: A A1 B B B B B B B B |Change b1: A A1 B B1 B1 B1 B1 B1 B1 B1 |Change c: A A1 B B1 C C C C C C |Change c1: A A1 B B1 C C1 C1 C1 C1 C1 |Change d: A A1 B B1 C C1 D D D D |Change d1: A A1 B B1 C C1 D D1 D1 D1 |Change e: A A1 B B1 C C1 D D1 E E |Change e1: A A1 B B1 C C1 D D1 E E1 |", "{{: ...}} expressions with deeply chained computed observables (variant)"); // =============================== Arrange =============================== @@ -7765,9 +7702,7 @@ QUnit.test("Chained computed observables in template expressions", function(asse getResult("Change e"); // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "None: a a a a a |Change a: AAAAA |Change b: BBBBB |Change c: BCCCC |Change d: BCDDD |Change e: BCDEE |" - : "None: a a a a a |Change a: A A A A A |Change b: B B B B B |Change c: B C C C C |Change d: B C D D D |Change e: B C D E E |", + assert.equal(res, "None: a a a a a |Change a: A A A A A |Change b: B B B B B |Change c: B C C C C |Change d: B C D D D |Change e: B C D E E |", "{{for ...}} expressions with deeply chained computed observables"); // =============================== Arrange =============================== @@ -7832,9 +7767,7 @@ QUnit.test("Chained computed observables in template expressions", function(asse getResult("Change e"); // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "None: a a a a a | a a a a a |Change a: A A A A A |A A A A A |Change b: A A A A A |B B B B A |Change c: A A A A A |C C C B A |Change d: A A A A A |D D C B A |Change e: A A A A A |E D C B A |" - : "None: a a a a a | a a a a a |Change a: A A A A A | A A A A A |Change b: A A A A A | B B B B A |Change c: A A A A A | C C C B A |Change d: A A A A A | D D C B A |Change e: A A A A A | E D C B A |", + assert.equal(res, "None: a a a a a | a a a a a |Change a: A A A A A | A A A A A |Change b: A A A A A | B B B B A |Change c: A A A A A | C C C B A |Change d: A A A A A | D D C B A |Change e: A A A A A | E D C B A |", "Sibling {{: ...}} expressions with deeply chained computed observables"); // ................................ Reset ................................ @@ -8472,7 +8405,7 @@ QUnit.test("{^{tag}}", function(assert) { after = $("#result div span")[0].outerHTML; // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40' : 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', + 'Name: Mr Jo. Width: 30|Name: Sir compFirst. Width: 40', 'Data link with: {^{fnTagEl/}} rendering , updates when dependant object paths change'); // ................................ Reset ................................ @@ -8669,9 +8602,9 @@ QUnit.test("{^{tag}}", function(assert) { }); // ............................... Assert ................................. - assert.equal($("#result span")[0].outerHTML, isIE8 ? "w\\x\'y" : "w\\x\'y", + assert.equal($("#result span")[0].outerHTML, "w\\x\'y", "{^{mytag foo(\"w\\x\'y\").b/}} - correct compilation and output of quotes and backslash, with object returned in path (so nested compilation)"); - assert.equal($("#result span")[1].outerHTML, isIE8 ? "w\\x" : "w\\x", + assert.equal($("#result span")[1].outerHTML, "w\\x", "
                        - correct compilation and output of quotes and backslash, with object returned in path (so nested compilation)"); // ................................ Reset ................................ @@ -8868,7 +8801,7 @@ QUnit.test("{^{for}}", function(assert) { after = $("#result").text(); // ............................... Assert ................................. - assert.equal(before + "|" + after, isIE8 ? "2 boxtable|3tree boxtable" : "2 boxtable|3 treeboxtable", + assert.equal(before + "|" + after, "2 boxtable|3 treeboxtable", '{^{for #data}} when #data is an array binds to array changes on #data'); // ................................ Reset ................................ @@ -8888,7 +8821,7 @@ QUnit.test("{^{for}}", function(assert) { after = $("#result").text(); // ............................... Assert ................................. - assert.equal(before + "|" + after, isIE8 ? "2 boxtable|3tree boxtable" : "2 boxtable|3 treeboxtable", + assert.equal(before + "|" + after, "2 boxtable|3 treeboxtable", '{^{for}} when #data is an array binds to array changes on #data'); // ................................ Reset ................................ @@ -8929,13 +8862,7 @@ $.observable(listData.nodes.list).insert("C2 "); ret += "|5 " + $("#result").text() + " " + $._data(listData.nodes.list).events.arrayChange.length; // ............................... Assert ................................. - assert.equal(ret, isIE8 - ? "|1 Plain: A |SpanWithNext: A nextElem|UlWithNext: AnextElem|Ul: A 4" - + "|2 Plain: |SpanWithNext:nextElem|UlWithNext: nextElem|Ul: 4" - + "|3 Plain:C |SpanWithNext:C nextElem|UlWithNext: CnextElem|Ul: C 4" - + "|4 Plain: |SpanWithNext:nextElem|UlWithNext: nextElem|Ul: 4|" - + "5 Plain:C2 |SpanWithNext:C2 nextElem|UlWithNext: C2nextElem|Ul: C2 4" - : "|1 Plain: A |SpanWithNext: A nextElem|UlWithNext: AnextElem|Ul: A 4" + assert.equal(ret, "|1 Plain: A |SpanWithNext: A nextElem|UlWithNext: AnextElem|Ul: A 4" + "|2 Plain: |SpanWithNext: nextElem|UlWithNext: nextElem|Ul: 4" + "|3 Plain: C |SpanWithNext: C nextElem|UlWithNext: CnextElem|Ul: C 4" + "|4 Plain: |SpanWithNext: nextElem|UlWithNext: nextElem|Ul: 4" @@ -8970,9 +8897,7 @@ ret += "|5 " + $("#result").text() + " " + $._data(listData.nodes.list).events.a after += "|" + $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|X box |X boxtable |Xtree boxtable |Xtree box |X box ||X pen lamp |X lamp pen |" - : "|X box |X box table |X tree box table |X tree box |X box ||X pen lamp |X lamp pen |", + assert.equal(after, "|X box |X box table |X tree box table |X tree box |X box ||X pen lamp |X lamp pen |", '{^{if things.length}}{^{for things}} content block bound to both array and array.length responds correctly to observable array changes'); // ................................ Reset ................................ @@ -9008,9 +8933,7 @@ ret += "|5 " + $("#result").text() + " " + $._data(listData.nodes.list).events.a after += "|" + $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|box |box table |tree box table |tree box |box ||pen lamp | lamppen |" - : "|box |box table |tree box table |tree box |box ||pen lamp |lamp pen |", + assert.equal(after, "|box |box table |tree box table |tree box |box ||pen lamp |lamp pen |", '{^{for things.length && things}} content block bound to both array and array.length responds correctly to observable array changes'); // ................................ Reset ................................ @@ -9046,9 +8969,7 @@ ret += "|5 " + $("#result").text() + " " + $._data(listData.nodes.list).events.a after += "|" + $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|box |box table |tree box table |tree box |box ||pen lamp | lamppen |" - : "|box |box table |tree box table |tree box |box ||pen lamp |lamp pen |", + assert.equal(after, "|box |box table |tree box table |tree box |box ||pen lamp |lamp pen |", '{^{for things.length}}{^{for ~root.things}} content bound to both array and array.length responds correctly to observable array changes'); // ................................ Reset ................................ @@ -9068,7 +8989,7 @@ ret += "|5 " + $("#result").text() + " " + $._data(listData.nodes.list).events.a after = $("#result").text(); // ............................... Assert ................................. - assert.equal(before + "|" + after, isIE8 ? "2 boxtable|3tree boxtable" : "2 boxtable|3 treeboxtable", + assert.equal(before + "|" + after, "2 boxtable|3 treeboxtable", '{{include things}} moves context to things array, and {^{for}} then iterates and binds to array'); // ................................ Reset ................................ @@ -9494,8 +9415,7 @@ ret += "|5 " + $("#result").text() + " " + $._data(listData.nodes.list).events.a // ............................... Assert ................................. assert.equal(before + "|" + deferredString + "|" + after, - (isIE8 ? 'next||insertBeforenext' - : ' next||insertBefore next'), + (' next||insertBefore next'), 'Inserting content before a next sibling element in element-only context does not set ._df, and subsequent insertion is correctly placed before the next sibling.'); // ................................ Reset ................................ @@ -9617,7 +9537,6 @@ QUnit.test("{^{for start end sort filter reverse}}", function(assert) { assert.equal($.templates("{{for myarray sort=true}}{{:}} {{/for}}").render({myarray: myarray}), "-100 -1 1 2 3 4 5 6 7 8 9 20 100 ", "{{for myarray sort=true}}"); assert.equal($.templates("{{for myarray sort=true reverse=true}}{{:}} {{/for}}").render({myarray: myarray}), "100 20 9 8 7 6 5 4 3 2 1 -1 -100 ", "{{for myarray sort=true reverse=true}}"); -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{for myarray filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 9 3 7 5 -1 ", "{{for myarray filter=~oddValue}}!!!"); assert.equal($.templates("{{for myarray filter=~oddIndex}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "9 8 7 6 -100 100 ", "{{for myarray filter=~oddIndex}}"); assert.equal($.templates("{{for myarray filter=~oddValue}}{{:}} {{/for}}").render({myarray: myarray}, {oddValue: oddValue}), "1 9 3 7 5 -1 ", "{{for myarray filter=~oddValue}}"); @@ -9626,17 +9545,13 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=1 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "2 4 ", "{{for myarray sort=true filter=~oddIndex start=1 end=3}}"); assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=-3 end=-1}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "6 8 ", "{{for myarray sort=true filter=~oddIndex start=-3 end=-1}} Negative start or end count from the end"); assert.equal($.templates("{{for myarray sort=true filter=~oddIndex start=3 end=3}}{{:}} {{/for}}").render({myarray: myarray}, {oddIndex: oddIndex}), "", "{{for myarray sort=true filter=~oddIndex start=3 end=3}} (outputs nothing)"); -} assert.equal($.templates("{{for mypeople sort='name'}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}), "Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - Julia: age 0.6 - Xavier: age 0 - ", "{{for mypeople sort='name'}}"); assert.equal($.templates("{{for mypeople sort='details.age'}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}), "Xavier: age 0 - Julia: age 0.6 - Bob: age 2 - Emma: age 12 - Jeff: age 13.5 - Jo: age 22 - ", "{{for mypeople sort='details.age'}}"); -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~under20}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {under20: under20}), "Jeff: age 13.5 - Emma: age 12 - Bob: age 2 - Julia: age 0.6 - Xavier: age 0 - ", "{{for mypeople sort='details.age' reverse=true filter=~under20}}"); assert.equal($.templates("{{for mypeople sort='details.age' reverse=true filter=~under20 start=1 end=-1}}{{:name}}: age {{:details.age}} - {{/for}}").render({mypeople: mypeople}, {under20: under20}), "Emma: age 12 - Bob: age 2 - Julia: age 0.6 - ", "{{for mypeople sort='details.age' reverse=true filter=~under20 start=1 end=-1}}"); -} -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support // =============================== Arrange =============================== model.things = [{ob: {thing: "box"}}]; var ctx = {}; @@ -9884,7 +9799,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that assert.equal(JSON.stringify(_jsv.cbBindings), "{}", "Bindings all removed when content removed from DOM"); -} + // =============================== Arrange =============================== movies = [{title: "a0"}, {title: "x0"}, {title: "b0"}, {title: "y0"}, {title: "c0"}, {title: "z0"}]; ctx = {}; @@ -9914,18 +9829,14 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:--- a0 x0 b0 y0 c0 z0t0 |Slice:- x0 b0 y0 c0t0 " - : "|All:--- a0 x0 b0 y0 c0 z0 t0 |Slice:- x0 b0 y0 c0 t0 ", + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 |Slice:- x0 b0 y0 c0 t0 ", 'Appending of item in target array ("sliced") - item is rendered without refreshing sort, filter etc.'); ctx.target.refresh(); after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:--- a0 x0 b0 y0 c0 z0t0 |Slice:-x0 b0 y0 c0 z0 " - : "|All:--- a0 x0 b0 y0 c0 z0 t0 |Slice:- x0 b0 y0 c0 z0 ", + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 |Slice:- x0 b0 y0 c0 z0 ", 'To refresh correct start and end with new item included, call tag.refresh() '); // ................................ Act .................................. @@ -9933,9 +9844,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:--- a0 x0 b0 y0 c0 z0t0t1 |Slice:-t1 x0 b0 y0 c0 z0 " - : "|All:--- a0 x0 b0 y0 c0 z0 t0 t1 |Slice:- t1 x0 b0 y0 c0 z0 ", + assert.equal(after, "|All:--- a0 x0 b0 y0 c0 z0 t0 t1 |Slice:- t1 x0 b0 y0 c0 z0 ", 'Insertion of item at specific position in target array ("sliced") - item is rendered at insert location, but item is simply appended to source array'); // ................................ Act .................................. @@ -9943,9 +9852,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:--- a0m2 x0 b0 y0 c0 z0t0t1 |Slice:-m2 x0 b0 y0 c0 z0t0 " - : "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 |Slice:- m2 x0 b0 y0 c0 z0 t0 ", + assert.equal(after, "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 |Slice:- m2 x0 b0 y0 c0 z0 t0 ", 'Insertion of item in source array will also refresh "slicing"'); // ................................ Act .................................. @@ -9953,9 +9860,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:--- a0m2 x0 b0 y0 c0 z0t0t1t3 t4 |Slice:-m2t3 t4 x0 b0 y0 c0 z0t0 " - : "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 t3 t4 |Slice:- m2 t3 t4 x0 b0 y0 c0 z0 t0 ", + assert.equal(after, "|All:--- a0 m2 x0 b0 y0 c0 z0 t0 t1 t3 t4 |Slice:- m2 t3 t4 x0 b0 y0 c0 z0 t0 ", 'Insertion of items at specific position in target array ("sliced") - items are rendered at insert location, but simply appended to source array'); // ................................ Act .................................. @@ -9963,9 +9868,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:--- a0m2 t1t3 t4t5 |Slice:-t3t5 m2 t4 " - : "|All:--- a0 m2 t1 t3 t4 t5 |Slice:- t3 t5 m2 t4 ", + assert.equal(after, "|All:--- a0 m2 t1 t3 t4 t5 |Slice:- t3 t5 m2 t4 ", 'Calling refresh() on target array will append and remove items appropriately from source array and target array (and move items in target array)'); // ................................ Act .................................. @@ -9973,9 +9876,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:--- a0m2 t1t3t5 |Slice:-t3t5 m2 " - : "|All:--- a0 m2 t1 t3 t5 |Slice:- t3 t5 m2 ", + assert.equal(after, "|All:--- a0 m2 t1 t3 t5 |Slice:- t3 t5 m2 ", 'Removing item in target array ("sliced") - items are rendered without refreshing "slicing".'); // ................................ Act .................................. @@ -9983,9 +9884,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:---m2 t1t3t5 |Slice:-t1 t3 " - : "|All:--- m2 t1 t3 t5 |Slice:- t1 t3 ", + assert.equal(after, "|All:--- m2 t1 t3 t5 |Slice:- t1 t3 ", 'Removal of item in source array will also refresh "slicing".'); // ................................ Act .................................. @@ -9993,9 +9892,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:---m2 t1t3t5 |Slice:- t3 t1 " - : "|All:--- m2 t1 t3 t5 |Slice:- t3 t1 ", + assert.equal(after, "|All:--- m2 t1 t3 t5 |Slice:- t3 t1 ", 'Moving items in target array ("slice") - items are moved in target but not in source, and this is without refreshing "slicing".'); // ................................ Act .................................. @@ -10003,9 +9900,7 @@ if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 - ? "|All:---m2 t5 t1t3 |Slice:-t5 t1 " - : "|All:--- m2 t5 t1 t3 |Slice:- t5 t1 ", + assert.equal(after, "|All:--- m2 t5 t1 t3 |Slice:- t5 t1 ", 'Moving of items in source array will also refresh "slicing".'); // ................................ Reset ................................ @@ -10634,7 +10529,7 @@ QUnit.test("{^{if}}...{{else}}...{{/if}}", function(assert) { after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 ? "notOne notTwo THREE " : "notOne notTwo THREE ", + assert.equal(after, "notOne notTwo THREE ", 'Bound if and else render correct blocks based on boolean expressions'); // ................................ Act .................................. @@ -10642,7 +10537,7 @@ QUnit.test("{^{if}}...{{else}}...{{/if}}", function(assert) { after = $("#result").text(); // ............................... Assert ................................. - assert.equal(after, isIE8 ? "notOne TWO notThree " : "notOne TWO notThree ", + assert.equal(after, "notOne TWO notThree ", 'Bound if and else render correct blocks based on boolean expressions'); // ................................ Reset ................................ @@ -11047,7 +10942,6 @@ QUnit.test("{^{props}}...{{else}} ...", function(assert) { $.views.settings.advanced({_jsv: false}); }); -if (!isIE8) { // IE8 does not support filter. Need to add polyfill on sites that want this support QUnit.test("{^{props start end sort filter reverse}}...{{else}} ...", function(assert) { $.views.settings.advanced({_jsv: true}); // For using _jsv @@ -11184,7 +11078,6 @@ $.templates( $.views.settings.advanced({_jsv: false}); }); -} QUnit.test('data-link="{on ...', function(assert) { @@ -11259,8 +11152,7 @@ QUnit.test('data-link="{on ...', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "shape |linetrue " - : "shape |line true", + "shape |line true", '{on ~util.swap} calls util.swap helper method on click, with ~util as this pointer'); // ................................ Reset ................................ @@ -11318,8 +11210,7 @@ QUnit.test('data-link="{on ...', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "shape |linetrue " - : "shape |line true", + "shape |line true", '{on ~util.swap context=~util.swapCtx} calls util.swap helper method on click, with util.swapCtx as this pointer'); // ................................ Reset ................................ @@ -11353,8 +11244,7 @@ QUnit.test('data-link="{on ...', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "shape |linetrue " - : "shape |line true", + "shape |line true", '{on ~util.swap data=#data} calls util.swap helper method on click, and passes current data #data as ev.data'); // ................................ Reset ................................ @@ -12431,8 +12321,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "swap shape|swapline" - : "swap shape|swap line", + "swap shape|swap line", '{^{on swap/}} renders as button with label "swap", and calls swap method on click, with "this" pointer context on data object'); // ................................ Reset ................................ @@ -12471,8 +12360,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "clickme shape|clickmeline" - : "clickme shape|clickme line", + "clickme shape|clickme line", '{^{on swap}} clickme {{/on}} renders as button with label "clickme", and calls swap method on click'); // ................................ Reset ................................ @@ -12491,8 +12379,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "clickagain shape|clickagainline" - : "clickagain shape|clickagain line", + "clickagain shape|clickagain line", '{^{on swap tmpl=stringValue renders as button with label stringValue, and calls swap method on click'); // ................................ Reset ................................ @@ -12511,8 +12398,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "clickme shape|clickmeline" - : "clickme shape|clickme line", + "clickme shape|clickme line", '{^{on swap}}clickme{{/on}} renders as span with label clickme, and calls swap method on click'); // ................................ Reset ................................ @@ -12531,8 +12417,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "~swap shape|~swapline" - : "~swap shape|~swap line", + "~swap shape|~swap line", '{^{on ~swap/}} calls swap helper method on click, with "this" pointer context defaulting to current data object'); // ................................ Reset ................................ @@ -12562,8 +12447,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "~util.swap shape |~util.swaplinetrue " - : "~util.swap shape |~util.swap line true", + "~util.swap shape |~util.swap line true", '{^{on ~util.swap/}} calls util.swap helper method on click, with ~util as this pointer'); // ................................ Reset ................................ @@ -12588,8 +12472,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "~util.swap shape|~util.swapline" - : "~util.swap shape|~util.swap line", + "~util.swap shape|~util.swap line", '{^{on ~util.swap context=#data/}} calls util.swap helper method on click, with current data object as this pointer'); // ................................ Reset ................................ @@ -12622,8 +12505,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "~util.swap shape |~util.swaplinetrue " - : "~util.swap shape |~util.swap line true", + "~util.swap shape |~util.swap line true", '{^{on ~util.swap context=~util.swapCtx/}} calls util.swap helper method on click, with util.swapCtx as this pointer'); // ................................ Reset ................................ @@ -12657,8 +12539,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "~util.swap shape |~util.swaplinetrue " - : "~util.swap shape |~util.swap line true", + "~util.swap shape |~util.swap line true", '{^{on ~util.swap data=#data/}} calls util.swap helper method on click, and passes current data #data as ev.data'); // ................................ Reset ................................ @@ -12682,8 +12563,7 @@ QUnit.test('{^{on}}', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "swap shape|swaplineswapshapeswapline" - : "swap shape|swap lineswap shapeswap line", + "swap shape|swap lineswap shapeswap line", "{^{on 'mouseup mousedown blur' swap/}} calls util method on mouseup, mousedown and blur"); // ................................ Reset ................................ @@ -13085,19 +12965,7 @@ QUnit.test("Fallbacks for missing or undefined paths: using {^{:some.path onErro after += $("#result").text() + "|"; assert.equal(before + after, - isIE8 - ? "11 true true|" - + "err:A ERR:B err:C err:D err:E err:F err:G err:H err:I ERR:J err:K |" - + "leafLEAFleafleafleaffooleaf from my tag1leaf from my tag2 leafleaf from my tag1LEAFLEAF|" - + "leaf2LEAF2leaf2leafleaffooleaf2 from my tag1leaf2 from my tag2 leaf2leaf2 from my tag1LEAF2LEAF2|" - + "leaf3LEAF3leaf3leafleaf3fooleaf3 from my tag1leaf3 from my tag2 leaf3leaf3 from my tag1LEAF3LEAF3|" - + "leaf4LEAF4leaf4leafleaf4fooleaf4 from my tag1leaf4 from my tag2 leaf4leaf4 from my tag1LEAF4LEAF4|" - + "11 11 9 true true|" - + "leaf4LEAF4leaf4leafleaf4fooleaf4 from my tag1leaf4 from my tag2 leaf4leaf4 from my tag1LEAF4LEAF4|" - + "11 true true|" - + "err:A ERR:B err:C err:D err:E err:F err:G err:H err:I ERR:J ERR:K |" - + "leaf3LEAF3leaf3leaf3leaf3fooleaf3 from my tag1leaf3 from my tag2 leaf3leaf3 from my tag1LEAF3LEAF3|" - : "11 true true|" + "11 true true|" + "err:A ERR:B err:C err:D err:E err:F err:G err:H err:I ERR:J err:K |" + "leaf LEAF leaf leaf leaffoo leaf from my tag1 leaf from my tag2 leaf leaf from my tag1 LEAF LEAF |" + "leaf2 LEAF2 leaf2 leaf leaffoo leaf2 from my tag1 leaf2 from my tag2 leaf2 leaf2 from my tag1 LEAF2 LEAF2 |" @@ -13158,14 +13026,6 @@ QUnit.test("Fallbacks for missing or undefined paths: using {^{:some.path onErro after += $("#result").text() + "|"; assert.equal(before + after, - isIE8 - ? "string1 A error2 error3 error3b error4 error4b |" - + "[object Object] Astring2Berror3error4error4b |" - + "[object Object] A[object Object]Bstring3Cerror4 |" - + "[object Object] A[object Object]B[object Object]Cstring4D |" - + "[object Object] Aerror2error3error3berror4error4b |" - + "[object Object] A[object Object]a[object Object]b[object Object]c |" - : "string1 A error2 error3 error3b error4 error4b |" + "[object Object] A string2 B error3 error4 error4b |" + "[object Object] A [object Object] B string3 C error4 |" @@ -13218,8 +13078,7 @@ QUnit.test('Bound tag properties and contextual parameters', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " - : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", 'binding to ^tmpl=... :{^{include ^tmpl=~typeTemplates[type]... and data-link="{include ^tmpl=~typeTemplates[type]...'); // ................................ Reset ................................ @@ -13256,8 +13115,7 @@ QUnit.test('Bound tag properties and contextual parameters', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " - : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", 'binding to ^tmpl=... :{^{if true ^tmpl=~typeTemplates[type]... and data-link="{if true ^tmpl=~typeTemplates[type]...'); // ................................ Reset ................................ @@ -13294,8 +13152,7 @@ QUnit.test('Bound tag properties and contextual parameters', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " - : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", 'binding to ^tmpl=... :{^{if false}}{{else ^tmpl=~typeTemplates[type]... and data-link="{if false}{else ^tmpl=~typeTemplates[type]...'); // ................................ Reset ................................ @@ -13332,8 +13189,7 @@ QUnit.test('Bound tag properties and contextual parameters', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "Tag: Shape: circle Elem: Shape: circle Tag: Line: square 1 Elem: Line: square 1 |Tag:Line: circle5 Elem: Line: circle5 Tag:Shape: square Elem: Shape: square " - : "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", + "Tag: Shape: circle\n Elem: Shape: circle\n Tag: Line: square 1\n Elem: Line: square 1\n |Tag: Line: circle 5\n Elem: Line: circle 5\n Tag: Shape: square\n Elem: Shape: square\n ", 'binding to ^tmpl=... :{^{for undefined}}{{else ^tmpl=~typeTemplates[type]... and data-link="{for undefined}{else ^tmpl=~typeTemplates[type]...'); // ................................ Reset ................................ @@ -13365,8 +13221,7 @@ QUnit.test('Bound tag properties and contextual parameters', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "Bound condition: shape true Unbound condition: shape true Bound condition: line false Unbound condition: line false |Bound condition:line false Unbound condition: shape true Bound condition:shape true Unbound condition: line false " - : "Bound condition: shape true Unbound condition: shape true Bound condition: line false Unbound condition: line false |Bound condition: line false Unbound condition: shape true Bound condition: shape true Unbound condition: line false ", + "Bound condition: shape true Unbound condition: shape true Bound condition: line false Unbound condition: line false |Bound condition: line false Unbound condition: shape true Bound condition: shape true Unbound condition: line false ", 'Binding to contextual parameter {^{include ^~condition=... triggers update. Unbound contextual parameter {^{include ~condition=... does not trigger updated content'); // ................................ Reset ................................ @@ -13408,8 +13263,7 @@ QUnit.test('Bound tag properties and contextual parameters', function(assert) { // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "Updating: shape true Non updating: shape true Updating: line false Non updating: line false |Updating:line false Non updating: shapefalse Updating:shape true Non updating: linetrue " - : "Updating: shape true Non updating: shape true Updating: line false Non updating: line false |Updating: line false Non updating: shape false Updating: shape true Non updating: line true ", + "Updating: shape true Non updating: shape true Updating: line false Non updating: line false |Updating: line false Non updating: shape false Updating: shape true Non updating: line true ", 'Binding to property triggers update {^{updatingTag ^condition=... unless tag is non-updating: {^{nonUpdatingTag ^condition=...'); // ................................ Reset ................................ @@ -13443,8 +13297,7 @@ QUnit.test('Bound tag properties and contextual parameters', function(assert) { res += "|" + $("#result").text(); // ............................... Assert ................................. - assert.equal(res, (isIE8 ? "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName -newName lead:newName - " - : "Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName - newName lead:newName - "), + assert.equal(res, ("Bob lead:Jim - Jim lead:Jim - |Bob lead:newName - Jim lead:newName - newName lead:newName - "), "data-link allows passing in new contextual parameters to template: data-link=\"{for people ~team=#data tmpl=..."); // ................................ Reset ................................ @@ -13544,8 +13397,7 @@ $.views.settings.trigger(false); // ............................... Assert ................................. assert.equal(before + "|" + after, - isIE8 ? "shape shape true line line false |shapelinefalse lineshapetrue " - : "shape shape true line line false |shape line false line shape true ", + "shape shape true line line false |shape line false line shape true ", 'contextual parameter {^{include ~condition=... does not trigger update but references are bound'); // ................................ Reset ................................ @@ -14098,33 +13950,27 @@ QUnit.test("JsViews ArrayChange: move()", function(assert) { // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(1,0,2,3,4), 'moved one item from 0 to 1'); -} // ................................ Act .................................. move(0, 1); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(0,1,2,3,4), 'moved one item from 0 to 1 again (actually swaps back to orginal positions'); -} // ................................ Act .................................. move(1, 0); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(1,0,2,3,4), 'moved one item back from 1 to 0'); -} // ................................ Act .................................. move(1, 0); // Return to original position @@ -14132,121 +13978,99 @@ if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple white // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(0,1,2,3,4), 'move(1, 0, 0) does nothing'); -} // ................................ Act .................................. move(1, 1); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(0,1,2,3,4), 'move(1, 1) does nothing'); -} // ................................ Act .................................. move(0, 1, 2); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(2,0,1,3,4), 'move(0, 1, 2) moves 2 items'); -} // ................................ Act .................................. move(0, 1, 4); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(4,2,0,1,3), 'move(0, 1, 4) moves 4 items'); -} // ................................ Act .................................. move(1, 0, 4); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(2,0,1,3,4), 'move(1, 0, 4) moves back 4 items'); -} // ................................ Act .................................. move(0, 1, 5); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(2,0,1,3,4), 'move(0, 1, 5): moving more than total items does nothing'); -} // ................................ Act .................................. move(1, 2, 4); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(2,0,1,3,4), 'move(1, 2, 4): moving up items beyond last item does nothing'); -} // ................................ Act .................................. move(2, 1, 8); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(2,1,3,4,0), 'move(2, 1, 8): moving back items from beyond last item will move just the existing ones'); -} // ................................ Act .................................. remove(1,1); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(2,3,4,0), 'remove(1,1): works correctly'); -} // ................................ Act .................................. remove(0); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(3,4,0), 'remove(0): works correctly'); -} // ................................ Act .................................. move(2, 0); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(0,3,4), 'move(2, 0): works correctly'); -} // ................................ Act .................................. remove(2); @@ -14256,11 +14080,9 @@ if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple white // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed(), current(3,2,0), 'multiple operations: works correctly - with the original item with style set to red still there'); -} // ................................ Reset ................................ $("#result").empty(); @@ -14351,33 +14173,27 @@ if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple white // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(1,0,2,3,4), 'Complex template: moved one item from 0 to 1'); -} // ................................ Act .................................. move(0, 1); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(0,1,2,3,4), 'Complex template: moved one item from 0 to 1 again (actually swaps back to orginal positions'); -} // ................................ Act .................................. move(1, 0); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(1,0,2,3,4), 'Complex template: moved one item back from 1 to 0'); -} // ................................ Act .................................. move(1, 0); // Return to original position @@ -14385,121 +14201,99 @@ if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple white // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(0,1,2,3,4), 'Complex template: move(1, 0, 0) does nothing'); -} // ................................ Act .................................. move(1, 1); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(0,1,2,3,4), 'Complex template: move(1, 1) does nothing'); -} // ................................ Act .................................. move(0, 1, 2); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(2,0,1,3,4), 'Complex template: move(0, 1, 2) moves 2 items'); -} // ................................ Act .................................. move(0, 1, 4); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(4,2,0,1,3), 'Complex template: move(0, 1, 4) moves 4 items'); -} // ................................ Act .................................. move(1, 0, 4); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(2,0,1,3,4), 'Complex template: move(1, 0, 4) moves back 4 items'); -} // ................................ Act .................................. move(0, 1, 5); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(2,0,1,3,4), 'Complex template: move(0, 1, 5): moving more than total items does nothing'); -} // ................................ Act .................................. move(1, 2, 4); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(2,0,1,3,4), 'Complex template: move(1, 2, 4): moving up items beyond last item does nothing'); -} // ................................ Act .................................. move(2, 1, 8); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(2,1,3,4,0), 'Complex template: move(2, 1, 8): moving back items from beyond last item will move just the existing ones'); -} // ................................ Act .................................. remove(1,1); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(2,3,4,0), 'Complex template: remove(1,1): works correctly'); -} // ................................ Act .................................. remove(0); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(3,4,0), 'Complex template: remove(0): works correctly'); -} // ................................ Act .................................. move(2, 0); // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(0,3,4), 'Complex template: move(2, 0): works correctly'); -} // ................................ Act .................................. remove(2); @@ -14509,11 +14303,9 @@ if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple white // ............................... Assert ................................. -if (!isIE8) { // Not worth verifying exact text rendering in IE8: multiple whitespace rendering bugs. assert.equal($("#result").text() + findRed2(), current(3,2,0), 'Complex template: multiple operations: works correctly - with the original item with style set to red still there'); -} // ................................ Reset ................................ $("#result").empty(); @@ -15605,16 +15397,7 @@ $.views.settings.trigger(false); // ............................... Assert ................................. - var expected = isIE8 ? - "Sir Jo 1st Ave Full: Sir Jo 1st Ave CTP: Sir Jo 1st Ave FULLNAMETAG: Sir Jo 1st Ave \n" - + "ADDRESS: Sir Jo 2nd St Full:Sir Jo 2nd St CTP:Sir Jo 2nd St FULLNAMETAG:Sir Jo 2nd St \n" - + "TITLE: Sir+ Jo 2nd St Full:Sir+ Jo 2nd St CTP:Sir+ Jo 2nd St FULLNAMETAG:Sir+ Jo 2nd St \n" - + "NAME: Sir+ Jo+ 2nd St Full:Sir+ Jo+ 2nd St CTP:Sir+ Jo+ 2nd St FULLNAMETAG:Sir+ Jo+ 2nd St \n" - + "STREET: Sir+ Jo+ 2nd St+ Full:Sir+ Jo+ 2nd St+ CTP:Sir+ Jo+ 2nd St+ FULLNAMETAG:Sir+ Jo+ 2nd St+ \n" - + "FULL: Mr Bob FullSt Full:Mr Bob FullSt CTP:Mr Bob FullSt FULLNAMETAG:Mr Bob FullSt \n" - + "CTP: Lady Jane CtpSt Full:Lady Jane CtpSt CTP:Lady Jane CtpSt FULLNAMETAG:Lady Jane CtpSt \n" - + "TAG: Ms Anne TagSt Full:Ms Anne TagSt CTP:Ms Anne TagSt FULLNAMETAG:Ms Anne TagSt " - : "Sir Jo 1st Ave Full: Sir Jo 1st Ave CTP: Sir Jo 1st Ave FULLNAMETAG: Sir Jo 1st Ave \n" + var expected = "Sir Jo 1st Ave Full: Sir Jo 1st Ave CTP: Sir Jo 1st Ave FULLNAMETAG: Sir Jo 1st Ave \n" + "ADDRESS: Sir Jo 2nd St Full: Sir Jo 2nd St CTP: Sir Jo 2nd St FULLNAMETAG: Sir Jo 2nd St \n" + "TITLE: Sir+ Jo 2nd St Full: Sir+ Jo 2nd St CTP: Sir+ Jo 2nd St FULLNAMETAG: Sir+ Jo 2nd St \n" + "NAME: Sir+ Jo+ 2nd St Full: Sir+ Jo+ 2nd St CTP: Sir+ Jo+ 2nd St FULLNAMETAG: Sir+ Jo+ 2nd St \n" @@ -15747,13 +15530,7 @@ $.views.settings.trigger(false); result += "\nCTP EVALUATED FUNCTION: " + $("#result").text(); // ............................... Assert ................................. - assert.equal(result, isIE8 ? "Title: Sir Name: Jo Street: 1st Ave Full: Sir Jo 1st Ave TAG: Sir Jo 1st Ave TAG2: Sir Jo 1st Ave \n" - + "TITLE: Title:Sir2 Name: Jo Street: 1st Ave Full:Sir2 Jo 1st Ave TAG:Sir2 Jo 1st Ave TAG2:Sir2 Jo 1st Ave \n" - + "NAME: Title:Sir2 Name:Jo2 Street: 1st Ave Full:Sir2 Jo2 1st Ave TAG:Sir2 Jo2 1st Ave TAG2:Sir2 Jo2 1st Ave \n" - + "ADDRESS: Title:Sir2 Name:Jo2 Street:2nd St Full:Sir2 Jo2 2nd St TAG:Sir2 Jo2 2nd St TAG2:Sir2 Jo2 2nd St \n" - + "CTP FUNCTION: Title:Mr Name:Bob Street:FullSt Full:Mr Bob FullSt TAG:Mr Bob FullSt TAG2:Mr Bob FullSt \n" - + "CTP EVALUATED FUNCTION: Title:Mr Name:Bob Street:FullSt Full:Mr Bob FullSt TAG:Mr Bob FullSt TAG2:Mr Bob FullSt " - : "Title: Sir Name: Jo Street: 1st Ave Full: Sir Jo 1st Ave TAG: Sir Jo 1st Ave TAG2: Sir Jo 1st Ave \n" + assert.equal(result, "Title: Sir Name: Jo Street: 1st Ave Full: Sir Jo 1st Ave TAG: Sir Jo 1st Ave TAG2: Sir Jo 1st Ave \n" + "TITLE: Title: Sir2 Name: Jo Street: 1st Ave Full: Sir2 Jo 1st Ave TAG: Sir2 Jo 1st Ave TAG2: Sir2 Jo 1st Ave \n" + "NAME: Title: Sir2 Name: Jo2 Street: 1st Ave Full: Sir2 Jo2 1st Ave TAG: Sir2 Jo2 1st Ave TAG2: Sir2 Jo2 1st Ave \n" + "ADDRESS: Title: Sir2 Name: Jo2 Street: 2nd St Full: Sir2 Jo2 2nd St TAG: Sir2 Jo2 2nd St TAG2: Sir2 Jo2 2nd St \n" @@ -16078,9 +15855,11 @@ $.views.settings.trigger(false); $.observable(data).setProperty("name", "3.745") // ............................... Assert ................................. - assert.equal($("#result").text(), isIE8 ? "3.753.74500" : "3.75 3.74500", + assert.equal($("#result").text(), "3.75 3.74500", "Converter with prop 'length' data-links correctly (no collision with array.length on pathBindings array)."); + // ................................ Reset .................................. + $("#result").empty(); $.views.settings.trigger(true); }); @@ -16146,7 +15925,7 @@ $("#result input").val("NEW").change(); // ................................ Act .................................. res = $.views.settings.debugMode(); - $("#result").empty(); + $("#result").empty(); try { $.templates('{{:missing.willThrow}}X').link("#result", app); @@ -16163,9 +15942,8 @@ $("#result input").val("NEW").change(); // ................................ Act .................................. res = $.views.settings.debugMode(); - $("#result").empty(); - try { + try { $.templates('
                        X
                        ').link("#result", app); } catch (e) { @@ -16184,7 +15962,6 @@ $("#result input").val("NEW").change(); $.views.settings.debugMode(true); res = $.views.settings.debugMode(); - $("#result").empty(); $.templates('{{:missing.willThrow}}').link("#result", app); @@ -16197,7 +15974,6 @@ $("#result input").val("NEW").change(); // ................................ Act .................................. res = $.views.settings.debugMode(); - $("#result").empty(); $.templates('
                        X
                        ').link("#result", app); @@ -16249,6 +16025,7 @@ $("#result input").val("NEW").change(); // ................................ Reset .................................. $("#result").empty(); + $.unlink(); // Need to unlink since when throwing above, view registration was incomplete, so calling $("#result").empty() is not sufficient to clean up child views on topView $.views.settings.debugMode(oldDebugMode); $.views.settings.trigger(true); @@ -16372,6 +16149,7 @@ QUnit.test("$.view() in regular content", function(assert) { // ................................ Act .................................. view = $.view("#result", true); + var view2 = $.view("#result").get(true); // ............................... Assert ................................. assert.ok(view.data === data && view.type === "array", 'If elem is a container for a rendered array, and the array is empty, $.view(elem, true) returns the array view (even though the element is empty)'); @@ -16561,9 +16339,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: -: { } |2: set1-set1: {set1 } |3: new1-new1: {new1 } " - : "1: -: { } |2: set1-set1: { set1} |3: new1-new1: { new1} ", + assert.equal(res, "1: -: { } |2: set1-set1: { set1} |3: new1-new1: { new1} ", "Uninitialized context param can be changed observably by two-way binding or by view.ctxPrm(foo, value) call"); // ................................ Act .................................. @@ -16586,9 +16362,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: instance-instance: { instance} |2: set1-set1: {set1} |3: new1-new1: {new1} " - : "1: instance-instance: { instance} |2: set1-set1: { set1} |3: new1-new1: { new1} ", + assert.equal(res, "1: instance-instance: { instance} |2: set1-set1: { set1} |3: new1-new1: { new1} ", "Initialized instance context param can be changed observably by two-way binding or by view.ctxPrm(foo, value) call"); // ................................ Act .................................. @@ -16613,9 +16387,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: registered-registered: { registered} |2: set1-set1: {set1} |3: new1-new1: {new1} " - : "1: registered-registered: { registered} |2: set1-set1: { set1} |3: new1-new1: { new1} ", + assert.equal(res, "1: registered-registered: { registered} |2: set1-set1: { set1} |3: new1-new1: { new1} ", "Initialized registered helper param can be changed observably by two-way binding or by view.ctxPrm(foo, value) call"); // =============================== Arrange =============================== @@ -16645,11 +16417,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { res += "|3: " + view1.ctxPrm("foo") + "-" + input.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: -: { Outer: , Inner: , Nested inner: }" - + " |2: set1-set1: { Outer:set1 , Inner:set1 , Nested inner:set1 }" - + " |3: new1-new1: { Outer:new1 , Inner:new1 , Nested inner:new1 } " - : "1: -: { Outer: , Inner: , Nested inner: }" + assert.equal(res, "1: -: { Outer: , Inner: , Nested inner: }" + " |2: set1-set1: { Outer: set1, Inner: set1, Nested inner: set1}" + " |3: new1-new1: { Outer: new1, Inner: new1, Nested inner: new1} ", "Observable contextual parameter is scoped to root view (view below top view)"); @@ -16741,11 +16509,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { res += "|3: View1:" + (view1.ctxPrm("foo")||"") + "-" + input1.value + " View2:" + (view2.ctxPrm("foo")||"") + "-" + input2.value + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: View1:- View2:-: { }" - + " |2: View1:set2-set2 View2:set2-set2: {set2 set2 }" - + " |3: View1:new2-new2 View2:new2-new2: {new2 new2 } " - : "1: View1:- View2:-: { }" + assert.equal(res, "1: View1:- View2:-: { }" + " |2: View1:set2-set2 View2:set2-set2: { set2 set2}" + " |3: View1:new2-new2 View2:new2-new2: { new2 new2} ", "Observable contextual parameter is scoped to root view (view below top view) - which is array view, when rendering/linking an array"); @@ -16795,11 +16559,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" - + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer:set1 , Inner:set2 , Nested inner:set4 , Nested inner:set4 }" - + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer:new1 , Inner:new2 , Nested inner:new4 , Nested inner:new4 } " - : "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + assert.equal(res, "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer: set1, Inner: set2, Nested inner: set4, Nested inner: set4}" + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer: new1, Inner: new2, Nested inner: new4, Nested inner: new4} ", "Observable contextual parameter within linked tag is scoped to tag view, - closest non flow tag ancestor, shared across else blocks"); @@ -16818,10 +16578,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "|1: new4" - + " |2: tagFoo-tagNewPrm-//tagNewPrm/tagNewPrm-new1/new2/tagFoo/tagFoo-new1/new2/tagFoo/tagFoo: { Outer:new1 , Inner:new2 , Nested inner:tagFoo , Nested inner:tagFoo } " - : "|1: new4" + assert.equal(res, "|1: new4" + " |2: tagFoo-tagNewPrm-//tagNewPrm/tagNewPrm-new1/new2/tagFoo/tagFoo-new1/new2/tagFoo/tagFoo: { Outer: new1, Inner: new2, Nested inner: tagFoo, Nested inner: tagFoo} ", "tag.ctxPrm() gets/sets parameter scoped to tag view, shared across else blocks"); @@ -16829,7 +16586,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { assert.equal(innerTag.tagCtxs[0].nodes().length + "|" + innerTag.tagCtxs[1].nodes().length + "|" + innerTag.nodes().length + "-" + innerTag.tagCtxs[0].contents(true, "input").length + "|" + innerTag.tagCtxs[1].contents(true, "input").length + "|" + innerTag.contents(true, "input").length, - isIE8 ? "3|2|5-1|1|2" : "2|2|4-1|1|2", + "2|2|4-1|1|2", "Multiple else blocks: tag.nodes() and tag.content() return content from all else blocks"); // =============================== Arrange =============================== @@ -16877,11 +16634,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" - + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer:set1 , Inner:set2 , Nested inner:set4 , Nested inner:set4 }" - + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer:new1 , Inner:new2 , Nested inner:new4 , Nested inner:new4 } " - : "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + assert.equal(res, "1: ///-///: { Outer: , Inner: , Nested inner: , Nested inner: }" + " |2: set1/set2/set4/set4-set1/set2/set4/set4: { Outer: set1, Inner: set2, Nested inner: set4, Nested inner: set4}" + " |3: new1/new2/new4/new4-new1/new2/new4/new4: { Outer: new1, Inner: new2, Nested inner: new4, Nested inner: new4} ", "Observable contextual parameter within unlinked tag is scoped to tag view, - closest non flow tag ancestor, shared across else blocks"); @@ -16934,11 +16687,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: /11/48/22-/11/48/22: { Outer: , Inner: 11, Nested inner:48 , Nested inner: 22}" - + " |2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer:set1 , Inner:set2, Nested inner:set3 , Nested inner:set4}" - + " |3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer:new1 , Inner:new2, Nested inner:new3 , Nested inner:new4} " - : "1: /11/48/22-/11/48/22: { Outer: , Inner: 11, Nested inner: 48, Nested inner: 22}" + assert.equal(res, "1: /11/48/22-/11/48/22: { Outer: , Inner: 11, Nested inner: 48, Nested inner: 22}" + " |2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer: set1, Inner: set2, Nested inner: set3, Nested inner: set4}" + " |3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer: new1, Inner: new2, Nested inner: new3, Nested inner: new4} ", "Observable tag contextual parameter within linked tag is scoped to tag view, - closest non flow tag ancestor, not shared across else blocks"); @@ -16988,11 +16737,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { + "-" + input1.val() + "/" + input2.val() + "/" + input3.val() + "/" + input4.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: /11//22-/11//22: { Outer: , Inner: 11, Nested inner: , Nested inner: 22}" - + " \n|2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer:set1 , Inner:set2, Nested inner:set3 , Nested inner:set4}" - + " \n|3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer:new1 , Inner:new2, Nested inner:new3 , Nested inner:new4} " - : "1: /11//22-/11//22: { Outer: , Inner: 11, Nested inner: , Nested inner: 22}" + assert.equal(res, "1: /11//22-/11//22: { Outer: , Inner: 11, Nested inner: , Nested inner: 22}" + " \n|2: set1/set2/set3/set4-set1/set2/set3/set4: { Outer: set1, Inner: set2, Nested inner: set3, Nested inner: set4}" + " \n|3: new1/new2/new3/new4-new1/new2/new3/new4: { Outer: new1, Inner: new2, Nested inner: new3, Nested inner: new4} ", "Observable tag contextual parameter within unlinked tag is scoped to tag view, - closest non flow tag ancestor, not shared across else blocks"); @@ -17227,14 +16972,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { + "-" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: val1/val1-val1/val1: { val1 val1}" - + " \n2: new1/new1-new1/new1: {new1new1}" - + " \n3: set2/set2-set2/set2: {set2set2}" - + " \n4: val2/val2-val2/val2: { val2 val2}" - + " \n5: set3/set3-set3/set3: {set3set3}" - + " \n6: new3/new3-new3/new3: {new3new3} " - : "1: val1/val1-val1/val1: { val1 val1}" + assert.equal(res, "1: val1/val1-val1/val1: { val1 val1}" + " \n2: new1/new1-new1/new1: { new1 new1}" + " \n3: set2/set2-set2/set2: { set2 set2}" + " \n4: val2/val2-val2/val2: { val2 val2}" @@ -17291,12 +17029,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { + "-" + inputOuter.val() + "/" + input1.val() + "/" + input2.val() + ": {" + content.text() + "} "; // ............................... Assert ................................. - assert.equal(res, isIE8 - ? "1: outer-outer: { outer }" - + " \n2: outer/val1/val1-outer/val1/val1: { outer val1 val1}" - + " \n3: newouter/new2/new2-newouter/new2/new2: {newouter new2new2}" - + " \n4: newouter/val2/val2-newouter/val2/val2: {newouter val2 val2} " - : "1: outer-outer: { outer }" + assert.equal(res, "1: outer-outer: { outer }" + " \n2: outer/val1/val1-outer/val1/val1: { outer val1 val1}" + " \n3: newouter/new2/new2-newouter/new2/new2: { newouter new2 new2}" + " \n4: newouter/val2/val2-newouter/val2/val2: { newouter val2 val2} ", @@ -17361,9 +17094,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { $.observable(data).setProperty("fullName", "NewVmFullname"); // ............................... Assert ................................. - assert.equal($("#result").text(), isIE8 - ? "NewCtxFullNewVmFullFN2FN2NewVmFullNewCtxFullLastNewVmFullNewCtxFullLast " - : "NewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", + assert.equal($("#result").text(), "NewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", "Observe computed with both data and contextual parameters as depends paths"); // ............................... Assert ................................. @@ -17414,9 +17145,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { // ............................... Assert ................................. var fnctions = fullNameHlp === $.views.helpers.fullName && fn1 === $.views.helpers.fnprop; // Make sure helper function have not been replaced by ctxPrm() call - assert.equal(fnctions + $("#result").text(), isIE8 - ? "trueNewCtxFullNewVmFullFN2FN2NewVmFullNewCtxFullLastNewVmFullNewCtxFullLast " - : "trueNewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", + assert.equal(fnctions + $("#result").text(), "trueNewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", "Observe registered computed helper with both data and contextual parameters as depends paths"); // ............................... Assert ................................. @@ -17467,9 +17196,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { // ............................... Assert ................................. fnctions = fullNameHlp === tmpl.helpers.fullName && fn1 === tmpl.helpers.fnprop; // Make sure helper function have not been replaced by ctxPrm() call - assert.equal(fnctions + $("#result").text(), isIE8 - ? "trueNewCtxFullNewVmFullFN2FN2NewVmFullNewCtxFullLastNewVmFullNewCtxFullLast " - : "trueNewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", + assert.equal(fnctions + $("#result").text(), "trueNewCtxFull NewVmFull FN2 FN2 NewVmFullNewCtxFullLast NewVmFullNewCtxFullLast ", "Observe registered computed helper, local to template, with both data and registered helper contextual parameters as depends paths"); // ............................... Assert ................................. @@ -17508,9 +17235,7 @@ QUnit.test("view.ctxPrm() tag.ctxPrm()", function(assert) { "Unobserve programmatic APIs for data and for contextual parameters works correctly. Event handlers removed, and no longer triggered"); // ............................... Assert ................................. - assert.equal($("#result").text(), isIE8 - ? "AddCtxFullAddVmFullFN1FN1AddVmFullAddCtxFullLastAddVmFullAddCtxFullLast " - : "AddCtxFull AddVmFull FN1 FN1 AddVmFullAddCtxFullLast AddVmFullAddCtxFullLast ", + assert.equal($("#result").text(), "AddCtxFull AddVmFull FN1 FN1 AddVmFullAddCtxFullLast AddVmFullAddCtxFullLast ", "After removing programmatically attached handlers for data and for contextual parameters, declarative UI handlers work correctly"); // ............................... Reset ................................. @@ -18341,7 +18066,7 @@ QUnit.test("Modifying content, initializing widgets/tag controls, using data-lin }).link("#result", person1); // ............................... Assert ................................. - assert.equal($("#result div").html().replace(isIE8 ? /\r\n<\/SCRIPT>|\r\n/g : /<\/script>/g, ""), isIE8 ? "render after" : " render after", 'A data-linked tag control allows setting of content on the data-linked element during render and onAfterLink'); + assert.equal($("#result div").html().replace(/<\/script>/g, ""), " render after", 'A data-linked tag control allows setting of content on the data-linked element during render and onAfterLink'); // =============================== Arrange =============================== @@ -19106,10 +18831,7 @@ $.views.settings.trigger(false); result += "\nChangeConverterDepends-foo: " + $("#result").text(); // ............................... Assert ................................. - assert.equal(result, isIE8 ? "TWO(Jo foo1) ONE(Jo foo1) ONE(Jo foo1)\n" + - "ChangeData-name: TWO(Jo2 foo1)ONE(Jo2 foo1)ONE(Jo2 foo1)\n" + - "ChangeConverterDepends-foo: TWO(Jo2 foo2)ONE(Jo2 foo2)ONE(Jo2 foo2)" - : "TWO(Jo foo1) ONE(Jo foo1) ONE(Jo foo1)\n" + + assert.equal(result, "TWO(Jo foo1) ONE(Jo foo1) ONE(Jo foo1)\n" + "ChangeData-name: TWO(Jo2 foo1) ONE(Jo2 foo1) ONE(Jo2 foo1)\n" + "ChangeConverterDepends-foo: TWO(Jo2 foo2) ONE(Jo2 foo2) ONE(Jo2 foo2)", '{^{:...}} tag with converters with depends - updates correctly in response to dependent observable change'); @@ -19155,12 +18877,7 @@ $.views.settings.trigger(false); result += "\nChangeTagDependsState-state: " + $("#result").text(); // ............................... Assert ................................. - assert.equal(result, isIE8 ? "TWO(Jo foo1) bar1 state1 foo1 ONE(Jo foo1) bar1 state1 foo1 THREE(Jo foo1) bar1 state1 foo1\n" + - "ChangeData-name: TWO(Jo2 foo1) bar1 state1 foo1ONE(Jo2 foo1) bar1 state1 foo1THREE(Jo2 foo1) bar1 state1 foo1\n" + - "ChangeConverterDepends-foo: TWO(Jo2 foo2) bar1 state1 foo2ONE(Jo2 foo2) bar1 state1 foo2THREE(Jo2 foo2) bar1 state1 foo2\n" + - "ChangeTagDependsData-bar: TWO(Jo2 foo2) bar2 state1 foo2ONE(Jo2 foo2) bar2 state1 foo2THREE(Jo2 foo2) bar2 state1 foo2\n" + - "ChangeTagDependsState-state: TWO(Jo2 foo2) bar2 state1 foo2ONE(Jo2 foo2) bar2 state2 foo2THREE(Jo2 foo2) bar2 state1 foo2" - : "TWO(Jo foo1) bar1 state1 foo1 ONE(Jo foo1) bar1 state1 foo1 THREE(Jo foo1) bar1 state1 foo1\n" + + assert.equal(result, "TWO(Jo foo1) bar1 state1 foo1 ONE(Jo foo1) bar1 state1 foo1 THREE(Jo foo1) bar1 state1 foo1\n" + "ChangeData-name: TWO(Jo2 foo1) bar1 state1 foo1 ONE(Jo2 foo1) bar1 state1 foo1 THREE(Jo2 foo1) bar1 state1 foo1\n" + "ChangeConverterDepends-foo: TWO(Jo2 foo2) bar1 state1 foo2 ONE(Jo2 foo2) bar1 state1 foo2 THREE(Jo2 foo2) bar1 state1 foo2\n" + "ChangeTagDependsData-bar: TWO(Jo2 foo2) bar2 state1 foo2 ONE(Jo2 foo2) bar2 state1 foo2 THREE(Jo2 foo2) bar2 state1 foo2\n" + @@ -19324,8 +19041,7 @@ setTimeout(function() { // ............................... Assert ................................. assert.equal(res, - isIE8 ? " 1: First Name 2: Second Name2 3: Third Name3 4: Fourth Name4" - : " 1: First Name 2: Second Name2 3: Third Name3 4: Fourth Name4", + " 1: First Name 2: Second Name2 3: Third Name3 4: Fourth Name4", 'Data link, global trigger false, using:
                        triggers on specified events'); // ............................... Assert ................................. @@ -19762,7 +19478,7 @@ QUnit.test("Tag options versus setting in init()", function(assert) { result = ""; assert.equal($("#result").text(), - "1: In template: Fred " + (isIE8 ? "" : " ") + "1: In template: Fred " + (" ") + "2: In template: Fred inner block: Fred " + "3: inner block: Fred", "contentCtx as a function returns the data context both for the template and for block content."); @@ -20260,8 +19976,7 @@ setTimeout(function() { setTimeout(function() { // ............................... Assert ................................. assert.equal(before + "|" + person.name, - isIE8 ? "JO SMITH|new name|new2 \r\n

                        name2

                        |new3 \r\n
                        name3
                        " - : "JO SMITH|new name|new2

                        name2

                        |new3
                        name3
                        ", + "JO SMITH|new name|new2

                        name2

                        |new3
                        name3
                        ", 'Data link using: {^{contentEditable name convertBack=~lower/}} - triggers after keydown, converts the data, and sets on data'); handlers += "|" + events[inputOrKeydownContentEditable].length; @@ -20714,9 +20429,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( result += "--" + mytag.bndArgs() + "|" + linkedEl.value + "|" + person.first + "|" + $("#result").text(); assert.equal(result, - isIE8 ? "newName--updatedFirst|updatedFirst|updatedFirst|updatedFirstUpdate" - + "--updatedFirst0|updatedFirst0|updatedFirst0|updatedFirst0Update" - : "newName--updatedFirst|updatedFirst|updatedFirst|updatedFirst Update" + "newName--updatedFirst|updatedFirst|updatedFirst|updatedFirst Update" + "--updatedFirst0|updatedFirst0|updatedFirst0|updatedFirst0 Update", "With linkedElem set in onBind, mytag.bndArgs() and mytag.updateValue().setValue() correctly access/update two-way bound values"); @@ -21810,18 +21523,14 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( } // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text:First Jo Middle Herbert Last Blow: Jo Herbert Blow|" - : "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text: First Jo Middle Herbert Last Blow: Jo Herbert Blow|", + assert.equal(getResult(), "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text: First Jo Middle Herbert Last Blow: Jo Herbert Blow|", "Two-way bound tag with multiple else blocks - initial render"); // ................................ Act .................................. $.observable(person).setProperty({first: "Bob", middle: "Xavier", last: "Smith"}); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text:FirstBob MiddleXavier LastSmith:BobXavierSmith|" - : "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text: First Bob Middle Xavier Last Smith: Bob Xavier Smith|", + assert.equal(getResult(), "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text: First Bob Middle Xavier Last Smith: Bob Xavier Smith|", "Two-way bound tag with multiple else blocks - observable update"); // ................................ Act .................................. @@ -21833,10 +21542,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( $(linkedElLast).change(); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" - + " Text:FirstnewJo MiddlenewHerbert LastnewBlow:newJonewHerbertnewBlow|" - : "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + assert.equal(getResult(), "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + " Text: First newJo Middle newHerbert Last newBlow: newJo newHerbert newBlow|", "Two-way bound tag with multiple else blocks - updated inputs"); @@ -21846,10 +21552,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.updateValue("updatedLast", 0, 2); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" - + " Text:FirstupdatedFirst MiddleupdatedMiddle LastupdatedLast:updatedFirstupdatedMiddleupdatedLast|" - : "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + assert.equal(getResult(), "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + " Text: First updatedFirst Middle updatedMiddle Last updatedLast: updatedFirst updatedMiddle updatedLast|", "Two-way bound tag with multiple else blocks - tag.updateValue() updates outer bindings and linkedCtxPrm, but not linkedElems"); @@ -21857,10 +21560,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.updateValues("updatedFirst2"); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" - + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" - : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + assert.equal(getResult(), "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", "Two-way bound tag with multiple else blocks - tag.updateValues() updates outer bindings and linkedCtxPrm, but not linkedElems"); @@ -21870,10 +21570,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.setValue("changedLast", 0, 2); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" - + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" - : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + assert.equal(getResult(), "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", "Two-way bound tag with multiple else blocks - tag.setValue() updates linkedElems only"); @@ -21881,17 +21578,14 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.setValues("changedFirst2"); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" - + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" - : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + assert.equal(getResult(), "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", "Two-way bound tag with multiple else blocks - tag.setValues() updates linkedElems only"); // ............................... Assert ................................. assert.ok(mytag.contents("input")[1] === mytag.tagCtxs[1].contents("input")[0] - && mytag.nodes()[isIE8 ? 4 : 5] === mytag.tagCtxs[1].nodes()[1] - && mytag.nodes()[isIE8 ? 4 : 5] === mytag.tagCtxs[1].contentView.nodes()[1] + && mytag.nodes()[5] === mytag.tagCtxs[1].nodes()[1] + && mytag.nodes()[5] === mytag.tagCtxs[1].contentView.nodes()[1] && mytag.childTags("child")[1] === mytag.tagCtxs[1].childTags("child")[0] && mytag.childTags("child").length === mytag.tagCtxs[0].childTags("child").length + mytag.tagCtxs[1].childTags("child").length + mytag.tagCtxs[2].childTags("child").length, "Two-way bound tag, multiple else blocks: calls tagCtx.contents() tagCtx.nodes() tagCtx.childTags() return from one else block." @@ -21938,18 +21632,14 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag = $.view(linkedElFirst).tag; // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text:First Jo Middle Herbert Last Blow: Jo Herbert Blow|" - : "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text: First Jo Middle Herbert Last Blow: Jo Herbert Blow|", + assert.equal(getResult(), "Data: Jo-Herbert-Blow Inputs: Jo-Herbert-Blow Text: First Jo Middle Herbert Last Blow: Jo Herbert Blow|", "Two-way bound tag (using render method) with multiple else blocks - initial render"); // ................................ Act .................................. $.observable(person).setProperty({first: "Bob", middle: "Xavier", last: "Smith"}); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text:FirstBob MiddleXavier LastSmith:BobXavierSmith|" - : "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text: First Bob Middle Xavier Last Smith: Bob Xavier Smith|", + assert.equal(getResult(), "Data: Bob-Xavier-Smith Inputs: Bob-Xavier-Smith Text: First Bob Middle Xavier Last Smith: Bob Xavier Smith|", "Two-way bound tag (using render method) with multiple else blocks - observable update"); // ................................ Act .................................. @@ -21961,10 +21651,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( $(linkedElLast).change(); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" - + " Text:FirstnewJo MiddlenewHerbert LastnewBlow:newJonewHerbertnewBlow|" - : "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + assert.equal(getResult(), "Data: newJo-newHerbert-newBlow Inputs: newJo-newHerbert-newBlow" + " Text: First newJo Middle newHerbert Last newBlow: newJo newHerbert newBlow|", "Two-way bound tag (using render method) with multiple else blocks - updated inputs"); @@ -21974,10 +21661,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.updateValue("updatedLast", 0, 2); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" - + " Text:FirstupdatedFirst MiddleupdatedMiddle LastupdatedLast:updatedFirstupdatedMiddleupdatedLast|" - : "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + assert.equal(getResult(), "Data: updatedFirst-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + " Text: First updatedFirst Middle updatedMiddle Last updatedLast: updatedFirst updatedMiddle updatedLast|", "Two-way bound tag (using render method) with multiple else blocks - tag.updateValue() updates outer bindings and linkedCtxPrm, but not linkedElems"); @@ -21985,10 +21669,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.updateValues("updatedFirst2"); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" - + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" - : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + assert.equal(getResult(), "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: newJo-newHerbert-newBlow" + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", "Two-way bound tag (using render method) with multiple else blocks - tag.updateValues() updates outer bindings and linkedCtxPrm, but not linkedElems"); @@ -21998,10 +21679,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.setValue("changedLast", 0, 2); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" - + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" - : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + assert.equal(getResult(), "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst-changedMiddle-changedLast" + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", "Two-way bound tag (using render method) with multiple else blocks - tag.setValue() updates linkedElems only"); @@ -22009,16 +21687,13 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.setValues("changedFirst2"); // ............................... Assert ................................. - assert.equal(getResult(), isIE8 - ? "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" - + " Text:FirstupdatedFirst2 MiddleupdatedMiddle LastupdatedLast:updatedFirst2updatedMiddleupdatedLast|" - : "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + assert.equal(getResult(), "Data: updatedFirst2-updatedMiddle-updatedLast Inputs: changedFirst2-changedMiddle-changedLast" + " Text: First updatedFirst2 Middle updatedMiddle Last updatedLast: updatedFirst2 updatedMiddle updatedLast|", "Two-way bound tag (using render method) with multiple else blocks - tag.setValues() updates linkedElems only"); // ............................... Assert ................................. assert.ok(mytag.contents("input")[1] === mytag.tagCtxs[1].contents("input")[0] - && mytag.nodes()[isIE8 ? 4 : 5] === mytag.tagCtxs[1].nodes()[1] + && mytag.nodes()[5] === mytag.tagCtxs[1].nodes()[1] && mytag.childTags("child")[1] === mytag.tagCtxs[1].childTags("child")[0], "Two-way bound tag (using render method) with multiple else blocks - calls to tagCtx.contents() tagCtx.nodes() tagCtx.childTags() work correctly"); @@ -22063,18 +21738,14 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( } // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: Jo-Blow Inputs: Jo-Blow-Blow-Jo Text: Jo Blow Blow JoJo Blow|" - : "Data: Jo-Blow Inputs: Jo-Blow-Blow-Jo Text: Jo Blow Blow Jo Jo Blow|", + assert.equal(getResult2(), "Data: Jo-Blow Inputs: Jo-Blow-Blow-Jo Text: Jo Blow Blow Jo Jo Blow|", "Two-way tag with multiple bindings and multiple else blocks - initial render"); // ................................ Act .................................. $.observable(person).setProperty({first: "Bob", last: "Smith"}); // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: Bob-Smith Inputs: Bob-Smith-Smith-Bob Text: Bob Smith Smith BobBobSmith|" - : "Data: Bob-Smith Inputs: Bob-Smith-Smith-Bob Text: Bob Smith Smith Bob Bob Smith|", + assert.equal(getResult2(), "Data: Bob-Smith Inputs: Bob-Smith-Smith-Bob Text: Bob Smith Smith Bob Bob Smith|", "Two-way tag with multiple bindings and multiple else blocks - observable update"); // ................................ Act .................................. @@ -22085,9 +21756,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( $(linkedElems1[1]).change(); // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: newJo-newBlow Inputs: Bob-Smith-newBlow-newJo Text: newJo newBlow newBlow newJonewJonewBlow|" - : "Data: newJo-newBlow Inputs: Bob-Smith-newBlow-newJo Text: newJo newBlow newBlow newJo newJo newBlow|", + assert.equal(getResult2(), "Data: newJo-newBlow Inputs: Bob-Smith-newBlow-newJo Text: newJo newBlow newBlow newJo newJo newBlow|", "Two-way tag with multiple bindings and multiple else blocks - updated inputs"); // ................................ Act .................................. @@ -22096,10 +21765,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.updateValue("updatedFirst", 1, 1); // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: updatedFirst-updatedLast Inputs: Bob-Smith-newBlow-newJo" - + " Text: updatedFirst updatedLast updatedLast updatedFirstupdatedFirstupdatedLast|" - : "Data: updatedFirst-updatedLast Inputs: Bob-Smith-newBlow-newJo" + assert.equal(getResult2(), "Data: updatedFirst-updatedLast Inputs: Bob-Smith-newBlow-newJo" + " Text: updatedFirst updatedLast updatedLast updatedFirst updatedFirst updatedLast|", "Two-way tag with multiple bindings and multiple else blocks - tag.updateValue() updates outer bindings but not linkedElems"); @@ -22108,10 +21774,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.updateValues("updatedFirst2", "updatedLast2"); // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-newBlow-newJo" - + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" - : "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-newBlow-newJo" + assert.equal(getResult2(), "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-newBlow-newJo" + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", "Two-way tag with multiple bindings and multiple else blocks - tag.updateValues() updates outer bindings but not linkedElems"); @@ -22121,10 +21784,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.setValue("changedFirst", 1, 1); // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast-changedFirst" - + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" - : "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast-changedFirst" + assert.equal(getResult2(), "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast-changedFirst" + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", "Two-way tag with multiple bindings and multiple else blocks - tag.setValue() updates linkedElems only"); @@ -22133,10 +21793,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.tagCtxs[1].setValues("changedLast2", "changedFirst2"); // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast2-changedFirst2" - + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" - : "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast2-changedFirst2" + assert.equal(getResult2(), "Data: updatedFirst2-updatedLast2 Inputs: Bob-Smith-changedLast2-changedFirst2" + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", "Two-way tag with multiple bindings and multiple else blocks - tagCtx.setValues() updates linkedElems only"); @@ -22145,10 +21802,7 @@ QUnit.test('Custom Tag Controls - two-way binding (multiple targets)', function( mytag.setValues("changedFirst3", "changedLast3"); // ............................... Assert ................................. - assert.equal(getResult2(), isIE8 - ? "Data: updatedFirst2-updatedLast2 Inputs: changedFirst3-changedLast3-changedLast2-changedFirst2" - + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2updatedFirst2updatedLast2|" - : "Data: updatedFirst2-updatedLast2 Inputs: changedFirst3-changedLast3-changedLast2-changedFirst2" + assert.equal(getResult2(), "Data: updatedFirst2-updatedLast2 Inputs: changedFirst3-changedLast3-changedLast2-changedFirst2" + " Text: updatedFirst2 updatedLast2 updatedLast2 updatedFirst2 updatedFirst2 updatedLast2|", "Two-way tag with multiple bindings and multiple else blocks - tag.setValues() updates linkedElems only"); @@ -23256,6 +22910,96 @@ QUnit.test("Tag control events", function(assert) { markup: '
                        {^{myWidget person1.lastName things/}}
                        ', tags: { myWidget: { + init: function(tagCtx, linkCtx, ctx) { + eventData += "init "; + }, + render: function(name, things) { + eventData += "render "; + return "" + name + " " + things.length + " " + this.getType() + ""; + }, + onBeforeUpdateVal: function(ev, eventArgs) { + eventData += "onBeforeUpdateVal "; + }, + onUpdate: function(ev, eventArgs, newTagCtxs) { + eventData += "update "; + }, + onAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "after "; + }, + onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onBind "; + }, + onUnbind: function(tagCtx, linkCtx, ctx, ev, eventArgs) { + eventData += "onUnbind "; + }, + onBeforeChange: function(ev, eventArgs) { + eventData += "onBeforeChange "; + }, + onAfterChange: function(ev, eventArgs) { + eventData += "onAfterChange "; + }, + onDispose: function() { + eventData += "dispose "; + }, + getType: function() { + eventData += "getType "; + return this.type; + }, + type: "special" + } + } + }).link("#result", model); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "One 1 special|init render getType onBind after ", + '{^{myWidget/}} - Events fire in order during rendering'); + eventData = ""; + + // ................................ Act .................................. + $.observable(person1).setProperty("lastName", "Two"); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "Two 1 special|onBeforeChange update onUnbind render getType onBind after onAfterChange ", + '{^{myWidget/}} - Events fire in order during update (setProperty)'); + eventData = ""; + + // ................................ Act .................................. + $.observable(model.things).insert(0, {thing: "tree"}); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "Two 2 special|onBeforeChange update onUnbind render getType onBind after onAfterChange ", + '{^{myWidget/}} - Events fire in order during update (insert)'); + eventData = ""; + + // ................................ Act .................................. + $.observable(model.things).refresh([{thing: "bush"}, {thing: "flower"}]); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "Two 2 special|onBeforeChange update onUnbind render getType onBind after onAfterChange ", + '{^{myWidget/}} - Events fire in order during update (refresh)'); + eventData = ""; + + // ................................ Act .................................. + $("#result").empty(); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "|onUnbind dispose ", + '{^{myWidget/}} - onDispose fires when container element is emptied or removed'); + + // ................................ Reset ................................ + person1.lastName = "One"; + model.things = []; + eventData = ""; + +// =============================== Arrange =============================== + eventData = ""; + model.things = [{thing: "box"}]; // reset Prop + + // ................................ Act .................................. + $.templates({ + markup: '
                        {^{myCustomArrayChangeWidget person1.lastName things/}}
                        ', + tags: { + myCustomArrayChangeWidget: { init: function(tagCtx, linkCtx, ctx) { eventData += "init "; }, @@ -23270,7 +23014,7 @@ QUnit.test("Tag control events", function(assert) { eventData += "update "; }, onArrayChange: function(ev, eventArgs) { - eventData += "onArrayChange "; + eventData += "onArrayChange" + (eventArgs.refresh ? "(refresh) " : " "); }, onAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) { var tag = this, @@ -23315,25 +23059,40 @@ QUnit.test("Tag control events", function(assert) { }).link("#result", model); // ............................... Assert ................................. - assert.equal($("#result").text() + "|" + eventData, "One 1 special|init render getType onBind after ", '{^{myWidget/}} - Events fire in order during rendering: render and onAfterLink'); + assert.equal($("#result").text() + "|" + eventData, "One 1 special|init render getType onBind after ", + '{^{myCustomArrayChangeWidget/}} - Events fire in order during rendering'); + eventData = ""; // ................................ Act .................................. $.observable(person1).setProperty("lastName", "Two"); // ............................... Assert ................................. - assert.equal($("#result").text() + "|" + eventData, "Two 1 special|init render getType onBind after onBeforeChange update onUnbind render getType onBind after onAfterChange ", '{^{myWidget/}} - Events fire in order during update: update, render and onAfterLink'); + assert.equal($("#result").text() + "|" + eventData, "Two 1 special|onBeforeChange update onUnbind render getType onBind after onAfterChange ", + '{^{myCustomArrayChangeWidget/}} - Events fire in order during update (setProperty)'); + eventData = ""; // ................................ Act .................................. $.observable(model.things).insert(0, {thing: "tree"}); // ............................... Assert ................................. - assert.equal($("#result").text() + "|" + eventData, "Two 1 special|init render getType onBind after onBeforeChange update onUnbind render getType onBind after onAfterChange onArrayChange ", '{^{myWidget/}} - Events fire in order during update: update, render and onAfterLink'); + assert.equal($("#result").text() + "|" + eventData, "Two 1 special|onArrayChange ", + '{^{myCustomArrayChangeWidget/}} - No update during insert - instead, custom onArrayChange handler called'); + eventData = ""; + + // ................................ Act .................................. + $.observable(model.things).refresh([{thing: "bush"}, {thing: "flower"}]); + + // ............................... Assert ................................. + assert.equal($("#result").text() + "|" + eventData, "Two 1 special|onArrayChange(refresh) onArrayChange(refresh) onArrayChange ", + '{^{myCustomArrayChangeWidget/}} - No update during refresh - instead, custom onArrayChange handler called for each event'); + eventData = ""; // ................................ Act .................................. $("#result").empty(); // ............................... Assert ................................. - assert.equal($("#result").text() + "|" + eventData, "|init render getType onBind after onBeforeChange update onUnbind render getType onBind after onAfterChange onArrayChange onUnbind dispose ", '{^{myWidget/}} - onDispose fires when container element is emptied or removed'); + assert.equal($("#result").text() + "|" + eventData, "|onUnbind dispose ", + '{^{myCustomArrayChangeWidget/}} - onDispose fires when container element is emptied or removed'); // ................................ Reset ................................ person1.lastName = "One"; @@ -23373,9 +23132,90 @@ QUnit.test("Tag control events", function(assert) { assert.equal($("#result").text() + "|" + eventData, "|init onBind after ", '{^{myNoRenderWidget/}} - A data-linked tag control which does not render fires init and onAfterLink'); $("#result").empty(); +}); - //TODO: Add tests for attaching jQuery UI widgets or similar to tag controls, using data-link and {^{mytag}} inline data binding. +QUnit.test("tag onArrayChange options", function(assert) { -}); + // =============================== Arrange =============================== + var data = { + items: ["aa", "AA"], + items2: ["bb", "BB"] + }; + + // ................................ Act .................................. + var template = "First: {{:#data[0]}} Last: {{:#data[length-1]}} First2: {{:~tagCtx.args[1][0]}} Last2: {{:~tagCtx.args[1][~tagCtx.args[1].length-1]}}"; + $.templates({ + markup: +'1 {^{mytag items items2/}} ' + +'2 {^{arrChFn items items2/}} ' + +'2b {^{arrChFalse items items2/}} ' + +'3 ' + +'4 ' + +'4b ' + +'5 {^{> items[0]+\'-\'+items2[0]}} ' + +'6 ' + +'7 ' + +'8 ' + +'9 {^{if items[0] ==="aa"}}not a{{/if}} ' + +'10 {^{for items2[0]==="bb" && items}} {{:}}{{/for}} ' + + +'1 {^{mytag items items2 onArrayChange=false/}} ' + +'2 {^{arrChFn items items2 onArrayChange=true/}} ' + +'2b {^{arrChFalse items items2 onArrayChange=true/}} ' + +'3 ' + +'4 ' + +'4b ' + +'5 {^{> items[0]+\'-\'+items2[0] onArrayChange=false}} ' + +'6 ' + +'7 ' + +'8 ' + +'9 {^{if items[0] ==="aa" onArrayChange=false}}not a{{/if}} ' + +'10 {^{for items2[0]==="bb" && items onArrayChange=true}} {{:}}{{/for}}', + tags: { + mytag: template, + arrChFn: { + template: template, + onArrayChange: function() {} + }, + arrChFalse: { + template: template, + onArrayChange: function() {} + } + } + }).link("#result", data); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + "1 First: aa Last: AA First2: bb Last2: BB 2 First: aa Last: AA First2: bb Last2: BB 2b First: aa Last: AA First2: bb Last2: BB 3 First: aa Last: AA First2: bb Last2: BB 4 First: aa Last: AA First2: bb Last2: BB 4b First: aa Last: AA First2: bb Last2: BB 5 aa-bb 6 aa-bb 7 aa-bb 8 aa-bb 9 not a 10 aa AA 1 First: aa Last: AA First2: bb Last2: BB 2 First: aa Last: AA First2: bb Last2: BB 2b First: aa Last: AA First2: bb Last2: BB 3 First: aa Last: AA First2: bb Last2: BB 4 First: aa Last: AA First2: bb Last2: BB 4b First: aa Last: AA First2: bb Last2: BB 5 aa-bb 6 aa-bb 7 aa-bb 8 aa-bb 9 not a 10 aa AA", + 'Initial rendering'); + + // ................................ Act .................................. + $.observable(data.items).move(0, data.items.length-1); + $.observable(data.items2).move(0, data.items2.length-1); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + "1 First: AA Last: aa First2: BB Last2: bb 2 First: aa Last: AA First2: bb Last2: BB 2b First: aa Last: AA First2: bb Last2: BB 3 First: AA Last: aa First2: BB Last2: bb 4 First: aa Last: AA First2: bb Last2: BB 4b First: aa Last: AA First2: bb Last2: BB 5 AA-BB 6 AA-BB 7 AA-BB 8 AA-BB 9 10 AA aa 1 First: aa Last: AA First2: bb Last2: BB 2 First: AA Last: aa First2: BB Last2: bb 2b First: AA Last: aa First2: BB Last2: bb 3 First: aa Last: AA First2: bb Last2: BB 4 First: AA Last: aa First2: BB Last2: bb 4b First: AA Last: aa First2: BB Last2: bb 5 aa-bb 6 aa-bb 7 aa-bb 8 aa-bb 9 not a 10 false", + 'After array change "move"'); + + // ................................ Act .................................. + $.observable(data).setProperty({items: ["xx", "XX"], items2: ["yy", "YY"]}); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + "1 First: xx Last: XX First2: yy Last2: YY 2 First: xx Last: XX First2: yy Last2: YY 2b First: xx Last: XX First2: yy Last2: YY 3 First: xx Last: XX First2: yy Last2: YY 4 First: xx Last: XX First2: yy Last2: YY 4b First: xx Last: XX First2: yy Last2: YY 5 xx-yy 6 xx-yy 7 xx-yy 8 xx-yy 9 10 false 1 First: xx Last: XX First2: yy Last2: YY 2 First: xx Last: XX First2: yy Last2: YY 2b First: xx Last: XX First2: yy Last2: YY 3 First: xx Last: XX First2: yy Last2: YY 4 First: xx Last: XX First2: yy Last2: YY 4b First: xx Last: XX First2: yy Last2: YY 5 xx-yy 6 xx-yy 7 xx-yy 8 xx-yy 9 10 false", + 'After property change "setProperty"'); + + // ................................ Act .................................. + $.observable(data.items).refresh(["aa", "AA"]); + + // ............................... Assert ................................. + assert.equal($("#result").text(), + "1 First: aa Last: AA First2: yy Last2: YY 2 First: xx Last: XX First2: yy Last2: YY 2b First: xx Last: XX First2: yy Last2: YY 3 First: aa Last: AA First2: yy Last2: YY 4 First: xx Last: XX First2: yy Last2: YY 4b First: xx Last: XX First2: yy Last2: YY 5 aa-yy 6 aa-yy 7 aa-yy 8 aa-yy 9 not a 10 false 1 First: xx Last: XX First2: yy Last2: YY 2 First: aa Last: AA First2: yy Last2: YY 2b First: aa Last: AA First2: yy Last2: YY 3 First: xx Last: XX First2: yy Last2: YY 4 First: aa Last: AA First2: yy Last2: YY 4b First: aa Last: AA First2: yy Last2: YY 5 xx-yy 6 xx-yy 7 xx-yy 8 xx-yy 9 10 false", + 'After array change "refresh"'); + + // ................................ Reset ................................ + $("#result").empty(); +}); })(this, this.jQuery); \ No newline at end of file