Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create the sheet on construction of jss instance #36

Open
fresheneesz opened this issue Feb 23, 2015 · 0 comments
Open

Create the sheet on construction of jss instance #36

fresheneesz opened this issue Feb 23, 2015 · 0 comments

Comments

@fresheneesz
Copy link

Instead of lazily creating the defaultSheet on set of a rule, create it on construction of jss. I ran across very confusing behavior when I was trying to interact with two different stylesheets using jss. Example:

var jss1 = jss.forDocument(document)
var jss2 = jss.forDocument(document)

jss2.set('#A', {
    color: 'green'
})
jss1.set('#A', {
    color: 'red'
})

I expected element #A to be green after both rules were set, but in fact, the element changes to red. The reason is that the stylesheet is created on the first set instead of on forDocument. It would be much cleaner to create the sheet on construction.

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

No branches or pull requests

1 participant