amcss / attribute-module-specification

The Attribute-Module CSS (AMCSS) Specification
MIT License
394 stars 8 forks source link

element.classList vs element.dataset #18

Open felquis opened 9 years ago

felquis commented 9 years ago

I was thinking that there's no way to treat dataset values like classList DOMTokenList

In the CSS we can do element.classList.remove('class-name'), also toggle, add, contains. Using dataset, we don't have this super power, we'll have to use something just like this

I don't know if it's possible to use DOMTokenList with another string because I can't do a = new DOMTokenList(str).... :/

felquis commented 9 years ago

Ops, sorry for duplicated issue https://github.com/amcss/attribute-module-specification/issues/13

adiospace commented 9 years ago

For things like these (state modifiers) I just use classes, scoped to the module itself.

[am-Module] {}  // component
[am-Module].on {} // state modifier
[am-Module~="modifier"] {} // modifier
[am-Module-part] {}
[am-Module-anotherPart] {}