parse string content as raw string

This commit is contained in:
Sergio Garcia Murillo
2015-02-23 16:41:24 +01:00
parent 05b6ddb8ed
commit bf58b49418
2 changed files with 5 additions and 1 deletions

View File

@@ -170,6 +170,8 @@ getContent = HTMLTools.Parse.getContent = function (scanner, shouldStopFunc) {
attrs.value = textareaValue;
}
}
} else if (token.n === 'script') {
content = getRawText(scanner, token.n, shouldStopFunc);
} else {
content = getContent(scanner, shouldStopFunc);
}

View File

@@ -13,6 +13,7 @@ var A = HTML.A;
var DIV = HTML.DIV;
var P = HTML.P;
var TEXTAREA = HTML.TEXTAREA;
var SCRIPT = HTML.SCRIPT;
Tinytest.add("html-tools - parser getContent", function (test) {
@@ -149,6 +150,8 @@ Tinytest.add("html-tools - parser getContent", function (test) {
succeed('<br x="\r\r">', BR({x:'\n\n'}));
succeed('<br x=y\r>', BR({x:'y'}));
fatal('<br x=\r>');
succeed('<script>var x="<div>";</script>',SCRIPT('var x="<div>";'));
succeed('<script>var x=1 && 0;</script>',SCRIPT('var x=1 && 0;'));
});
Tinytest.add("html-tools - parseFragment", function (test) {
@@ -365,5 +368,4 @@ Tinytest.add("html-tools - getTemplateTag", function (test) {
succeed('<textarea {{a}} x=1 {{b}}></textarea>',
TEXTAREA(Attrs({x:"1"}, TemplateTag({stuff: 'a'}),
TemplateTag({stuff: 'b'}))));
});