vkiryukhin / vkBeautify

vkBeautify is a small, simple and powerfull javascript plugin to beautify XML, JSON, CSS and SQL text.
http://www.eslinstructor.net/vkbeautify/
Other
316 stars 97 forks source link

Trailing whitespace added to text of elements with namespaces #5

Open bbpennel opened 11 years ago

bbpennel commented 11 years ago

An issue I'm having is that when a tag contains a namespace it causes the closing tag of the element to drop to a new line and indent, which adds additional whitespace into the text.

vkbeautify.xml('<root><child xmlns="ns">Text</child></root>');

Produces:

<root>
    <child 
        xmlns="ns">Text
    </child>
</root>

This pull request prevents that newline and indent from being added to elements when they have namespaces.

<root>
    <child
        xmlns="ns">test</child>
</root>

Indentation should still be working correctly for elements nested in elements with namespaces.

vkbeautify.xml('<root><child xmlns="ns"><test></test></child></root>');

Produces:

<root>
    <child
        xmlns="ns">
        <test></test>
    </child>
</root>

And thanks for making this great tool!

SunboX commented 9 years ago

good job, thx a lot! :+1:

gentisaliu commented 9 years ago

Good job! :+1:

Stalinec commented 5 years ago

Is this fix supposed to be approved? There is the same issue in the latest version: 0.99.3