Skip to content

Commit 2581e59

Browse files
committed
Commit 83 (v0.9.83 - Beta)
Feature improvements: - New boundProps feature for custom tag controls. See sample here: http://www.jsviews.com/#samples/tag-controls/range Downloads: - Minified files provided for all 'plugin libraries' - Updated download pages: http://www.jsviews.com/#download/sample-tagcontrols http://www.jsviews.com/#download/jqueryui-tagcontrols http://www.jsviews.com/#download/jsrplugins Documentation: - New sample for {{draggable}} and {{droppable}}: http://www.jsviews.com/#samples/tag-controls/draggable-droppable - New jQuery widget controls documentation topic: http://www.jsviews.com/#jqui Bug fixes: - #351: Binding contextual parameters - #352: multiselect not showing initial selection - BorisMoore/jsrender#305 "Unknown template" error message with jQuery 3.0+ - validate.js minor bugfix/improvement - Several minor bug fixes Unit tests: - Several additional unit tests
1 parent ac5401b commit 2581e59

28 files changed

+2181
-1715
lines changed

jquery.observable.js

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! JsObservable v0.9.82 (Beta): http://jsviews.com/#jsobservable */
1+
/*! JsObservable v0.9.83 (Beta): http://jsviews.com/#jsobservable */
22
/*
33
* Subcomponent of JsViews
44
* Data change events for data-linking
@@ -44,7 +44,7 @@ if (!$ || !$.fn) {
4444
throw "JsObservable requires jQuery"; // We require jQuery
4545
}
4646

47-
var versionNumber = "v0.9.82",
47+
var versionNumber = "v0.9.83",
4848
$observe, $observable,
4949

5050
$views = $.views =
@@ -461,8 +461,8 @@ if (!$.observe) {
461461
}
462462
}
463463

464-
var i, p, skip, parts, prop, path, dep, unobserve, callback, cbId, inId, el, data, events, contextCb, items, cbBindings,
465-
depth, innerCb, parentObs, allPath, filter, initNsArr, initNsArrLen,
464+
var i, p, skip, parts, prop, path, dep, unobserve, callback, cbId, inId, el, data, events, contextCb, innerContextCb,
465+
items, cbBindings, depth, innerCb, parentObs, allPath, filter, initNsArr, initNsArrLen,
466466
ns = observeStr,
467467
paths = this != 1 // Using != for IE<10 bug- see jsviews/issues/237
468468
? concat.apply([], arguments) // Flatten the arguments - this is a 'recursive call' with params using the 'wrapped array'
@@ -491,7 +491,7 @@ if (!$.observe) {
491491
}
492492
callback = lastArg;
493493
if (l && $isFunction(paths[l - 1])) {
494-
contextCb = callback;
494+
innerContextCb = contextCb = callback;
495495
callback = paths.pop();
496496
l--;
497497
}
@@ -544,6 +544,11 @@ if (!$.observe) {
544544
if (path === "") {
545545
continue;
546546
}
547+
if (path && path._cp) { // Contextual parameter
548+
contextCb = $sub._gccb(path[0]); // getContextCb: Get context callback for the contextual view (where contextual param evaluated/assigned)
549+
origRoot = root = path[0].data; // Contextual data
550+
path = path[1];
551+
}
547552
object = root;
548553
if ("" + path === path) {
549554
// Consider support for computed paths: jsviews/issues/292
@@ -562,7 +567,11 @@ if (!$.observe) {
562567
depth = path.split(".").length - depth;
563568
// if more than one ^ in the path, the first one determines depth
564569
}
565-
if (contextCb && (items = contextCb(path, root, depth))) {
570+
if (contextCb) {
571+
items = contextCb(path, root, depth);
572+
contextCb = innerContextCb;
573+
}
574+
if (items) {
566575
// If the array of objects and paths returned by contextCb is non empty, insert them
567576
// into the sequence, replacing the current item (path). Otherwise simply remove current item (path)
568577
l += items.length - 1;
@@ -1107,6 +1116,7 @@ if (!$.observe) {
11071116
};
11081117

11091118
$sub.advSet = function() { // refresh advanced settings
1119+
$sub._gccb = this._gccb; // getContextCallback method
11101120
global._jsv = $subSettings.advanced._jsv
11111121
? { // create global _jsv, for accessing views, etc
11121122
cbBindings: cbBindingsStore

jquery.observable.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery.observable.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)