Skip to content
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

todomvc is not working on old Android device #431

Closed
ceremcem opened this issue Mar 31, 2017 · 10 comments · Fixed by #443
Closed

todomvc is not working on old Android device #431

ceremcem opened this issue Mar 31, 2017 · 10 comments · Fixed by #443
Labels

Comments

@ceremcem
Copy link

ceremcem commented Mar 31, 2017

http://svelte-todomvc.surge.sh/#/ is not working on my Android 4.0.3 and is shown as follows:

image

I don't know which information should I deliver to help debugging.

@Rich-Harris
Copy link
Member

Thanks. My hunch is that it's because Svelte generates code that uses Object.assign, maybe that's not supported on the version of Chrome running on that device (is it Chrome? Or the Android browser that preceded it?)

If there's any way to get an error log by remotely inspecting the browser over USB, that would be amazing, but if not then I'll try deploying a version with a polyfill later to see if that works.

@Ryuno-Ki
Copy link

According to Google, Object.assign is supported as of v45.

@ceremcem Could you check out ES Checker with that device + browser?

Support tables indicate a good support

@ceremcem
Copy link
Author

ceremcem commented Mar 31, 2017

It's Chrome, yes. I followed that instructions (thank you, I learned something else 👍 ), and your guess is correct. Here is the console output:

Uncaught TypeError: Object.assign is not a function

@Ryuno-Ki
Copy link

MDN has a polyfill.

@Rich-Harris
Copy link
Member

Rich-Harris commented Mar 31, 2017

So, there are two possible routes here:

  • Ask developers to polyfill their apps with Object.assign support
  • Add an assign helper

Since we don't need to cover all the edge cases that a true polyfill would, ours could be as simple as

export function assign ( target ) {
  for ( var i = 1; i < arguments.length; i += 1 ) {
    var source = arguments[i];
    for ( var k in source ) target[k] = source[k];
  }

  return target;
}

@ceremcem
Copy link
Author

So I understand that the issue is not related directly with Svelte itself? If so, this issue can be closed.

@Ryuno-Ki
Copy link

Oh, btw. I haven't heard of that ES Checker before, too.
But I know of similar tools for support checking.

Action derived from this issue is offering an assign helper or ask developers include a polyfill.

@Rich-Harris I wonder whether it is worth the effort to implement a Babel-like API to polyfill ESnext features according to presets/target browser versions...

@Rich-Harris
Copy link
Member

It's related to Svelte insofar as it affects the environments we can plausibly claim to support. Some people still have to get their apps working on IE9, legacy Android etc... if it's no bother for us to bake in support (or offer it via e.g. a legacy: true option) then we should at least discuss it. Off the top of my head, the only vaguely exotic things we need (unless you want to talk about polyfilling addEventListener etc, which I don't!) are Object.assign and Object.create(null). We could use hasOwnProperty instead of Object.create(null).

@Rich-Harris I wonder whether it is worth the effort to implement a Babel-like API to polyfill ESnext features according to presets/target browser versions...

Nah, not at this stage. Maybe if we decided to e.g. implement something using WeakMap (such as associating data and event handlers with nodes, rather than adding private _svelte properties) that would make sense, but that's in the distant future if at all.

@Ryuno-Ki
Copy link

Thanks. Writing parsers sounds like too much what Computer Scientists would do, so I haven't tried to understand how it works, yet (knowledge gap is too large).

Good to know, that most is ES5 code!

Rich-Harris added a commit that referenced this issue Apr 4, 2017
use assign helper, to avoid compatibility headaches
@Rich-Harris
Copy link
Member

I've just deployed a new version of TodoMVC — hopefully it works on old Android now: https://svelte-todomvc.surge.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants