buildo/react-placeholder

Array.apply not support ie8 in TextBlock even if I'm add the polyfill

Closed this issue · 10 comments

image
could you change it to Array.from?

ie8? seriously? not even Microsoft supports ie8 anymore 😝

Anyway, to answer to your two questions:

  1. I'm sorry, but I don't think we should change the code to support a 10years old browser that is no longer officially supported by anyone. If you really need to support IE8, I suggest you polyfill Array.apply directly on your project
  2. Array.from is muuuch more recent than Array.apply and is not even supported by IE11 => so I guess you're already using polyfills? In this case, adding the polyfill for Array.apply should not be a problem then :)

I'm already try to use es3ify-loader and babel-polyfill to polyfill Array.apply,but failed. fortunately the Array.from success

Ok, Array.apply is actually supported by IE8, but for some reason in IE8 it has a different API...

We could take advantage of ES6 by doing it as [...Array(5)] and let babel do their job

EDIT: babel uses Array.from so, no, I'm not gonna do it. I'll try another solution

published a fix in 1.0.10

I'm sorry to say that your another solution failed,because the range.map failed to traverse in ie8

In addition if we don't use babel ,the problem will not just Array.apply

if you don't want Array.from, you could replace range.map by for

That's weird, I tested it on IE8 and it looked to me that it correctly initialized an array without errors.
What error are you getting? Can you write it here?

There is no exception,just the range.map failed to loop in ie8, and I don't know why

@guxingke201 I'm sorry, but if that didn't work I'm out of options: I'm not going to write bad code to support IE8.

I'm very pleased that you appreciate react-placeholder and wish to use it in your app, but I can't refactor code from ES6 to ES3 to support a browser that is 9 yo and no longer supported neither by Microsoft nor by React. I hope you will understand.

PS: to be honest, react-placeholder never even supported IE < 11 as it deeply uses flexbox for its layout :)

PPS: you should still be able to pass a custom placeholder, compatible with IE8, as children. You can look at this example for more information.