Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML type attribute breaks JavaScript beautification? #1606

Closed
jonkri opened this issue Dec 24, 2018 · 1 comment
Closed

HTML type attribute breaks JavaScript beautification? #1606

jonkri opened this issue Dec 24, 2018 · 1 comment

Comments

@jonkri
Copy link

jonkri commented Dec 24, 2018

Description

The HTML type attribute seems to break JavaScript beautification.

Input

The code looked like this before beautification (note the double spaces surrounding the + operator):

<script>
    console.log(1  +  1)
</script>

<input type="submit">

Expected Output

The code should have looked like this after beautification (only single spaces surrounding the + operator):

<script>
    console.log(1 + 1)
</script>

<input type="submit">

Actual Output

The code actually looked like this after beautification (identical to the input):

<script>
    console.log(1  +  1)
</script>

<input type="submit">

Steps to Reproduce

$ printf "<script>\n\
>     console.log(1  +  1)\n\
> </script>\n\
> \n\
> <input type=\"submit\">\n" | html-beautify
<script>
    console.log(1  +  1)
</script>

<input type="submit">

Changing the type attribute produces the desired result:

$ printf "<script>\n\
    console.log(1  +  1)\n\
</script>\n\
\n\
<input type2=\"submit\">\n" | html-beautify
<script>
    console.log(1 + 1)
</script>

<input type2="submit">

Environment

OS: Arch Linux
js-beautify version: 1.8.9

Settings

{}
@bitwiseman
Copy link
Member

bitwiseman commented Dec 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants