aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.41k stars 3.91k forks source link

State of polyfills and browser support #5447

Open mrxz opened 4 months ago

mrxz commented 4 months ago

Description: There are several polyfills present in A-Frame, many of which are already quite dated. Several of them can probably be removed, but it mostly depends on the relevancy of the (old) browsers/devices that are still intended to be supported. AFAIK there is no set browserlist, but that might be a good idea going forwards.

Here's an overview of the polyfills: Polyfill API(s) Caniuse % Notes
@ungap/custom-elements Custom Elements 78.83% + 18.5% = 97.33% only for IE (Safari doesn't support customized built-in elements, but A-Frame does not require this)
custom-event-polyfill CustomEvent 98.05% + 0.49% = 98.54% only for IE 9+
object-assign Object.assign 96.61% ponyfill, only for IE
present Performance.now 97.22% :warning: Also polyfilled by rStats.js
promise-polyfill Promise 97.89% only for IE
webvr-polyfill WebVR 2.92% + 2.49% = 5.41% contrary to what caniuse reports, FF has it disabled by default and requires specific flag to enable

Three.js has already dropped support for IE 11, so simply following suit, virtually all above mentioned polyfills can be removed as well. If a user does want to go through the pain of targetting IE 11, they can always load the needed polyfills themselves.

As for WebVR (polyfill), it would be nice to be able to get rid of it. There's quite a bit of duplicate code logic/paths due to supporting both WebVR and WebXR. I wouldn't be surprised if WebVR support is (subtly) broken in places.

Thoughts?

danineuss commented 2 weeks ago

I would like to bump this ticket (as I did its PR). I believe I am currently experiencing issues where my Firefox (beta) for Android mobile is breaking because of the PolyFill.

Failed to recalculate device parameters. webvr-polyfill.js:1945:12
    Aframe 7
        recalculateDeviceParams_
        ge
        Xe
        getPolyfillDisplays
        getVRDisplays
        c
        5579
    Webpack 5
        n
        <anonymous>
        <anonymous>
        <anonymous>
        <anonymous>