-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lib): improve head and body regex in
domparser.js
Because the head and body regexes test against the closing tag, this causes html with unclosed head or body to not be parsed correctly. For example, given the following: ```js parse('<html><body>'); ``` The expected output is: ``` [ { type: 'tag', name: 'html', attribs: {}, children: [ { type: 'tag', name: 'body', attribs: {}, children: [], next: null, prev: null, parent: [Circular] } ], next: null, prev: null, parent: null } ] ``` But the actual output is: ``` [ { "next": null, "prev": null, "parent": null, "name": "html", "attribs": {}, "type": "tag", "children": [] } ] ``` The fix is to update the regex to use the opening tag instead of the closing tag. Add test case. Fixes #18
- Loading branch information
1 parent
c2665b4
commit 457bb58
Showing
2 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters