revert for-of loops, that they work well with Windows Phone 10

RESOLVED WORKSFORME

Status

L20n
JS Library
RESOLVED WORKSFORME
2 years ago
a year ago

People

(Reporter: André Fiedler, Unassigned)

Tracking

Details

(Reporter)

Description

2 years ago
refering to /l20n.js-3.3.3/dist/compat/web/l20n.js

This translated line will not iterate on Windows Phone 10 devices (running inside "WebView"):

> for (var _iterator3 = metas, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {

This is why it fails:

> var metas = head.querySelectorAll('meta[name="availableLanguages"],' + 'meta[name="defaultLanguage"],' + 'meta[name="appVersion"]');
> 
> console.log(metas);
> 
> // {"0":{},"1":{}}
> 
> console.log(Array.isArray(metas));
> 
> // false

This works so far:

> for (var i = 0; i < metas.length; i++) {
>   console.log(metas[i].getAttribute('name'));
> }
> // defaultLanguage
> // availableLanguages

So the solution by now seems to require a re-write to "classic" for loops.
(Reporter)

Comment 1

2 years ago
The "translated" code line above comes from this file line #16:
https://github.com/l20n/l20n.js/blob/15884660ab2e3850fc7a45a61723e9c6b782c827/src/bindings/html/langs.js#16
Is Windows Phone 10 on IE11 or Edge?
(Reporter)

Comment 3

2 years ago
Let me explain a bit first ... ;)

Our firm currently is developing using the .NET framework version 4.5. That's because Windows Phone 10 is not yet released and 95% of our users is running Windows Phone 8.1. WP10 will be released in December (I think) for a limited batch of devices first. Let's see how fast it will catch up next year.
So by now we are stuck using the XAML "WebView" that comes with .NET 4.5 ... even if our app is running on Windows Phone 10 ... and that one states it is "IE Mobile 11" (what ever that means).
I think many other firms supporting WP will be also still using .NET 4.5. It takes some more time before we drop WP8.1 support (sadly). We dropped WP7 support just some months ago.

Is there any page that I can run in my Windows Phone "WebView" test app, that shows ES6 API support?

Just found this page, that does not mention IE Mobile 11:
https://kangax.github.io/compat-table/es6/
(Reporter)

Comment 4

2 years ago
Btw., the real Browser in WP10 states it is "Edge 12" (don't know if it has all the Edge 12 features - could not imagine it ;) ).
But the "WebView" depends on the .NET framework version the app was written in.

Comment 5

a year ago
We documented the browser compat story for our current code version on https://github.com/l20n/l20n.js/blob/master/docs/compat.md. I hope that works for you, not sure.
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.