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
This commit is contained in:
parent
3f7ee2773b
commit
157bafa5b9
1 changed files with 2 additions and 2 deletions
|
@ -83,12 +83,12 @@ export class XmlFormatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// <elm />
|
// <elm />
|
||||||
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];
|
output = (!inComment) ? output += this._getIndent(level, parts[i]) : output += parts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// xmlns />
|
// 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];
|
output = (!inComment) ? output += this._getIndent(level--, parts[i]) : output += parts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue