-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: make it possible to support IE11 #4115
Comments
Didn't want polyfills because their app is displayed in Ads. Don't want to mutate the env. |
Summary of work I've done so far on these issues: I've been working on the "ie11-compatibility" branch of canjs, as well as branching for individual modules when they need to be fixed. There's a separate test page (
The last two suites run in iframes, and I haven't figured out the best strategy for polyfilling them yet. The modules that have been branched but not merged are:
Most of these are pretty minimal changes, but I wanted someone who knows the code better than me to take a look. I've run the tests in Firefox after making these changes, and everything passed, which is reassuring. Once I had everything running, there were 241 failed assertions out of 5067 in IE11. I've managed to pare that down to 196, and it's worth talking about the changes that I made, so that we can avoid those when writing new code as long as IE support is relevant:
There's also a hilariously terrible bug that I think I've discovered, where IE will not correctly respect A lot of the remaining issues look like they probably have shared causes based on the stack traces I'm seeing back in the tests, but I'm not experienced enough with some of the underlying Can modules to tell what is triggering them yet. |
@thomaswilburn Great work! If tests are passing I say just go ahead and start making pull requests in each repo. |
Will do! |
Packages need to be fixed:Infrastructure
|
Packages need to be fixed:Core:
|
Packages need to be fixed:Ecosystem:
|
TLDR: we will
Problem
CanJS 4.0 uses several browser features that are not available or not fully functional in IE11. These include:
Map
WeakMap
Set
WeakSet
Object.assign
This means that in order for CanJS 4.0 to work, you need to load polyfills like core-js or babel-polyfill.
However, doing this will modify these globals for anyone that is using them, not just CanJS. This might cause problems for other libraries that do not expect the polyfill behavior.
Solution
To fix this we should
1. Remove use of non-supported functionality that we don't need
Things like
new Set([ 1, 2, 3 ])
are not suppported by IE11 and can be easily replaced by other things.Similarly, use of
Object.assign(...)
can be replaced bycan-assign
andcan-reflect.assignMap
.2. Document what polyfills are required in order for CanJS 4.0 to work in IE11
For people comfortable polyfilling these features in their browser, we should document what polyfills are necessary and give examples of polyfills that provide the features CanJS needs.
3. Make it possible to use CanJS 4.0 in IE 11 without changing the browser's globals.
To do this, we will
3a. Create a module for each unsupported feature
3b. Replace uses of the unsupported features with the module
3c. Provide a module with the necessary polyfills
3d. Document how to replace
can-env
withcan-polyfill
using different module loadersFor example, with steal this would show:
3e. Run the canjs test suite in IE11
To test that these polyfills work, we would need to add IE11 back to our Sauce Labs setup and modify our test process to run with the polyfills mapped in IE11.
Related issues
IE11
due to unsupported JS functionality.The text was updated successfully, but these errors were encountered: