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:
parent
fd5749a49a
commit
3f7ee2773b
@ -61,7 +61,7 @@ export class XmlFormatter {
|
|||||||
|
|
||||||
// <elm></elm>
|
// <elm></elm>
|
||||||
else if (/^<(\w|:)/.test(parts[i - 1]) && /^<\/(\w|:)/.test(parts[i])
|
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];
|
output += parts[i];
|
||||||
if (!inComment) level--;
|
if (!inComment) level--;
|
||||||
|
Loading…
Reference in New Issue
Block a user