@@ -13,11 +13,10 @@ import {stringify as commas} from 'comma-separated-tokens'
1313import { name as identifierName } from 'estree-util-is-identifier-name'
1414import { find , hastToReact , svg } from 'property-information'
1515import { stringify as spaces } from 'space-separated-tokens'
16- import styleToObject from 'style-to-object '
16+ import styleToJs from 'style-to-js '
1717
1818const own = { } . hasOwnProperty
1919const cap = / [ A - Z ] / g
20- const dashSomething = / - ( [ a - z ] ) / g
2120
2221const tableCellElement = new Set ( [ 'td' , 'th' ] )
2322
@@ -230,11 +229,8 @@ export function element(node, state) {
230229 * Properties.
231230 */
232231function parseStyle ( value , tagName ) {
233- /** @type {Record<string, string> } */
234- const result = { }
235-
236232 try {
237- styleToObject ( value , iterator )
233+ return styleToJs ( value , { reactCompat : true } )
238234 } catch ( error ) {
239235 const cause = /** @type {Error } */ ( error )
240236 const exception = new Error (
@@ -243,30 +239,6 @@ function parseStyle(value, tagName) {
243239 )
244240 throw exception
245241 }
246-
247- return result
248-
249- /**
250- * Add `name`, as a CSS property, to `result`.
251- *
252- * @param {string } name
253- * Key.
254- * @param {string } value
255- * Value.
256- * @returns {undefined }
257- * Nothing.
258- */
259- function iterator ( name , value ) {
260- let key = name
261-
262- if ( key . slice ( 0 , 2 ) !== '--' ) {
263- // See: <https://alanhogan.com/code/vendor-prefixed-css-property-names-in-javascript>
264- if ( key . slice ( 0 , 4 ) === '-ms-' ) key = 'ms-' + key . slice ( 4 )
265- key = key . replace ( dashSomething , toCamel )
266- }
267-
268- result [ key ] = value
269- }
270242}
271243
272244/**
@@ -303,20 +275,6 @@ function transformStyleToCssCasing(from) {
303275 return to
304276}
305277
306- /**
307- * Make `$1` capitalized.
308- *
309- * @param {string } _
310- * Whatever.
311- * @param {string } $1
312- * Single ASCII alphabetical.
313- * @returns {string }
314- * Capitalized `$1`.
315- */
316- function toCamel ( _ , $1 ) {
317- return $1 . toUpperCase ( )
318- }
319-
320278/**
321279 * Make `$0` dash cased.
322280 *
0 commit comments