|
|
|
|
|
by jsdalton
5507 days ago
|
|
Yeah, basically there is one shortcoming of the "Modernizr approach" to front-end development -- namely that you will end up treating clients who have JS disabled as though their browsers do not support a number of CSS features. So with the old browser sniffing way, your Firefox 4 user will still get the shiny buttons and rounded corners even if he has no JS. With Modernizr, he'll (at best) get the watered down IE6 version with flat buttons and sharp corners, etc. At worst, if you're not doing progressive enhancement right and you've based critical functionality on one of the injected classes, you might cause some real problems for this user. I guess I just see this as a limitation of Modernizr, and not a reason to throw out the baby with the bath water. I still love it and use it in all of my projects. |
|
Something this article brings up and that you touch on is: coupling your use of CSS3 to JavaScript being enabled.
There is an incorrect way of using Modernizr where you always surround your use of a CSS3 feature with a `.feature .box` class, which is generally unnecessary and leads to the issue the author was concerned about.
Modernizr classes are best used in the `.no-feature` case, where you do something like use background images or another clever CSS use to mimic the feature or handle the fallback situation. In general I like to code my styles optimistically though.
I left a comment on the site saying it's hard to address this subtlety of the "right way" to use Modernizr classes. We're launching a new site very soon and hope to better document this approach so people don't go down this tricky road. :)