Skip to content

Commit b032b9a

Browse files
committed
修复了 script 标签中的 < 会被解析为标签的问题 #259
1 parent 2a51c54 commit b032b9a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/miniprogram/parser.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,15 @@ lexer.prototype.checkClose = function (method) {
866866
this.i += selfClose ? 2 : 1
867867
this.start = this.i
868868
this.handler.onOpenTag(selfClose)
869-
this.state = this.text
869+
if (this.handler.tagName == 'script') {
870+
this.i = this.content.indexOf('</', this.i)
871+
if (this.i != -1) {
872+
this.i += 2
873+
this.start = this.i
874+
}
875+
this.state = this.endTag
876+
} else
877+
this.state = this.text
870878
return true
871879
}
872880
return false

src/uni-app/components/mp-html/parser.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,15 @@ lexer.prototype.checkClose = function (method) {
934934
this.i += selfClose ? 2 : 1
935935
this.start = this.i
936936
this.handler.onOpenTag(selfClose)
937-
this.state = this.text
937+
if (this.handler.tagName == 'script') {
938+
this.i = this.content.indexOf('</', this.i)
939+
if (this.i != -1) {
940+
this.i += 2
941+
this.start = this.i
942+
}
943+
this.state = this.endTag
944+
} else
945+
this.state = this.text
938946
return true
939947
}
940948
return false

0 commit comments

Comments
 (0)