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

Website "autodetect" setting doesn't distinguish css vs javascript #1565

Closed
Hirse opened this issue Oct 4, 2018 · 4 comments
Closed

Website "autodetect" setting doesn't distinguish css vs javascript #1565

Hirse opened this issue Oct 4, 2018 · 4 comments

Comments

@Hirse
Copy link
Contributor

Hirse commented Oct 4, 2018

Description

When formatting CSS with a url() attribute value, a space is inserted after the protocol of an unquoted URL value.

Reported as brackets-beautify/brackets-beautify#270.

Input

The code looked like this before beautification:

class{ background: url(http://someurl/img.png) }

Expected Output

The code should have looked like this after beautification:

.class {
  background: url(http://someurl/img.png) }

Actual Output

The code actually looked like this after beautification:

.class {
  background: url(http: //someurl/img.png) }
                       ^
               space inserted here

Steps to Reproduce

Reproducable on https://beautifier.io/ with default settings.

@bitwiseman
Copy link
Member

@Hirse
Are you sure? On https://beautifier.io/ w v1.8.6 in CSS mode, I get this output:

.class {
  background: url(http://someurl/img.png)
}

@Hirse
Copy link
Contributor Author

Hirse commented Oct 5, 2018

Thanks for checking.

I was testing it in Auto Detect mode, in which case it produces the above issue.
It looks like it is assuming the code to be JavaScript, because setting that mode explicitly shows the broken formatting.

@Hirse
Copy link
Contributor Author

Hirse commented Oct 5, 2018

After updating my extension to js-beautify 1.8.6, this issue is fixed for CSS input (guess the /-bug was at fault).
Sorry for not testing this earlier, I thought being able to reproduce on the website could save me that step.

This only leaves the "broken" auto-detection on the website.
Feel free to close or rename this issue.

@bitwiseman bitwiseman changed the title Breaking unquoted URLs in CSS url(...) Website "autodetect" setting doesn't distinguish css vs javascript Oct 12, 2018
@bitwiseman
Copy link
Member

@Hirse I'm removing the autodetect from the website.

@bitwiseman bitwiseman added this to the v1.8.x milestone Jan 13, 2019
@bitwiseman bitwiseman modified the milestones: v1.9.x, v1.9.0 Feb 27, 2019
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