Fix Attribute Quotes Regression

Issue: #187
This commit is contained in:
Josh Johnson 2018-06-11 18:40:54 -04:00
parent b50cdaea8e
commit 88de774389
1 changed files with 6 additions and 1 deletions

View File

@ -32,6 +32,7 @@ export class V2XmlFormatter implements XmlFormatter {
let indentLevel = 0;
let location = Location.Text;
let lastNonTextLocation = Location.Text; // hah
let attributeQuote = "";
// NOTE: all "exiting" checks should appear after their associated "entering" checks
for (let i = 0; i < xml.length; i++) {
@ -126,13 +127,17 @@ export class V2XmlFormatter implements XmlFormatter {
output += cc;
lastNonTextLocation = location;
location = Location.AttributeValue;
attributeQuote = cc;
}
// exiting StartTag.Attribute.AttributeValue, entering StartTag
else if (location === Location.AttributeValue && (cc === "\"" || cc === "'")) {
else if (location === Location.AttributeValue && cc === attributeQuote) {
output += cc;
lastNonTextLocation = location;
location = Location.StartTag;
attributeQuote = undefined;
}
// approaching the end of a self-closing tag where there was no whitespace (issue #149)