diff --git a/dist/moon.js b/dist/moon.js index a8ba0cb2..a14fab6f 100644 --- a/dist/moon.js +++ b/dist/moon.js @@ -104,7 +104,7 @@ var NEWLINE_RE = /\n/g; var DOUBLE_QUOTE_RE = /"/g; var BACKSLASH_RE = /\\[^n]/g; - return str.replace(NEWLINE_RE, "\\n").replace(DOUBLE_QUOTE_RE, "\\\"").replace(BACKSLASH_RE, "\\\\"); + return str.replace(NEWLINE_RE, "\\n").replace(BACKSLASH_RE, "\\\\").replace(DOUBLE_QUOTE_RE, "\\\""); }; /** diff --git a/dist/moon.min.js b/dist/moon.min.js index 485dcd2c..07b468ac 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(e,t){"object"==typeof module&&module.exports?module.exports=t():e.Moon=t()}(this,function(){"use strict";function e(e){this.instance=e}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||G,this.$hooks=this.$opts.hooks||{},this.$methods=this.$opts.methods||{},this.$events={},this.$dom={},this.$observer=new e(this),this.$destroyed=!1,this.$initialRender=!0,this.$queued=!1,this.init()}var n={},r={},o={},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;};"},s=0;e.prototype.notify=function(){c(this.instance)};var a=function(e){t.config.silent||console.log(e)},u=function(e){console.error("[Moon] ERR: "+e)},c=function(e){e.$queued||e.$destroyed||(e.$queued=!0,setTimeout(function(){e.build(),R(e,"updated"),e.$queued=!1},0))},p=function(e){for(var t={},n=e.attributes,r=n.length;r--;)t[n[r].name]=n[r].value;return e.__moon__props__=t,t},l=function(){return{shouldRender:!0,eventListeners:{}}},f=function(e){var t=/\n/g,n=/"/g,r=/\\[^n]/g;return e.replace(t,"\\n").replace(n,'\\"').replace(r,"\\\\")},h=function(e,t,n,r){var o,i=n.split(".");for(o=0;o",e.current);return r===-1?(e.tokens.push({type:"comment",value:t.slice(e.current)}),void(e.current=n)):(e.tokens.push({type:"comment",value:t.slice(e.current,r)}),void(e.current=r+3))},S=function(e){var t=e.input,n=(t.length,"/"===t.charAt(e.current+1));e.tokens.push({type:"tagStart",close:n}),e.current+=n?2:1;var r=T(e);D(e);var o="/"===t.charAt(e.current);e.tokens.push({type:"tagEnd",close:!1}),e.current+=o?2:1,o&&(e.tokens.push({type:"tagStart",close:!0}),e.tokens.push({type:"tag",value:r}),e.tokens.push({type:"attribute",value:{}}),e.tokens.push({type:"tagEnd",close:!1}))},T=function(e){for(var t=e.input,n=t.length,r=e.current;r"!==o&&" "!==o)break;r++}for(var i=r;i"===o||" "===o)break;i++}var s=t.slice(r,i);return e.tokens.push({type:"tag",value:s}),e.current=i,s},D=function(e){for(var t=e.input,n=t.length,r=e.current,o={},i="",s=/([^=\s]*)(=?)("[^"]*"|[^\s"]*)/gi;r"===a||"/"===a&&">"===u)break;i+=a,r++}i.replace(s,function(e,t,n,r){var i=r[0],s=r[r.length-1];("'"===i&&"'"===s||'"'===i&&'"'===s)&&(r=r.slice(1,-1)),r||(r=t),t&&r&&(o[t]=r)}),e.current=r,e.tokens.push({type:"attribute",value:o})},j=function(e){for(var t={type:"ROOT",children:[]},n={current:0,tokens:e};n.current1?o.slice(0,-2)+"}":o+"}"},K=function(e){if(0===Object.keys(e).length)return"{}";var t="{";for(var n in e)t+='"'+n+'": ['+F(e[n])+"], ";return t=t.slice(0,-2)+"}"},z=function(e){var t="{";for(var n in e)t+="eventListeners"===n?'"'+n+'": '+K(e[n])+", ":'"'+n+'": '+e[n]+", ";return t=t.slice(0,-2)+"}"},F=function(e){for(var t="",n=0;n1&&(s=u.shift(),a=u.join("(").slice(0,-1));var c="";r.shift();for(var p=0;p",e.current);return r===-1?(e.tokens.push({type:"comment",value:t.slice(e.current)}),void(e.current=n)):(e.tokens.push({type:"comment",value:t.slice(e.current,r)}),void(e.current=r+3))},S=function(e){var t=e.input,n=(t.length,"/"===t.charAt(e.current+1));e.tokens.push({type:"tagStart",close:n}),e.current+=n?2:1;var r=T(e);D(e);var o="/"===t.charAt(e.current);e.tokens.push({type:"tagEnd",close:!1}),e.current+=o?2:1,o&&(e.tokens.push({type:"tagStart",close:!0}),e.tokens.push({type:"tag",value:r}),e.tokens.push({type:"attribute",value:{}}),e.tokens.push({type:"tagEnd",close:!1}))},T=function(e){for(var t=e.input,n=t.length,r=e.current;r"!==o&&" "!==o)break;r++}for(var i=r;i"===o||" "===o)break;i++}var s=t.slice(r,i);return e.tokens.push({type:"tag",value:s}),e.current=i,s},D=function(e){for(var t=e.input,n=t.length,r=e.current,o={},i="",s=/([^=\s]*)(=?)("[^"]*"|[^\s"]*)/gi;r"===a||"/"===a&&">"===u)break;i+=a,r++}i.replace(s,function(e,t,n,r){var i=r[0],s=r[r.length-1];("'"===i&&"'"===s||'"'===i&&'"'===s)&&(r=r.slice(1,-1)),r||(r=t),t&&r&&(o[t]=r)}),e.current=r,e.tokens.push({type:"attribute",value:o})},j=function(e){for(var t={type:"ROOT",children:[]},n={current:0,tokens:e};n.current1?o.slice(0,-2)+"}":o+"}"},K=function(e){if(0===Object.keys(e).length)return"{}";var t="{";for(var n in e)t+='"'+n+'": ['+F(e[n])+"], ";return t=t.slice(0,-2)+"}"},z=function(e){var t="{";for(var n in e)t+="eventListeners"===n?'"'+n+'": '+K(e[n])+", ":'"'+n+'": '+e[n]+", ";return t=t.slice(0,-2)+"}"},F=function(e){for(var t="",n=0;n1&&(s=u.shift(),a=u.join("(").slice(0,-1));var c="";r.shift();for(var p=0;p