Improve Closing Tag Identification

The previous code would cause a self-closing tag to appear as the
opening tag if the following tag was a closing tag of the same name.

Fixes #90
This commit is contained in:
Josh Johnson 2017-06-20 23:04:45 -04:00
parent fd5749a49a
commit 3f7ee2773b

View File

@ -61,7 +61,7 @@ export class XmlFormatter {
// <elm></elm>
else if (/^<(\w|:)/.test(parts[i - 1]) && /^<\/(\w|:)/.test(parts[i])
&& /^<[\w:\-\.\,]+/.exec(parts[i - 1])[0] == /^<\/[\w:\-\.\,]+/.exec(parts[i])[0].replace('/', '')) {
&& /^<[\w:\-\.\,\/ ]+/.exec(parts[i - 1])[0] == /^<\/[\w:\-\.\, ]+/.exec(parts[i])[0].replace('/', '')) {
output += parts[i];
if (!inComment) level--;