AM – Attribute Modules for CSS
glenmaddern.com
AM – Attribute Modules for CSS
1–10 of 58 posts
Re: AM – Attribute Modules for CSS
#2Re: AM – Attribute Modules for CSS
#3This looks a promising approach to the chaos that is writing reusable and maintainable CSS. I wonder about performance though, especially on mobile. Will this perform as good as regular class-written CSS, even if you have >2000 loc CSS files?
Re: AM – Attribute Modules for CSS
#4On a side note, the name sounds funny in Turkish but I guess that's a minor concern.
Re: AM – Attribute Modules for CSS
#5This looks a promising approach to the chaos that is writing reusable and maintainable CSS. I wonder about performance though, especially on mobile. Will this perform as good as regular class-written CSS, even if you have >2000 loc CSS files?
Re: AM – Attribute Modules for CSS
#6Re: AM – Attribute Modules for CSS
#7Re: AM – Attribute Modules for CSS
#8Re: AM – Attribute Modules for CSS
#9This looks a promising approach to the chaos that is writing reusable and maintainable CSS. I wonder about performance though, especially on mobile. Will this perform as good as regular class-written CSS, even if you have >2000 loc CSS files?
Technically nothing prevents browsers from inferring specific behaviors from the way a custom attribute is used, and dynamically generate shortcuts (e.g. key objects by attribute name, value or computed value), but I doubt any existing browser does so, so you get a "universal selector" behavior: every element of the DOM has to be scanned and processed to apply the rule.
And it's not exactly an easy problem, it's essentially equivalent to auto-generating (and tearing down, since elements, attributes and CSS rules can be added and removed on the fly) database indexes except you've got way less usage to rely on (for cost/benefit estimations), and way less usage time to recoup your investment.
Re: AM – Attribute Modules for CSS
#10You may prefer the regular "data-" prefix ( https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Usin... ) to "am-", especially if you want to be compatible with React.
We've got an open discussion on this point, if you want to contribute there: https://github.com/amcss/attribute-module-specification/issu...