|
2 | 2 | * |
3 | 3 | * ModelView.js |
4 | 4 | * @version: 5.0.0 |
5 | | -* @built on 2022-03-23 12:05:22 |
| 5 | +* @built on 2022-03-23 18:38:28 |
6 | 6 | * |
7 | 7 | * A simple, light-weight, versatile and fast isomorphic MVVM JavaScript framework (Browser and Server) |
8 | 8 | * https://github.com/foo123/modelview.js |
|
11 | 11 | * |
12 | 12 | * ModelView.js |
13 | 13 | * @version: 5.0.0 |
14 | | -* @built on 2022-03-23 12:05:22 |
| 14 | +* @built on 2022-03-23 18:38:28 |
15 | 15 | * |
16 | 16 | * A simple, light-weight, versatile and fast isomorphic MVVM JavaScript framework (Browser and Server) |
17 | 17 | * https://github.com/foo123/modelview.js |
@@ -450,7 +450,7 @@ function $closest(selector, el) |
450 | 450 | var found = el.closest(selector); |
451 | 451 | return found ? [found] : []; |
452 | 452 | } |
453 | | - else if (el[MATCHES]) |
| 453 | + else if (MATCHES) |
454 | 454 | { |
455 | 455 | while (el) |
456 | 456 | { |
@@ -2692,7 +2692,7 @@ function tpl2codesimplef(tpl) |
2692 | 2692 | { |
2693 | 2693 | end = [p1, p2+3]; |
2694 | 2694 | code += tpl2codesimplek(tpl.slice(0, start[0])); |
2695 | | - code += "\n_$$_ += (function(MODEL){var _$$_='',ITEM=function(MODEL){var _$$_='';"+tpl2codesimplef(tpl.slice(start[1], end[0]))+"return _$$_;};if(MODEL){for(var I=0,N=MODEL.get('"+start[2]+".length');I<N;++I){_$$_ += ITEM(MODEL.getProxy('"+start[2]+".'+I, '.'));}}else{_$$_='<!--foreach {"+start[2]+"}-->'+ITEM()+'<!--/foreach-->';}return _$$_;})(MODEL);" |
| 2695 | + code += "\n_$$_ += (function(MODEL){var _$$_='',ITEM=function(MODEL){var _$$_='';"+tpl2codesimplef(tpl.slice(start[1], end[0]))+"\nreturn _$$_;};if(MODEL){for(var I=0,N=MODEL.get('"+start[2]+".length');I<N;++I){_$$_ += ITEM(MODEL.getProxy('"+start[2]+".'+I, '.'));}}else{_$$_='<!--foreach {"+start[2]+"}-->'+ITEM()+'<!--/foreach-->';}return _$$_;})(MODEL);" |
2696 | 2696 | tpl = tpl.slice(end[1]); |
2697 | 2697 | offset = 0; |
2698 | 2698 | } |
@@ -3154,6 +3154,8 @@ function morphCollectionSimple(view, list, key, collection, isDirty, model, only |
3154 | 3154 | delNodes(null, parentNode, startIndex+1+m*d.from, m*(d.to-d.from+1)); |
3155 | 3155 | break; |
3156 | 3156 | case 'add': |
| 3157 | + x = new Array(2+d.to-d.from+1); x[0] = d.from; x[1] = 0; |
| 3158 | + list.map.splice.apply(list.map, x); |
3157 | 3159 | frag = Fragment(); |
3158 | 3160 | iterate(function(index) { |
3159 | 3161 | var node = clone(list); |
@@ -4785,8 +4787,8 @@ model.data( [Object data] ); |
4785 | 4787 | if (!is_array(ks)) ks = Str(ks).split('.'); |
4786 | 4788 | for (c=0,i=0,l=ks.length; i<l; ++i) |
4787 | 4789 | { |
4788 | | - if (!u || !u.k || !HAS.call(u.k, ks[i])) break; |
4789 | | - u = u.k[ks[i]]; //c++; |
| 4790 | + if (!u || !u.k || (!HAS.call(u.k, ks[i]) && !HAS.call(u.k, WILDCARD))) break; |
| 4791 | + u = (u.k[ks[i]] || u.k[WILDCARD]); //c++; |
4790 | 4792 | if (u.f) return true; |
4791 | 4793 | } |
4792 | 4794 | return false;//(0 < l) && (c === l); |
@@ -8111,8 +8113,8 @@ view.render( [Boolean immediate=false] ); |
8111 | 8113 | //if ('function' !== typeof morphSimple) throw err('Simple Mode is not included in this build'); |
8112 | 8114 | callback = function() { |
8113 | 8115 | view.$reset = {}; view.$cache = null; |
8114 | | - morphSimple(view, view.$map, view.$model, !model || ('sync' === immediate) ? null : true/*model.getDirty()*/); |
8115 | | - nextTick(function(){ |
| 8116 | + morphSimple(view, view.$map, view.$model, !model || ('sync' === immediate) ? false : true); |
| 8117 | + nextTick(function() { |
8116 | 8118 | clearInvalid(view); |
8117 | 8119 | // notify any 3rd-party also if needed |
8118 | 8120 | view.publish('render', {}); |
@@ -8150,7 +8152,7 @@ view.render( [Boolean immediate=false] ); |
8150 | 8152 | view.$cnt = {}; view.$reset = {}; view.$cache['#'] = null; |
8151 | 8153 | morph(view, view.$renderdom, view.$out.call(view, htmlNode)); |
8152 | 8154 | view.$cache['#'] = null; |
8153 | | - nextTick(function(){ |
| 8155 | + nextTick(function() { |
8154 | 8156 | clearInvalid(view); |
8155 | 8157 | // notify any 3rd-party also if needed |
8156 | 8158 | view.publish('render', {}); |
|
0 commit comments