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

[FIX] end tag with space after name should be valid #2899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gdcGithub
Copy link
Contributor

xml End tag may have spaces after name.

is a valid xml.

var regex = new RegExp("\\s*>");
var subSource = source.substr(i+2);
var end = subSource.search(regex);
end = end + i + 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, that doesn't seem the same.
So in case when I forget to close the tag:

<Select>
</Select

end would be -1 because indexOf wouldn't find it

but in the new code end would be -1 + i + 2, so something else entirely.
Can we change this to something like: end = endIndex === -1 ? endIndex: endIndex + i + 2

I am pretty sure it breaks something otherwise, because, this is the current error:
Screenshot 2023-11-02 at 14 23 16

And this is the new one:
Screenshot 2023-11-02 at 14 24 18

var lastIndex = source.lastIndexOf(match[match.length-1]);
pos = closeMap[tagName] = lastIndex;
} else {
pos = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also keep the same chain assignment from above here, so pos = closeMap[tagName] = -1 just to keep the previous logic the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants