porsager/bss

Prefixer bugs, and other weirdness

pygy opened this issue · 5 comments

pygy commented

In Firefox,

sheet = b({appearance: "none"})
sheet2 = b("appearance: none")
sheet + sheet2
p(sheet.getSheet())
p(sheet2.getSheet())

prints

.bajq6bd1.bajq6bd1{--moz-appearance:none;}.bajq6bd2.bajq6bd2{appearance:none;}
''

--moz-appearance should be -moz-appearance, as should appearance, I suppose.

Also, are you intentionally duplicating the classes? It has an impact on the specificity of the selector, but is probably harmless otherwise.

At last, AFAICT getSheet() is not documented, but it is supposed to behave like that?

Yeah, the current version doesn't run the object style through the same parsing as the rest which results in duplicated classes because it's not being prefixed. I've made the fix, but I'm holding it back for v2 since it's kind of a breaking change - #22

getSheet was just a hook I made for the tests initially, so it clears everything when run, which is quite silly when the name is getSheet :P

The plan is to expose a proper API and documentation for these things once I've gotten around to play with SSR.

Ah, misunderstood your question wrt. duplicating classes.

That is to get higher specificity for catering to the common case of needing to add styling which needs to override styling added with $nest.

Using $nest won't add duplicate classes.

here's a sample

If it didn't have the duplicated classes the nested styling would have the highest specificity.

pygy commented

It all makes sense then. The prefixer bugs remain though.

Ah sorry @pygy .. I didn't even notice the extra dash in --moz-appearance. Thank you ! 👍

pygy commented

Great, thanks!