diff --git a/src/html/tokenizer.ts b/src/html/tokenizer.ts index 6285cdf..da07171 100644 --- a/src/html/tokenizer.ts +++ b/src/html/tokenizer.ts @@ -1942,9 +1942,12 @@ export class Tokenizer { this.startToken("VExpressionEnd") this.appendTokenValue(RIGHT_CURLY_BRACKET, null) this.appendTokenValue(RIGHT_CURLY_BRACKET, null) - return this.vExpressionScriptState - ? this.vExpressionScriptState.state - : this.returnState + if (this.vExpressionScriptState) { + const state = this.vExpressionScriptState.state + this.vExpressionScriptState = null + return state + } + return this.returnState } this.appendTokenValue(RIGHT_CURLY_BRACKET, null) diff --git a/test/fixtures/ast/mustache-without-open-in-textarea/ast.json b/test/fixtures/ast/mustache-without-open-in-textarea/ast.json new file mode 100644 index 0000000..cc24dc1 --- /dev/null +++ b/test/fixtures/ast/mustache-without-open-in-textarea/ast.json @@ -0,0 +1,618 @@ +{ + "type": "Program", + "start": 0, + "end": 0, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 0 + } + }, + "range": [ + 0, + 0 + ], + "body": [], + "sourceType": "module", + "comments": [], + "tokens": [], + "templateBody": { + "type": "VElement", + "range": [ + 0, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "name": "template", + "rawName": "template", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "selfClosing": false, + "attributes": [] + }, + "children": [ + { + "type": "VText", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "value": "\n " + }, + { + "type": "VExpressionContainer", + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "expression": { + "type": "Literal", + "start": 16, + "end": 19, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 16, + 19 + ], + "value": 123, + "raw": "123" + }, + "references": [] + }, + { + "type": "VText", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 25, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 32 + } + }, + "name": "textarea", + "rawName": "textarea", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 25, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "selfClosing": false, + "attributes": [] + }, + "children": [ + { + "type": "VText", + "range": [ + 35, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "value": " }}
+ {{ 123 }} + + diff --git a/test/fixtures/ast/mustache-without-open-in-textarea/token-ranges.json b/test/fixtures/ast/mustache-without-open-in-textarea/token-ranges.json new file mode 100644 index 0000000..8d08b5f --- /dev/null +++ b/test/fixtures/ast/mustache-without-open-in-textarea/token-ranges.json @@ -0,0 +1,22 @@ +[ + "", + "\n ", + "{{", + "123", + "}}", + "\n ", + "", + " ", + "}}", + " ", + "", + "\n", + "", + "\n" +] \ No newline at end of file diff --git a/test/fixtures/ast/mustache-without-open-in-textarea/tree.json b/test/fixtures/ast/mustache-without-open-in-textarea/tree.json new file mode 100644 index 0000000..7312fca --- /dev/null +++ b/test/fixtures/ast/mustache-without-open-in-textarea/tree.json @@ -0,0 +1,65 @@ +[ + { + "type": "VElement", + "text": "", + "children": [ + { + "type": "VStartTag", + "text": "", + "children": [] + } + ] + } +] \ No newline at end of file pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy