diff --git a/compiler/ast/Text.js b/compiler/ast/Text.js index 1e831c125..aae8d7db0 100644 --- a/compiler/ast/Text.js +++ b/compiler/ast/Text.js @@ -36,6 +36,10 @@ class Text extends Node { return; } + if (codegen.context.isFlagSet('SCRIPT_BODY')) { + escape = false; + } + if (escape === true) { argument.value = escapeXml(argument.value.toString()); } diff --git a/test/autotests/render/script-tag-entities-static/expected.html b/test/autotests/render/script-tag-entities-static/expected.html new file mode 100644 index 000000000..9700a5d51 --- /dev/null +++ b/test/autotests/render/script-tag-entities-static/expected.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/autotests/render/script-tag-entities-static/marko.json b/test/autotests/render/script-tag-entities-static/marko.json new file mode 100644 index 000000000..e85a78200 --- /dev/null +++ b/test/autotests/render/script-tag-entities-static/marko.json @@ -0,0 +1,3 @@ +{ + "tags-dir": "./tags" +} \ No newline at end of file diff --git a/test/autotests/render/script-tag-entities-static/tags/test-script/code-generator.js b/test/autotests/render/script-tag-entities-static/tags/test-script/code-generator.js new file mode 100644 index 000000000..e56d231c8 --- /dev/null +++ b/test/autotests/render/script-tag-entities-static/tags/test-script/code-generator.js @@ -0,0 +1,7 @@ + +module.exports = function generateCode(elNode, codegen) { + var builder = codegen.builder; + return builder.htmlElement('script', {}, [ + builder.text(builder.literal('')) + ]); +}; \ No newline at end of file diff --git a/test/autotests/render/script-tag-entities-static/tags/test-script/marko-tag.json b/test/autotests/render/script-tag-entities-static/tags/test-script/marko-tag.json new file mode 100644 index 000000000..8d0664211 --- /dev/null +++ b/test/autotests/render/script-tag-entities-static/tags/test-script/marko-tag.json @@ -0,0 +1,3 @@ +{ + "code-generator": "./code-generator" +} \ No newline at end of file diff --git a/test/autotests/render/script-tag-entities-static/template.marko b/test/autotests/render/script-tag-entities-static/template.marko new file mode 100644 index 000000000..08c4a4065 --- /dev/null +++ b/test/autotests/render/script-tag-entities-static/template.marko @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/autotests/render/script-tag-entities-static/test.js b/test/autotests/render/script-tag-entities-static/test.js new file mode 100644 index 000000000..fd8ffe152 --- /dev/null +++ b/test/autotests/render/script-tag-entities-static/test.js @@ -0,0 +1,3 @@ +exports.templateData = { + name: 'John' +};