Replies: 1 comment 1 reply
-
Why not 3.0.0? If someone |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To provide out-of-the-box support for all browsers that were modern back then, Naja comes with two polyfills: for
AbortSignal
and forEventTarget()
constructor. I figured now would be a good time to reevaluate if they are still necessary.It turns out they are not.
tl;dr
Naja will soon™ remove these polyfills from its dist package. They serve versions of browsers which – accumulated – account for not much more than 1 % of market share in 🇨🇿, according to caniuse data. The vast majority of users only download these bundled polyfills so that their browsers can throw them away.
If you need to support legacy (non-Chromium) versions of Edge or some older versions of Safari (< 14) in your application, please include the polyfills in your own application code.
What are they
AbortSignal
adds support for abortable Fetch requests. Naja supports this and even uses this itself in its built-in extensions. It has not been properly implemented in desktop Safari until 12.1, in iOS until 11.3, and in Edge until 16. According to caniuse data for 🇨🇿, these and older versions of the browsers amount to 0.14 % of the market in the case of iOS, and around 0.02–0.03 % in the case of both desktop Safari and Edge.EventTarget()
constructor is crucial to the operation of Naja's event system. It's a slightly more recent addition: it hasn't appeared in Edge until it switched to Chromium engine, and Apple implemented it in Safari/iOS 14. Again, according to caniuse data, this translates to about 0.1 % in the case of legacy Edge versions altogether, and 0.37 % and 0.64 % for Safari (desktop and iOS, respectively).Costs and benefits
Accumulated, the affected browser versions account for approximately 1.1 % of the market share. I believe the number is likely to decrease further: legacy Edge has been deprecated and Microsoft actively pushes the new Chromium-based Edge towards users, and Apple has released Safari/iOS/iPadOS 14 for systems and devices that are nearing their end-of-life (2015 models of iPhone and iPad, and 2012 Macs).
On the other side of the equation, the benefits appear to be non-negligible: removing the polyfills cuts Naja's dist size in half, from ~35 kB down to ~17 kB minified and from ~10 kB to ~5 kB minzipped. Considering the aforementioned marginal market share of the targeted browser versions, this means that up to 99 % of users unnecessarily download twice as much data which is then unused anyway.
From where I see it, all available data speak unanimously in favor of removing the polyfills.
Towards a modern web platform
It has been the goal of Naja 2.x to build upon common, well-known, standardized web APIs such as
fetch()
,AbortSignal
,EventTarget
, andCustomEvent
s. Naja has included the polyfills in question so that you could grab its minified dist file, plop it into your website, and it would work, everywhere.It's been a year and a half since the release of 2.0.0 and the adoption of those APIs has shifted. In my eyes, 99 % is a pretty good definition of 'everywhere.' I think it's fair for Naja to expect to run in a modern environment where all standard APIs are implemented and made available by the browser, especially when a huge majority of visits, statistically speaking, are made using a capable browser.
What to do
Go take a look into your analytics dashboard and figure out which browsers your visitors use to access your website. If they do not include a portion of legacy Edge or Safari < 14 significant enough by your standards, you can safely upgrade Naja once it ships without the polyfills, and be happy that you're serving your users a smaller client-side bundle.
Should you need to support the problematic browser versions, you can very easily include the polyfills in your own application codebase and Naja will be able to pick them up and use them if necessary.
The timeline
I'm going to leave this announcement here for two weeks and unless it gathers a significant amount of criticism and counter-arguments during the period, I'm going to release a polyfill-free Naja 2.3.0 on December 23, as an early Christmas present.
Beta Was this translation helpful? Give feedback.
All reactions