Merged
Conversation
kof
reviewed
Oct 16, 2018
| width: 'px', | ||
| 'word-spacing': 'px', | ||
| // Animation properties | ||
| 'animation-delay': getDefaultUnit(window.CSS.ms, 'ms'), |
Member
There was a problem hiding this comment.
I would prefer to not access window.CSS all over the place, because it might be not implemented and not polyfilled
Member
There was a problem hiding this comment.
you can rewrite getDefautUnit to something like this:
const hasCSSTOMSupport = window.CSS && window.CSS.number
const getDefaultUnit = (unit) => {
const fn = unit === '%' ? 'percent' : unit
return hasCSSTOMSupport ? window.CSS[fn]() : unit
}
Member
There was a problem hiding this comment.
and then use it getDefaultUnit('ms')
added 2 commits
October 16, 2018 20:50
* master: Support plugins processing for observables by default (#892) Typed CSSOM values support (#887) Dynamic values full syntax (#878) [jss-plugin-cache] Use WeakMap for cache plugin (#890) # Conflicts: # packages/jss-plugin-syntax-rule-value-function/.size-snapshot.json # packages/jss-preset-default/.size-snapshot.json # packages/jss/.size-snapshot.json # packages/react-jss/.size-snapshot.json
- Improve default unit selection
kof
reviewed
Oct 16, 2018
Member
There was a problem hiding this comment.
in node window will not exist, accessing it will throw error
Member
There was a problem hiding this comment.
instead either we have to use typeof window or just use global, because it will always exist through the polyfill in both node and browser
kof
reviewed
Oct 16, 2018
|
|
||
| const px = hasCSSTOMSupport ? window.CSS.px : 'px' | ||
| const ms = hasCSSTOMSupport ? window.CSS.ms : 'ms' | ||
| const percent = hasCSSTOMSupport ? window.CSS.percent : '%' |
HenriBeck
pushed a commit
that referenced
this pull request
Oct 22, 2018
* origin/add-ts-typings: Scoped keyframes (#888) Update readme.md (#897) Use CSSTOM in default unit plugin (#893) Added .nvmrc (#896) [WIP] DONT MERGE Fix ci (#895) Update ci (#894) Support plugins processing for observables by default (#892) Typed CSSOM values support (#887) Dynamic values full syntax (#878) [jss-plugin-cache] Use WeakMap for cache plugin (#890)
bhupinderbola
pushed a commit
to bhupinderbola/jss
that referenced
this pull request
Sep 17, 2019
* Added support for using CSSTOM in default unit plugin * Support grid properties in default unit * - Move hasCSSTOMSupport into core - Improve default unit selection * - Move hasCSSTOMSupport into core - Improve default unit selection * Update size-snapshots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#885