From 157bafa5b93af8dcba3b3706b66a17b0d0100a7a Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Tue, 20 Jun 2017 23:30:54 -0400 Subject: [PATCH] Fix "xmlns" Identification The previous code did not account for "xmlns=" in self-closing elements (it only identified "xmlns:"). But the indent counter identified both, which caused the odd nesting behavior. Fixes #87 --- src/services/XmlFormatter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/XmlFormatter.ts b/src/services/XmlFormatter.ts index b6f9598..6f4e314 100644 --- a/src/services/XmlFormatter.ts +++ b/src/services/XmlFormatter.ts @@ -83,12 +83,12 @@ export class XmlFormatter { } // - else if (parts[i].search(/\/>/) > -1 && (!this.splitNamespaces || parts[i].search(/xmlns\:/) == -1)) { + else if (parts[i].search(/\/>/) > -1 && (!this.splitNamespaces || parts[i].search(/xmlns(:|=)/) == -1)) { output = (!inComment) ? output += this._getIndent(level, parts[i]) : output += parts[i]; } // xmlns /> - else if (parts[i].search(/\/>/) > -1 && parts[i].search(/xmlns\:/) > -1 && this.splitNamespaces) { + else if (parts[i].search(/\/>/) > -1 && parts[i].search(/xmlns(:|=)/) > -1 && this.splitNamespaces) { output = (!inComment) ? output += this._getIndent(level--, parts[i]) : output += parts[i]; }