Create the sheet on construction of jss instance
fresheneesz opened this issue · comments
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.