Skip to content

Commit 29d6a7c

Browse files
committed
fix: whitespace characters will not trigger foster parenting.
1 parent ad15a52 commit 29d6a7c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,14 @@ function text(node, state) {
194194
state.parser.tokenizer.state = 0
195195
}
196196

197+
const isWhitespace = /^[ \t\n\f\r]+$/.test(node.value)
198+
const tokenType = isWhitespace
199+
? Token.TokenType.WHITESPACE_CHARACTER
200+
: Token.TokenType.CHARACTER
201+
197202
/** @type {Token.CharacterToken} */
198203
const token = {
199-
type: Token.TokenType.CHARACTER,
204+
type: tokenType,
200205
chars: node.value,
201206
location: createParse5Location(node)
202207
}

0 commit comments

Comments
 (0)