Comparing version 1.0.0 to 1.0.1
20
index.js
@@ -114,2 +114,3 @@ var strIndex = 0 | ||
var str = this.input | ||
var breakIndex = str.length | ||
str = clearString(str, this.map) | ||
@@ -119,3 +120,2 @@ str = clearBrace(str, this.map) | ||
this.index = 0 | ||
var breakIndex = 10000 | ||
do { | ||
@@ -390,16 +390,17 @@ this.parseComment() | ||
} else { | ||
var pool = [] | ||
var matchTag = left.match(/<\/?[a-z][^>]+>/) | ||
// var pool = [] | ||
var matchTag = left.match(/<\/?[a-z][^>]*>/) | ||
if (matchTag) { | ||
pool.push(matchTag.index) | ||
var index = matchTag.index | ||
// pool.push(matchTag.index) | ||
} | ||
var matchComment = left.match(/<!--(?!<!)[^\[>][\s\S]*?-->/) | ||
if (matchComment) { | ||
log('jsx DO NOT support <!--xxx--> comment tag!') | ||
throw ('jsx DO NOT support <!--xxx--> comment tag!') | ||
//这应该抛出警告 | ||
pool.push(matchComment.index) | ||
// pool.push(matchComment.index) | ||
} | ||
if (!pool.length) | ||
return | ||
var index = Math.min.apply(0, pool) | ||
// if (!pool.length) | ||
// return | ||
// var index = Math.min.apply(0, pool) | ||
if (index !== 0) { | ||
@@ -412,3 +413,2 @@ this.createText(left, index) | ||
var rattrs = /([^=\s]+)(?:=(\S+))?/ | ||
@@ -415,0 +415,0 @@ pp.parseProps = function(attrs) { |
@@ -118,2 +118,3 @@ (function(global, factory) { | ||
var str = this.input | ||
var breakIndex = str.length | ||
str = clearString(str, this.map) | ||
@@ -123,3 +124,3 @@ str = clearBrace(str, this.map) | ||
this.index = 0 | ||
var breakIndex = 10000 | ||
do { | ||
@@ -394,16 +395,17 @@ this.parseComment() | ||
} else { | ||
var pool = [] | ||
var matchTag = left.match(/<\/?[a-z][^>]+>/) | ||
// var pool = [] | ||
var matchTag = left.match(/<\/?[a-z][^>]*>/) | ||
if (matchTag) { | ||
pool.push(matchTag.index) | ||
var index = matchTag.index | ||
// pool.push(matchTag.index) | ||
} | ||
var matchComment = left.match(/<!--(?!<!)[^\[>][\s\S]*?-->/) | ||
if (matchComment) { | ||
log('jsx DO NOT support <!--xxx--> comment tag!') | ||
throw ('jsx DO NOT support <!--xxx--> comment tag!') | ||
//这应该抛出警告 | ||
pool.push(matchComment.index) | ||
// pool.push(matchComment.index) | ||
} | ||
if (!pool.length) | ||
return | ||
var index = Math.min.apply(0, pool) | ||
// if (!pool.length) | ||
// return | ||
// var index = Math.min.apply(0, pool) | ||
if (index !== 0) { | ||
@@ -410,0 +412,0 @@ this.createText(left, index) |
{ | ||
"name": "jsx-parser", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "a simple jsx parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,2 +5,8 @@ # jsx-parser | ||
npm | ||
``` | ||
npm install jsx-parser | ||
``` | ||
how to require | ||
@@ -12,2 +18,8 @@ | ||
or | ||
```html | ||
<script src="index.umd"></script | ||
``` | ||
how to use | ||
```javascript | ||
@@ -14,0 +26,0 @@ |
149063
837
119