Skip to content

Commit 5f92c24

Browse files
committed
If the node only contains a single Char, no need to collapse it.
It already only has one character in it, so no need to collapse the node.
1 parent 8cf57fe commit 5f92c24

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

XS.xs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ void JsAppendNode(Node* element, Node* node) {
282282

283283
/* collapses a node to a single whitespace character */
284284
void JsCollapseNodeToWhitespace(Node* node) {
285-
if (node->contents) {
285+
if (node->contents && (node->length > 1)) {
286286
node->length = 1;
287287
node->contents[1] = '\0';
288288
}

0 commit comments

Comments
 (0)