Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is it not recommended to use a polyfill for CSS3 selector support?

I need to ensure IE7 and IE8 support.

I'm using a few CSS3 selectors like :last-child. I dropped in Selectivizr, and it appears to fix many problems in those browsers, leaving me just a handful to clean up with some fallback code.

But HTML5 Please recommends using only fallbacks, not polyfills, to address CSS3 selector support:

We strongly recommend you do not try to polyfill this, but if you do need one, you can use Selectivizr.

It would be good to know why they "strongly recommend" against polyfills here... Anyone have any ideas?

like image 378
callum Avatar asked Jul 23 '12 12:07

callum


Video Answer


1 Answers

Using a fallback I think means you should be adding classes to the elements that you cannot select with modern selectors like adding .first to be used for :first-child, or .checked for :checked, and so on.

I can't think of any reason HTML5 Please recommends not to use polyfills so strongly, except for performance and independence from JavaScript. It's best to depend solely on CSS to style and draw.

But in my humble opinion, Selectivizr is a piece of magic that will teach IE6-8 to behave and ensure your HTML is clean from unnecessary classes and will shorten your development time.

like image 194
Ahmad Alfy Avatar answered Sep 28 '22 09:09

Ahmad Alfy