Skip to content

Commit

Permalink
fix: camelCase css from style elements
Browse files Browse the repository at this point in the history
  • Loading branch information
msand committed Oct 20, 2019
1 parent 45e8e8d commit 9ee5a28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/css.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react';
import { parse, SvgAst } from './xml';
import { camelCase, parse, SvgAst } from './xml';
import baseCssAdapter from 'css-select-base-adapter';
import csstree, { List } from 'css-tree';
import cssSelect from 'css-select';
Expand Down Expand Up @@ -563,7 +563,7 @@ CSSStyleDeclaration.prototype.setProperty = function(
};
let key = propertyName.trim();
properties.set(key, property);
this.parentNode.props.style[key] = trimmedValue;
this.parentNode.props.style[camelCase(key)] = trimmedValue;

return property;
};
Expand Down
2 changes: 1 addition & 1 deletion src/xml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class SvgFromUri extends Component<UriProps, UriState> {

const upperCase = (_match: string, letter: string) => letter.toUpperCase();

const camelCase = (phrase: string) =>
export const camelCase = (phrase: string) =>
phrase.replace(/[:\-]([a-z])/g, upperCase);

type Styles = { [property: string]: string };
Expand Down

0 comments on commit 9ee5a28

Please sign in to comment.