Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

react.js support #29

Closed
sktt opened this issue Jun 21, 2016 · 6 comments
Closed

react.js support #29

sktt opened this issue Jun 21, 2016 · 6 comments

Comments

@sktt
Copy link

sktt commented Jun 21, 2016

Hello I'd like to use this for a React.js application where i have object-fit and object-position for a spritesheet.

I have my react component programmatically set the style. React will however automagically strip fontFamily:.. from the element. Would it be possible to come around this?

@fregante
Copy link
Owner

fregante commented Jun 21, 2016

What's stripping fontFamily exactly and why?

@sktt
Copy link
Author

sktt commented Jun 21, 2016

I thought it was react, it is actually my browser (chrome) that removes it.

@sktt sktt closed this as completed Jun 21, 2016
@fregante
Copy link
Owner

fregante commented Jun 21, 2016

If it's being removed it's probably invalid, make sure it has the quotes:

.img {
   object-fit: contain;
   font-family: 'object-fit: contain'; /*correct*/
}

This is invalid CSS:

.img {
   object-fit: contain;
   font-family: object-fit: contain; /*wrong*/
}

In JS:

img.style.fontFamily = "'object-fit: contain'"; /* correct */
img.style.fontFamily = "object-fit: contain";   /* wrong */

@sktt
Copy link
Author

sktt commented Jun 22, 2016

You're right! I was missing the quotes! Thanks!

@golubvladimir
Copy link

It's works with react-jss. Thank you.

@Carrie999
Copy link

is not working

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants