From a135ab24b82a8d0cad4642ccb87f172f1815f432 Mon Sep 17 00:00:00 2001 From: Kabir Shah Date: Sun, 9 Apr 2017 12:15:57 -0700 Subject: [PATCH] allow parser to handle cases with nested elements of same type --- dist/moon.js | 2 +- dist/moon.min.js | 2 +- src/compiler/parser.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/moon.js b/dist/moon.js index 44421b9a..22beec7b 100644 --- a/dist/moon.js +++ b/dist/moon.js @@ -1212,7 +1212,7 @@ } else if (token !== undefined) { // Match all children var current = state.current; - while (token.type !== "tag" || token.type === "tag" && (token.closeStart === false && token.closeEnd === false || token.value !== tagType)) { + while (token.type !== "tag" || token.type === "tag" && (token.closeStart === undefined && token.closeEnd === undefined || token.value !== tagType)) { var parsedChildState = walk(state); if (parsedChildState !== null) { node.children.push(parsedChildState); diff --git a/dist/moon.min.js b/dist/moon.min.js index 6118cecd..44331777 100644 --- a/dist/moon.min.js +++ b/dist/moon.min.js @@ -4,4 +4,4 @@ * Released under the MIT License * http://moonjs.ga */ -!function(e,t){"object"==typeof module&&module.exports?module.exports=t():e.Moon=t()}(this,function(){"use strict";function e(e){this.instance=e,this.cache={},this.signals={},this.dep={target:null,map:{}}}function t(t){this.$opts=t||{},this.$id=s++,this.$name=this.$opts.name||"root",this.$data=this.$opts.data||{},this.$render=this.$opts.render||y,this.$hooks=this.$opts.hooks||{},this.$methods=this.$opts.methods||{},this.$events={},this.$dom={},this.$observer=new e(this),this.$destroyed=!0,this.$queued=!1,this.$opts.computed&&a(this,this.$opts.computed),this.init()}var r={},n={},i={},o={stop:"event.stopPropagation();",prevent:"event.preventDefault();",ctrl:"if(!event.ctrlKey) {return;};",shift:"if(!event.shiftKey) {return;};",alt:"if(!event.altKey) {return;};",enter:"if(event.keyCode !== 13) {return;};"},s=0,a=function(e,t){for(var r in t)!function(r){e.$observer.observe(r);var n={get:function(){var n=null;return e.$observer.cache[r]?n=e.$observer.cache[r]:(e.$observer.dep.target=r,n=t[r].get.call(e),e.$observer.dep.target=null,e.$observer.cache[r]=n),n}};t[r].set&&(n.set=function(n){return t[r].set.call(e,n)}),Object.defineProperty(e.$data,r,n)}(r)};e.prototype.observe=function(e){var t=this;this.signals[e]=function(){t.cache[e]=null}},e.prototype.notify=function(e){if(this.dep.map[e])for(var t=0;ta?s:a,c=0;c",e.current);if(n===-1)return e.tokens.push({type:"comment",value:t.slice(e.current)}),void(e.current=r);e.tokens.push({type:"comment",value:t.slice(e.current,n)}),e.current=n+3},q=function(e){var t=e.input,r=(t.length,"/"===t.charAt(e.current+1));e.current+=r?2:1;var n=X(e);J(n,e);var i="/"===t.charAt(e.current);e.current+=i?2:1,r&&(n.closeStart=!0),i&&(n.closeEnd=!0)},X=function(e){for(var t=e.input,r=t.length,n=e.current,i="";n"===o||" "===o)break;i+=o,n++}var s={type:"tag",value:i};return e.tokens.push(s),e.current=n,s},J=function(e,t){for(var r=t.input,n=r.length,i=t.current,o=r.charAt(i),s=r.charAt(i+1),a=function(){i++,o=r.charAt(i),s=r.charAt(i+1)},u={};i"!==o&&("/"!==o||">"!==s);)if(" "!==o){for(var l="",c=!1;i"===o||"/"===o||">"===s){c=!0;break}l+=o,a()}var p={name:l,value:"",meta:{}};if(c)u[l]=p;else{a();var f=" ";for("'"!==o&&'"'!==o||(f=o,a());i1&&(a=u.shift(),s=u.join("(").slice(0,-1));var l="";n.shift();for(var c=0;ca?s:a,c=0;c"===o||" "===o)break;i+=o,n++}var s={type:"tag",value:i};return e.tokens.push(s),e.current=n,s},J=function(e,t){for(var r=t.input,n=r.length,i=t.current,o=r.charAt(i),s=r.charAt(i+1),a=function(){i++,o=r.charAt(i),s=r.charAt(i+1)},u={};i"!==o&&("/"!==o||">"!==s);)if(" "!==o){for(var l="",c=!1;i"===o||"/"===o||">"===s){c=!0;break}l+=o,a()}var p={name:l,value:"",meta:{}};if(c)u[l]=p;else{a();var f=" ";for("'"!==o&&'"'!==o||(f=o,a());i1&&(a=u.shift(),s=u.join("(").slice(0,-1));var l="";n.shift();for(var c=0;c