File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/svelte/src/internal/client/dom/elements Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,18 @@ function dispatch_event(element, type) {
2525}
2626
2727/**
28+ * Converts a property to the camel-case format expected by Element.animate(), KeyframeEffect(), and KeyframeEffect.setKeyframes().
2829 * @param {string } style
2930 * @returns {string }
3031 */
31- function css_style_from_camel_case ( style ) {
32+ function css_property_to_camelcase ( style ) {
33+ // in compliance with spec
34+ if ( style === 'float' ) return 'cssFloat' ;
35+ if ( style === 'offset' ) return 'cssOffset' ;
36+
37+ // do not rename custom @properties
38+ if ( style . startsWith ( '--' ) ) return style ;
39+
3240 const parts = style . split ( '-' ) ;
3341 if ( parts . length === 1 ) return parts [ 0 ] ;
3442 return (
@@ -52,7 +60,7 @@ function css_to_keyframe(css) {
5260 const [ property , value ] = part . split ( ':' ) ;
5361 if ( ! property || value === undefined ) break ;
5462
55- const formatted_property = css_style_from_camel_case ( property . trim ( ) ) ;
63+ const formatted_property = css_property_to_camelcase ( property . trim ( ) ) ;
5664 keyframe [ formatted_property ] = value . trim ( ) ;
5765 }
5866 return keyframe ;
You can’t perform that action at this time.
0 commit comments