|
|
@@ -21,18 +21,11 @@ export function genStyle (style: Object): string {
|
|
|
}
|
|
|
|
|
|
function normalizeValue(key: string, value: any): string {
|
|
|
- if (typeof value === 'string') {
|
|
|
+ if (
|
|
|
+ typeof value === 'string' ||
|
|
|
+ (typeof value === 'number' && noUnitNumericStyleProps[key])
|
|
|
+ ) {
|
|
|
return `${key}:${value};`
|
|
|
- } else if (typeof value === 'number') {
|
|
|
- // Handle numeric values.
|
|
|
- // Turns out all evergreen browsers plus IE11 already support setting plain
|
|
|
- // numbers on the style object and will automatically convert it to px if
|
|
|
- // applicable, so we should support that on the server too.
|
|
|
- if (noUnitNumericStyleProps[key]) {
|
|
|
- return `${key}:${value};`
|
|
|
- } else {
|
|
|
- return `${key}:${value}px;`
|
|
|
- }
|
|
|
} else {
|
|
|
// invalid values
|
|
|
return ``
|