Skip to content
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

Merged
merged 1 commit into from
Nov 17, 2019
Merged

Handle self-closing tags in liteDOM. #328 #370

merged 1 commit into from
Nov 17, 2019

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Oct 20, 2019

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

@dpvc dpvc requested a review from zorkow October 20, 2019 20:15
Copy link
Member

@zorkow zorkow left a 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
Copy link
Member

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that not be

Suggested change
const kind = tag.match(/<(.*?)[\s\n>/]/)[1].toLowerCase();
const kind = tag.match(/<(.*?)[\s\n/>]/)[1].toLowerCase();

?

Copy link
Member Author

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.

Copy link
Member

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.

@dpvc dpvc merged commit e1b5fea into develop Nov 17, 2019
@dpvc dpvc deleted the issue328 branch November 17, 2019 21:22
@dpvc dpvc added this to the 3.0.1 milestone Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants