cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.08k stars 399 forks source link

Documentation does not reflect actual implementation #1540

Open u900x600 opened 3 years ago

u900x600 commented 3 years ago

Expected behavior: Refering to the docs, one should be able to use it like so:

const rule = sheet.addRule({ … })
document.body.innerHTML = `<button class="${rule.className}">Button</button>`

but rule.className is undefined.

I have had a look into the source and could not find any trace for the mentioned »className« property. Right now I am using rule.id. That is working somehow, but not included in the typings - so: (rule as any).id is what I am using. But that feels hackish and not to be the intended way.

So how is it intended to be used?

Versions: