Skip to content

Commit

Permalink
Handle non-whitespace after root node closes in loose mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Feb 16, 2010
1 parent 444b761 commit e036794
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/sax.js
Expand Up @@ -217,11 +217,12 @@ function write (chunk) {
continue;
case S.TEXT:
if (c === "<") parser.state = S.OPEN_WAKA;
else if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot)) {
strictFail("Text data outside of root node.");
else {
if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot))
strictFail("Text data outside of root node.");
if (c === "&") parser.state = S.TEXT_ENTITY;
else parser.textNode += c;
}
else if (c === "&") parser.state = S.TEXT_ENTITY;
else parser.textNode += c;
continue;
case S.OPEN_WAKA:
// either a /, ?, !, or text is coming next.
Expand Down

0 comments on commit e036794

Please sign in to comment.