Edge cases
Closed this issue · 2 comments
vdanchenkov commented
I've tested some edge cases and here is what we have currently:
style({})
// returns
{ 'data-css-120drhm': '*' }
// inserts to stylesheet
'[data-css-120drhm] { null }'
select(' a', {})
// returns
{ 'data-css-p8xeo9': '*' }
// inserts
'[data-css-p8xeo9] a { null }'
merge()
// returns
{ 'data-css-120drhm': '[]' }
// inserts nothing to stylesheet
merge({})
// returns
{ 'data-css-11ra3p3': '[{:}]' }
// inserts nothing to stylesheet
media('()', {})
// returns
{ 'data-css-11qittp': '*mq({:})' }
// inserts to stylesheet
`
@media (){
[data-css-11qittp] { null }
}`
media('()')
// returns
{ 'data-css-1853dek': '*mq()' }
// inserts nothing to stylesheet
keyframes('bounce', {})
// returns
'bounce_nc5hzc'
// inserts to stylesheet
`
@-webkit-keyframes bounce_nc5hzc { }
@-moz-keyframes bounce_nc5hzc { }
@-o-keyframes bounce_nc5hzc { }
@keyframes bounce_nc5hzc { }
`
fontFace({})
// returns
undefined
// inserts nothing to stylesheet
fontFace({fontStyle: 'normal'})
// returns
undefined
// inserts to stylesheet
'@font-face { font-style:normal;}'
cssFor()
// returns
''
// inserts nothing to stylesheet
attribsFor()
// returns
''
// inserts nothing to stylesheet
I suggest:
- For style/select/merge/media invocations from above return empty object. Add nothing to stylesheet.
- Keyframes - keep as is
- fontFace - current behaviour looks bad, but I'm not sure how to fix it.
- cssFor and attribsFor are fine
threepointone commented
Thanks for diving into this!
vdanchenkov commented
Working on it as it's closely related to #41