diff --git a/dist/moon.js b/dist/moon.js index d271c283..dab7eca2 100644 --- a/dist/moon.js +++ b/dist/moon.js @@ -417,7 +417,7 @@ var noop = function () {}; /* ======= Compiler ======= */ - var lex = function (input, opts) { + var lex = function (input) { var state = { input: input, current: 0, @@ -429,7 +429,6 @@ var lexState = function (state) { var input = state.input; - var len = input.length; while (state.current < len) { // Check if it is text if (input.charAt(state.current) !== "<") { @@ -505,7 +504,6 @@ // Lex Starting of Tag var isClosingStart = input.charAt(state.current + 1) === "/"; - var startChar = input.charAt(state.current); state.tokens.push({ type: "tagStart", close: isClosingStart diff --git a/dist/moon.min.js b/dist/moon.min.js index e683f9da..3c6c3f82 100644 --- a/dist/moon.min.js +++ b/dist/moon.min.js @@ -5,4 +5,4 @@ * Free to use under the MIT license. * https://kingpixil.github.io/license */ -!function(t,e){"object"==typeof module&&module.exports?module.exports=e():t.Moon=e()}(this,function(){"use strict";function t(t){this.$opts=t||{},this.$id=o++,this.$name=this.$opts.name||"root",this.$parent=this.$opts.parent||null,this.$data=this.$opts.data||{},this.$render=this.$opts.render||A,this.$hooks=this.$opts.hooks||{},this.$methods=this.$opts.methods||{},this.$events={},this.$dom={},this.$destroyed=!1,this.$initialRender=!0,this.$queued=!1,this.init()}var e={},n={},r={},i={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;};"},o=0,s=function(e){t.config.silent||console.log(e)},u=function(t){console.error("[Moon] ERR: "+t)},a=function(t){for(var e={},n=t.attributes,r=n.length;r--;)e[n[r].name]=n[r].value;return t.__moon__attrs__=e,e},c=function(){return{shouldRender:!0,component:!1,eventListeners:{}}},p=function(t){var e=/\n/g,n=/"/g;return t.replace(e,"\\n").replace(n,'\\"')},f=function(t,e,n){var r=/{{([A-Za-z0-9_]+)([A-Za-z0-9_.()\[\]]+)?}}/gi,i=t;return t.replace(r,function(t,r,o){o||(o=""),i=n?n(i,t,r,o):e?i.replace(t,'" + instance.get("'+r+'")'+o+' + "'):i.replace(t,'instance.get("'+r+'")'+o)}),i},l=function(t){var e={};if(!t)return e;e.default=[];for(var n=0;n",t.current);return r===-1?(t.tokens.push({type:"comment",value:e.slice(t.current)}),void(t.current=n)):(t.tokens.push({type:"comment",value:e.slice(t.current,r)}),void(t.current=r+3))},E=function(t){var e=t.input,n=(e.length,"/"===e.charAt(t.current+1));e.charAt(t.current);t.tokens.push({type:"tagStart",close:n}),t.current+=n?2:1;var r=S(t);T(t);var i="/"===e.charAt(t.current);t.tokens.push({type:"tagEnd",close:!1}),t.current+=i?2:1,i&&(t.tokens.push({type:"tagStart",close:!0}),t.tokens.push({type:"tag",value:r}),t.tokens.push({type:"attribute",value:{}}),t.tokens.push({type:"tagEnd",close:!1}))},S=function(t){for(var e=t.input,n=e.length,r=t.current;r"!==i&&" "!==i)break;r++}for(var o=r;o"===i||" "===i)break;o++}var s=e.slice(r,o);return t.tokens.push({type:"tag",value:s}),t.current=o,s},T=function(t){for(var e=t.input,n=e.length,r=t.current,i={},o="",s=/([^=\s]*)(=?)("[^"]*"|[^\s"]*)/gi;r"===u||"/"===u)break;o+=u,r++}o.replace(s,function(t,e,n,r){var o=r[0],s=r[r.length-1];("'"===o&&"'"===s||'"'===o&&'"'===s)&&(r=r.slice(1,-1)),r||(r=e),e&&r&&(i[e]=r)}),t.current=r,t.tokens.push({type:"attribute",value:i})},j=function(t){for(var e={type:"ROOT",children:[]},n={current:0,tokens:t};n.current",t.current);return r===-1?(t.tokens.push({type:"comment",value:e.slice(t.current)}),void(t.current=n)):(t.tokens.push({type:"comment",value:e.slice(t.current,r)}),void(t.current=r+3))},E=function(t){var e=t.input,n=(e.length,"/"===e.charAt(t.current+1));t.tokens.push({type:"tagStart",close:n}),t.current+=n?2:1;var r=S(t);T(t);var i="/"===e.charAt(t.current);t.tokens.push({type:"tagEnd",close:!1}),t.current+=i?2:1,i&&(t.tokens.push({type:"tagStart",close:!0}),t.tokens.push({type:"tag",value:r}),t.tokens.push({type:"attribute",value:{}}),t.tokens.push({type:"tagEnd",close:!1}))},S=function(t){for(var e=t.input,n=e.length,r=t.current;r"!==i&&" "!==i)break;r++}for(var o=r;o"===i||" "===i)break;o++}var s=e.slice(r,o);return t.tokens.push({type:"tag",value:s}),t.current=o,s},T=function(t){for(var e=t.input,n=e.length,r=t.current,i={},o="",s=/([^=\s]*)(=?)("[^"]*"|[^\s"]*)/gi;r"===u||"/"===u)break;o+=u,r++}o.replace(s,function(t,e,n,r){var o=r[0],s=r[r.length-1];("'"===o&&"'"===s||'"'===o&&'"'===s)&&(r=r.slice(1,-1)),r||(r=e),e&&r&&(i[e]=r)}),t.current=r,t.tokens.push({type:"attribute",value:i})},j=function(t){for(var e={type:"ROOT",children:[]},n={current:0,tokens:t};n.current