-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle self-closing tags in liteDOM. #328 #370
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One potential problem and one typo.
@@ -211,7 +211,7 @@ export class LiteParser implements MinDOMParser<LiteDocument> { | |||
// Otherwise, the child tag becames the parent node to which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
@@ -189,7 +189,7 @@ export class LiteParser implements MinDOMParser<LiteDocument> { | |||
// | |||
// Get the child to be added to the node | |||
// | |||
const kind = tag.match(/<(.*?)[\s\n>]/)[1].toLowerCase(); | |||
const kind = tag.match(/<(.*?)[\s\n>/]/)[1].toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that not be
const kind = tag.match(/<(.*?)[\s\n>/]/)[1].toLowerCase(); | |
const kind = tag.match(/<(.*?)[\s\n/>]/)[1].toLowerCase(); |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the characters in the [...]
doesn't matter. It just matches up to any one of the enclosed characters. So it is correct as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I now realise that it is only any of the four characters.
This PR fixes the liteDOM to handle self-closing tags (in particular, for MathML that has things like
<mspace width="1em" />
or<mrow/>
).Resolves issue #328