1818var parseSelector = require ( 'hast-util-parse-selector' ) ;
1919var camelcase = require ( 'camelcase' ) ;
2020var propertyInformation = require ( 'property-information' ) ;
21- var cssDeclarations = require ( 'css-declarations' ) . parse ;
2221var spaces = require ( 'space-separated-tokens' ) . parse ;
2322var commas = require ( 'comma-separated-tokens' ) . parse ;
2423
@@ -89,29 +88,20 @@ function addProperty(properties, name, value) {
8988 return ;
9089 }
9190
92- /*
93- * Handle values.
94- */
95-
91+ /* Handle values. */
9692 if ( name === 'style' ) {
97- /*
98- * Accept both `string` and `object`.
99- */
100-
101- if ( typeof value === 'string' ) {
102- result = cssDeclarations ( result ) ;
103- } else {
104- result = { } ;
93+ /* Accept `object`. */
94+ if ( typeof value !== 'string' ) {
95+ result = [ ] ;
10596
10697 for ( key in value ) {
107- result [ key ] = value [ key ] ;
98+ result . push ( [ key , value [ key ] ] . join ( ': ' ) ) ;
10899 }
100+
101+ result = result . join ( '; ' ) ;
109102 }
110103 } else if ( info . spaceSeparated ) {
111- /*
112- * Accept both `string` and `Array`.
113- */
114-
104+ /* Accept both `string` and `Array`. */
115105 result = typeof value === 'string' ? spaces ( result ) : result ;
116106
117107 /*
@@ -123,10 +113,7 @@ function addProperty(properties, name, value) {
123113 result = properties . className . concat ( result ) ;
124114 }
125115 } else if ( info . commaSeparated ) {
126- /*
127- * Accept both `string` and `Array`.
128- */
129-
116+ /* Accept both `string` and `Array`. */
130117 result = typeof value === 'string' ? commas ( result ) : result ;
131118 }
132119
0 commit comments