Comments (9)
Thanks for digging into this further @kmctown. This may be an issue with styled-components
not handling the object version correctly. This is what I get as output from our version:
{"&::after":{"clear":"both","content":"","display":"table"}}
My guess is styled-components
is not handling the empty string correctly. @mxstbr @geelen thoughts?
from polished.
I don't think this is a bug in styled-components
(let's double check what other CSS-in-JS libs do here) but we should do this instead:
{
"&::after": {
"clear": "both",
// Notice: Quotes inside quotes
"content": "''",
"display": "table"
}
}
I think that'd fix it?
from polished.
Closed by #157
from polished.
Looks good to me. @bhough @mxstbr any objections?
from polished.
Our implementation is the accepted approach for all browsers (IE8+) and uses the minimum amount of properties and selectors to reduce potential impact on pseudo elements. I'm not sure I like the idea of of expanding that to accommodate one specific (albeit popular) library.
from polished.
Thanks for the feedback. Closing this...something else weird is going on. I created the following function in a util lib:
export function clearFix() {
return `
&:after {
display: table;
content: "";
clear: both;
}
`;
}
And dropped it into styled-components
the same way:
const El = styled.div`
...
${clearFix()}
...
`
And it works, where the clearFix
from polished
doesn't. Does that make any sense?
from polished.
Looks like the difference between the one we use and your example above is we use &::after
(double colon) where you are using a single colon. https://developer.mozilla.org/en-US/docs/Web/CSS/::after
Could be some browsers aren't liking the ::
colon version and we need to move to using the CSS2 version.
from polished.
Right, I tried it both ways. The ::
colon version works as well -- as long as I'm returning the string.
export function clearFix() {
return `
&::after {
display: table;
content: "";
clear: both;
}
`;
}
⬆️ That works as well. Swapping out to the polished
version breaks it. For whatever reason, chrome is not liking content: ''
when using the version from polished
.
Here is a screenshot from Chrome devtools when using the function that returns the string:
And here is what it looks like when using the polished version:
from polished.
sweet 👍
from polished.
Related Issues (20)
- [Feature request] Rgba to rgb conversion fuction HOT 1
- Add unit selection to between mixin HOT 1
- Lighten red color dont work HOT 1
- `getValueAndUnit` return type is misleading HOT 1
- Test suite fails to run with cssVar() HOT 3
- Unable to play in browser console on Polished's site HOT 3
- Is the faction that lighten fails to work in testing-library a polished problem or an rtl/jest problem? HOT 4
- `parseToHsl` Doesn't seem to parse valid CSS Colors 4 space-separated values HOT 9
- rgbaRegex fails 3 digit decimals HOT 3
- Mix doesn't output the same value as vanilla SCSS HOT 1
- [Feature request] Add function to convert between rgb and hex notation HOT 1
- Readable color returnIfDarkColor isn't working HOT 4
- [Possible improvements] I found some places I could improve performance and Bundle size HOT 1
- Typescript Error
- Polished "playground" on homepage doesn't work
- parseToRgb / parseToHsl float precision expected by the regex
- Website contrast prevents readibility
- WARN node_modules/polished/lib/color/rgb.js (6:59) A comment 15:14:25 "/*#__PURE__*/" in "node_modules/polished/lib/color/rgb.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues. HOT 3
- Breaking semver change introduced in v4.3.0 HOT 6
- Use `exports` field with `.mjs` extension instead of `"module": "dist/polished.esm.js"` in `package.json`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polished.