Js-beautify: Wrong HTML beautification starting with v1.6.5

Created on 19 Jan 2017  ·  3Comments  ·  Source: beautify-web/js-beautify

Description

Up to and including v1.6.4, beautification worked fine for my HTML files. Starting with v1.6.5 (including v.1.6.8, currently latest), every file is beautified incorrectly.

This gist shows the differences in one file clearly (same as below but with a git diff).

I can submit more files for analysis if needed.

Thanks!

Input

The code looked like this before beautification:

<section class="miami">
    <div class="miami_content">
        <form novalidate>
            <ul>
                <li class="miami_container">
                    <div class="miami_search_content">
                        <icon class="miami_search_icon"
                            name="magnifier"></icon>
                    </div>
                    <div class="miami_input_content">
                        <input-extended input-type="search"
                            class="miami_input_text"
                            ng-focus="search.showCancel = true"
                            ng-blur="!search.searchText && (search.showCancel = false)"
                            translate="{ 'placeholder': 'directives.search.search' }"
                            ng-model="search.searchText"
                            ng-model-options="{ debounce: 300 }"
                            clear-icon="{ method: search.clearSearch }"
                            assign-controller-to="{ controller: 'ngModel', assignTo: 'search.ngModelController' }"></input-extended>
                    </div>
                    <div class="miami_right_content">
                        <div class="miami_right_content_cancel"
                            ng-show="search.showCancel">
                            <span class="miami_right_content_item"
                                select-fade="search.cancelSearch()"
                                translate="directives.search.cancel"></span>
                        </div>
                        <div class="miami_right_content_icons"
                            ng-show="!search.showCancel"
                            ng-transclude></div>
                    </div>
                </li>
            </ul>
        </form>
    </div>
</section>

Expected Output

The same (input is already beautified).

Actual Output

The code actually looked like this after beautification:

<section class="miami">
    <div class="miami_content">
        <form novalidate>
            <ul>
                <li class="miami_container">
                    <div class="miami_search_content">
                        <icon class="miami_search_icon"
                            name="magnifier"></icon>
                    </div>
                    <div class="miami_input_content">
                        <input-extended input-type="search"
                            class="miami_input_text"
                            ng-focus="search.showCancel = true"
                            ng-blur="!search.searchText && (search.showCancel = false)"
                            translate="{ 'placeholder': 'directives.search.search' }"
                            ng-model="search.searchText"
                            ng-model-options="{ debounce: 300 }"
                            clear-icon="{ method: search.clearSearch }"
                            assign-controller-to="{ controller: 'ngModel', assignTo: 'search.ngModelController' }"></input-extended>
                    </div>
                    <div class="miami_right_content">
                        <div class="miami_right_content_cancel"
                            ng-show="search.showCancel">
                            <span class="miami_right_content_item"
                                select-fade="search.cancelSearch()"
                                translate="directives.search.cancel"></span>
                    </div>
                    <div class="miami_right_content_icons"
                        ng-show="!search.showCancel"
                        ng-transclude></div>
    </div>
    </li>
    </ul>
    </form>
    </div>
</section>

Steps to Reproduce

Environment

OS: macOS Sierra 10.12.2

Settings

Example:

preserve_newlines: true,
max_preserve_newlines: 1,
end_with_newline: true,
wrap_line_length: 0,
wrap_attributes: "force",
eol: "\n"
html bug

Most helpful comment

There have been a bunch of reports of this. Thanks I'll take a look.

All 3 comments

There have been a bunch of reports of this. Thanks I'll take a look.

Is fixed in #1131

Works like a charm in v1.6.9, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JVimes picture JVimes  ·  6Comments

buinauskas picture buinauskas  ·  5Comments

geakstr picture geakstr  ·  3Comments

mubaidr picture mubaidr  ·  6Comments

keeganstreet picture keeganstreet  ·  6Comments