|
1 | | -/*! jsviews.js v1.0.0-beta.69 (Beta Candidate) single-file version: http://jsviews.com/ */ |
| 1 | +/*! jsviews.js v1.0.0-beta.70 (Beta Candidate) single-file version: http://jsviews.com/ */ |
2 | 2 | /*! includes JsRender, JsObservable and JsViews - see: http://jsviews.com/#download */ |
3 | 3 |
|
4 | 4 | /* Interactive data-driven views using JsRender templates */ |
@@ -1563,10 +1563,10 @@ function parseParams(params, pathBindings, tmpl) { |
1563 | 1563 | // "a.b().c^d().e.f().g" - which has four chained paths, "a.b()", "^c.d()", ".e.f()" and ".g" |
1564 | 1564 | parenDepth = 0, |
1565 | 1565 | fnCall = {}, // We are in a function call |
1566 | | - pathStart = {}; // tracks the start of the current path such as c^d() in the above example |
| 1566 | + pathStart = {}, // tracks the start of the current path such as c^d() in the above example |
| 1567 | + result = (params + (tmpl ? " " : "")).replace(rParams, parseTokens); |
1567 | 1568 |
|
1568 | | - return (params + (tmpl ? " " : "")) |
1569 | | - .replace(rParams, parseTokens); |
| 1569 | + return !parenDepth && result || syntaxError(params); // Syntax error if unbalanced parens in params expression |
1570 | 1570 | } |
1571 | 1571 |
|
1572 | 1572 | function buildCode(ast, tmpl, isLinkExpr) { |
@@ -3258,7 +3258,7 @@ function updateContent(sourceValue, linkCtx, attr, tag) { |
3258 | 3258 | // When called (in propertyChangeHandler) for target HTML returns true |
3259 | 3259 | // When called (in propertyChangeHandler) for other targets returns boolean for "changed" |
3260 | 3260 | var setter, prevNode, nextNode, promise, nodesToRemove, useProp, tokens, id, openIndex, closeIndex, testElem, nodeName, cStyle, |
3261 | | - renders = sourceValue !== undefined && !linkCtx._noUpd, // For data-link="^{...}", don't update the first time (no initial render) - e.g. to leave server rendered values. |
| 3261 | + renders = attr !== NONE && sourceValue !== undefined && !linkCtx._noUpd, // For data-link="^{...}", don't update the first time (no initial render) - e.g. to leave server rendered values. |
3262 | 3262 | source = linkCtx.data, |
3263 | 3263 | target = tag && tag.parentElem || linkCtx.elem, |
3264 | 3264 | $target = $(target), |
@@ -4989,6 +4989,40 @@ function clean(elems) { |
4989 | 4989 | } |
4990 | 4990 | } |
4991 | 4991 |
|
| 4992 | +//function clean(elems) { |
| 4993 | +// // Remove data-link bindings, or contained views |
| 4994 | +// var elem, bindings, binding, |
| 4995 | +// elemArray = [], |
| 4996 | +// len = elems.length, |
| 4997 | +// i = len; |
| 4998 | +// while (i--) { |
| 4999 | +// // Copy into an array, so that deletion of nodes from DOM will not cause our 'i' counter to get shifted |
| 5000 | +// // (Note: This seems as fast or faster than elemArray = [].slice.call(elems); ...) |
| 5001 | +// elemArray.push(elems[i]); |
| 5002 | +// } |
| 5003 | +// i = len; |
| 5004 | +// while (i--) { |
| 5005 | +// elem = elemArray[i]; |
| 5006 | +// if (elem.parentNode) { |
| 5007 | +// // Has not already been removed from the DOM |
| 5008 | +// if (bindings = elem._jsvBnd) { |
| 5009 | +// // Get propertyChange bindings for this element |
| 5010 | +// // This may be an element with data-link, or the opening script marker node for a data-linked tag {^{...}} |
| 5011 | +// // bindings is a string with the syntax: "(&bindingId)*" |
| 5012 | +//// bindings = bindings.slice(1).split("&"); |
| 5013 | +// elem._jsvBnd = ""; |
| 5014 | +// // l = bindings.length; |
| 5015 | +//// while (l--) { |
| 5016 | +// while (binding = rSplitBindings.exec(bindings)) { |
| 5017 | +// // Remove associated bindings |
| 5018 | +// removeViewBinding(binding, elem._jsvLkEl, elem); // unbind bindings with this bindingId on this view |
| 5019 | +// } |
| 5020 | +// } |
| 5021 | +// disposeTokens(markerNodeInfo(elem) + (elem._df || "")); |
| 5022 | +// } |
| 5023 | +// } |
| 5024 | +//} |
| 5025 | + |
4992 | 5026 | function removeViewBinding(bindId, linkedElemTag, elem) { |
4993 | 5027 | // Unbind |
4994 | 5028 | var objId, linkCtx, tag, object, obsId, tagCtxs, l, map, $linkedElem, linkedElem, trigger, view, |
@@ -5045,7 +5079,7 @@ function removeViewBinding(bindId, linkedElemTag, elem) { |
5045 | 5079 | } |
5046 | 5080 | view = linkCtx.view; |
5047 | 5081 | if (view.type === "link") { |
5048 | | - view.parent.removeViews(view._.key, undefined, true); // a "link" view is associated with the binding, so should be disposed with binding. |
| 5082 | + view.parent.removeViews(view._.key, undefined, true); // A "link" view is associated with the binding, so should be disposed with binding. |
5049 | 5083 | } else { |
5050 | 5084 | delete view._.bnds[bindId]; |
5051 | 5085 | } |
|
0 commit comments