3 ms·
My approach is (1) use CSS for as much as I can, (2) fill in the important compatibility gaps with JS (polyfill style) then (3) use JS to layer on any extra beh
by mattdw 12y ago
My approach is (1) use CSS for as much as I can, (2) fill in the important compatibility gaps with JS (polyfill style) then (3) use JS to layer on any extra behaviours. That approach seems to play the best with the widest variety of configurations, and everybody gets something at least 80% usable. (With exceptions; I'm not talking about pure JS 'apps'.)
My thinking with the above is that CSS code paths in the browser are (with a very few exceptions) going to be a lot faster than trying to do the same in JS, and you don't have to wire up e.g. onresize handlers yourself.
Some things I'll just ignore; if your browser doesn't support border-radius or text-shadow, you get square corners and flat text; if your browser doesn't support box-sizing, the layout will be wrong but at least everything will still be visible.