Why isn't there a flexbox polyfill for older browsers like IE9?

Are there some problems that prevent people from creating it? Is it too complicated?

Maybe there is just no need for that?

Was it created it already and I just can't find it?

I imagine it to be a js based library and work this way:

  1. It checks if the browser supports flexbox natively;

  2. If it doesn't, it parses CSS and checks if an element has flexbox related rules;

  3. If it does, it tries to emulate these rules via javascript by calculating all positions and sizes of the children elements and position them using position: absolute;.

Basically, the same thing that Masonry and similar libraries do, but with flexbox rules. Would that be possible to do?

Edit: this question doesn't explain why it can't be done.

Answers


There is actually a library that does exactly what I wanted: https://github.com/10up/flexibility

It's in the very early phase of development, but hopefully it will be viable soon.


"emulate these rules via javascript" is the "most impossible" part.

  1. flex box is purely position:static thing, you cannot move it on position:absolute layer (there are too many things behind this);
  2. flex box calculations are made on so called rendering tree that is not available to JS;

In order JS to be used for static layout purposes browsers should have a mechanism to hook up users code to rendering tree formation and layout:

div { layout: myFlexManager url(my-layouts.js); }

But as soon as browsers will have such a facility the flexbox will be thrown away as this is the worst and ugliest CSS spec ever produced - community will come up with something better - simpler and more practical.


Need Your Help

render partial with slim-lang grunt-slim plugin throws "undefined method render"

ruby-on-rails ruby gruntjs slim-lang

I'm trying to work with slim-lang for my web project. I have the following setup:

Is GCM (Google Cloud Messaging) id a Unique id for android application?

google-cloud-messaging

I am using a mobile (Fly F45Q) and i got daily a new GCM id for my android application. this is not happen in other mobile Like (Samsung core/samsung at&t ) etc.i don't understand what is happe...