Incorrect format in css when selector attribute value is a URL
See original GitHub issuePrettier 2.0.1
# Options (if any):
--single-quote
Input:
a[href="http://example.com"] { display: none }
Output (v2.0.1):
a[href="http://example.com"]
{
display: none;
}
Output (v1.19.1):
a[href="http://example.com"] {
display: none;
}
Expected behavior:
The double quotes should have been changed to single quotes and the opening brace should have been left in the same line as the selector.
In v1.19.1 the bug with the quotes was present but the bug with the opening brace is new in v2.0.1.
Expected output:
a[href='http://example.com'] {
display: none;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Attribute selectors - CSS: Cascading Style Sheets | MDN
The CSS attribute selector matches elements based on the presence or value of a given attribute.
Read more >[attribute] | CSS-Tricks
Here we select the link with the exact href value "https://www.css-tricks.com", and change its color and font size. Notice that the link to...
Read more >How can CSS attribute selectors be used for web scraping?
A practical guide to using CSS selectors, including the attribute selector, for browser automation.
Read more >CSS Attribute Selector - W3Schools
CSS Attribute Selectors ... Style HTML Elements With Specific Attributes ... The [attribute="value"] selector is used to select elements with a specified ...
Read more >Escaping double quotes in CSS selector - Stack Overflow
The issue is not just in your selector string but also in your markup. The quotes in the url() value are interfering with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A minimal repro:
Prettier 2.0.1 Playground link
Input:
Output:
Right, I think both need fix.
FYI:
selector-unknown
one was there before #6981 , maybe for a long time, I just change.mactch
to.test
https://github.com/prettier/prettier/commit/acff41e7c98c087870e945f31a7358f502fcd4b8#diff-29bcb0b461c4ae51930e975e53edfdd9L202