diff --git a/core/parser.js b/core/parser.js
index <HASH>..<HASH> 100644
--- a/core/parser.js
+++ b/core/parser.js
@@ -342,7 +342,8 @@ module.exports = function (opts) {
             var openTags = [];
             var tag = '', lineLastLiteral = '', lastLiteral = '';
             var block = newBlock(type.html, blocks);
-            let stop = false, inComments = false, inJs = false;
+            let stop = false, inComments = false;
+            let inJs = "script".equal(outerWaitTag, true);
             var lastCh = '';
 
             for (var ch = this.pickChar(); ch; ch = this.pickChar()) {
diff --git a/test/cases/code.js b/test/cases/code.js
index <HASH>..<HASH> 100644
--- a/test/cases/code.js
+++ b/test/cases/code.js
@@ -536,6 +536,22 @@ els
     a++;
 } whil`,
             error: "'while' expected at line 8 pos 3."
+        },
+        {
+            name: "Code 61",
+            template: `
+<div>JS</div>
+@if (2 > 1) {
+    <script type="text/javascript">
+        var longText = "<div>";
+    </script>
+}`,
+            expected: `
+<div>JS</div>
+    <script type="text/javascript">
+        var longText = "<div>";
+    </script>
+`
         }
     ];
     module.exports = cases;
* ! Fixed parsing qouted strings in JS-blocks wrapped in code-block.