getLonghands('padding')
// => ["padding-top", "padding-right", "padding-bottom", "padding-left"]
Last active
August 29, 2020 20:48
-
-
Save sergeysova/b003fae5670a476c28ff2ff972ec7fbc to your computer and use it in GitHub Desktop.
Unwrap CSS shorthands
This file contains 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
function getLonghands(property) { | |
const element = document.createElement('div'); | |
const style = element.style; | |
style[property] = "inherit"; | |
const ret = [...style]; | |
style.cssText = ""; | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment