{"id":1424,"date":"2026-11-19T07:00:00","date_gmt":"2026-11-19T07:00:00","guid":{"rendered":"https:\/\/allcloudhost.net\/blogs\/?p=1424"},"modified":"2026-10-08T04:38:33","modified_gmt":"2026-10-08T04:38:33","slug":"baseline-web-features-reduce-javascript","status":"publish","type":"post","link":"https:\/\/allcloudhost.net\/blogs\/baseline-web-features-reduce-javascript\/","title":{"rendered":"What Baseline Web Features Actually Save You in JavaScript Weight"},"content":{"rendered":"<p>In short: Baseline tracks which web features work across the major browsers, so Baseline features can replace many JavaScript libraries and cut your bundle size without changing how the site behaves.<\/p>\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\">\n<h2>Table of Contents<\/h2>\n<nav>\n<ul>\n<li><a href=\"#h-native-date-and-number-formatting-apis\">Native Date and Number Formatting APIs<\/a><\/li>\n<li><a href=\"#h-native-fetch-api-optimization\">Native Fetch API Optimization<\/a><\/li>\n<li><a href=\"#h-native-dialog-and-popover-ui-elements\">Native Dialog and Popover UI Elements<\/a><\/li>\n<li><a href=\"#h-removing-lodash-dependencies-using-native-javascript-methods\">Removing Lodash Dependencies Using Native JavaScript Methods<\/a><\/li>\n<li><a href=\"#h-when-to-wait-before-adopting-new-native-apis\">When to Wait Before Adopting New Native APIs<\/a><\/li>\n<li><a href=\"#h-core-web-vitals-impact-of-replacing-legacy-libraries-with-ba\">Core Web Vitals Impact of Replacing Legacy Libraries With Baseline Features<\/a><\/li>\n<\/ul>\n<\/nav>\n<\/div>\n<p>Every JavaScript library a site loads has to be downloaded, parsed, and executed before a visitor sees anything useful, and most small business websites are carrying more of that weight than they need to. A <a href=\"https:\/\/smashingmagazine.com\/2026\/08\/how-baseline-can-help-ship-less-javascript\/\" target=\"_blank\" rel=\"noopener\">Smashing Magazine analysis on Baseline<\/a>, the framework maintained by the WebDX Community Group, lays out exactly where a meaningful chunk of that weight can disappear: not through a clever build trick, but by replacing entire libraries with features browsers already ship natively. Swapping a handful of common libraries for their Baseline-widely-available equivalents can strip 60KB to 90KB of minified, gzipped JavaScript out of a typical mid-sized application.<\/p>\n<p>Baseline sorts web platform features into three tiers: limited availability (not yet in every major browser), newly available (just landed across Chrome, Edge, Firefox, and Safari), and widely available (stable across all of them for 30 months or more). That last tier is the useful one for a production website, since it marks a feature as safe to rely on without a fallback.<\/p>\n<table>\n<thead>\n<tr>\n<th>Library Category \/ Target<\/th>\n<th>Native Replacement API<\/th>\n<th>Estimated Size Savings<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Date &#038; Number Formatting (<code>timeago.js<\/code>, <code>numeral<\/code>)<\/td>\n<td><code>Intl.RelativeTimeFormat<\/code>, <code>Intl.NumberFormat<\/code><\/td>\n<td>~14KB<\/td>\n<\/tr>\n<tr>\n<td>HTTP Requests (<code>axios<\/code>)<\/td>\n<td><code>fetch<\/code> + <code>AbortSignal.timeout()<\/code><\/td>\n<td>~17KB<\/td>\n<\/tr>\n<tr>\n<td>Modals &#038; UI Elements (<code>focus-trap<\/code>, <code>body-scroll-lock<\/code>)<\/td>\n<td><code>&lt;dialog&gt;<\/code> element, Popover API, CSS Anchor<\/td>\n<td>~24KB<\/td>\n<\/tr>\n<tr>\n<td>Utility Functions (<code>Lodash<\/code> \/ groupby, clonedeep)<\/td>\n<td><code>Object.groupBy<\/code>, <code>structuredClone<\/code>, Native <code>Set<\/code><\/td>\n<td>~8KB<\/td>\n<\/tr>\n<tr>\n<td><strong>Total Potential Savings<\/strong><\/td>\n<td><strong>Combined Native API Refactor<\/strong><\/td>\n<td><strong>60KB to 90KB<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>For a site that isn&#8217;t hand-coding its own JavaScript from scratch (most small business sites built on WordPress, PrestaShop, or a page builder aren&#8217;t), this isn&#8217;t a direct do-it-yourself checklist. It&#8217;s a map of exactly what to ask a developer or theme\/plugin author to check, and a way to understand why a site might be slower than it should be even on hosting that&#8217;s otherwise perfectly capable.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-native-date-and-number-formatting-apis\">Native Date and Number Formatting APIs<\/h2>\n<p>An estimated amount of JavaScript weight on ordinary business sites comes from formatting: turning a timestamp into &#8220;3 days ago,&#8221; or a raw number into &#8220;1,204&#8221; with proper thousands separators. Libraries like <code>timeago.js<\/code> and <code>numeral<\/code> exist specifically to handle that, and both are now redundant for most purposes. The <code>Intl.RelativeTimeFormat<\/code> and <code>Intl.NumberFormat<\/code> APIs are built directly into every modern browser and handle the same formatting, including proper localization for different languages and regions, without a single extra byte of download.<\/p>\n<p>The only one in this group still worth some caution is <code>Intl.DurationFormat<\/code>, which the piece notes is newly available rather than fully baselined yet, meaning it hasn&#8217;t been stable across all major browsers for the full 30-month window. For anything client-facing where an older browser still needs to be supported, that one&#8217;s worth checking against current browser support data before ripping out the library it would replace.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-native-fetch-api-optimization\">Native Fetch API Optimization<\/h2>\n<p><code>axios<\/code> has been the default choice for making HTTP requests in JavaScript for years, largely because the native <code>fetch<\/code> API used to lack a few conveniences, timeouts being the most commonly cited one. That gap has officially closed now: <code>fetch<\/code> combined with <code>AbortSignal.timeout()<\/code> covers request timeouts natively, which was one of axios&#8217;s most-cited reasons for existing in the first place.<\/p>\n<p>Building custom wrappers is surprisingly straightforward here. Things like request\/response interceptors and automatic retry logic still require writing a small custom wrapper if a site actually depends on them, since fetch doesn&#8217;t include those out of the box. For a typical business site making a handful of API calls (a contact form submission, a product search, a newsletter signup), the custom wrapper is a few dozen lines, not a rewrite.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-native-dialog-and-popover-ui-elements\">Native Dialog and Popover UI Elements<\/h2>\n<p>Modal dialogs, long a staple of libraries like <code>focus-trap<\/code> for handling keyboard accessibility correctly, can now be built with the native <code>&lt;dialog&gt;<\/code> element, which handles focus trapping and keyboard interaction as part of the browser&#8217;s own implementation rather than bolted-on JavaScript.<\/p>\n<p>Tooltips and dropdown menus follow the exact same pattern: the Popover API combined with CSS anchor positioning covers a large share of what dedicated tooltip and dropdown libraries used to be the only way to build. Even something as small as preventing background scroll while a modal is open, previously requiring a library like <code>body-scroll-lock<\/code>, now comes down to a single CSS rule. None of these are exotic browser features anymore; they&#8217;re the kind of thing a competent front-end developer can swap in during routine maintenance rather than a major redesign.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-removing-lodash-dependencies-using-native-javascript-methods\">Removing Lodash Dependencies Using Native JavaScript Methods<\/h2>\n<p>Lodash has been a default dependency on an enormous share of JavaScript projects for over a decade, often pulled in for a small handful of utility functions out of a much larger library. <code>Object.groupBy<\/code> now covers what <code>lodash.groupby<\/code> was built for. <code>structuredClone<\/code>, built into every modern browser, replaces <code>lodash.clonedeep<\/code> for deep-copying objects. Native <code>Set<\/code> methods handle the union and intersection operations that used to require importing Lodash&#8217;s set utilities specifically.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-when-to-wait-before-adopting-new-native-apis\">When to Wait Before Adopting New Native APIs<\/h2>\n<p>Not every native API is actually a safe swap yet, and the piece is explicit about Temporal, the newer date and time API meant to eventually replace libraries like <code>moment.js<\/code> entirely. Its recommendation is to hold off for now, for a specific, almost counterintuitive reason: the polyfill needed to support Temporal in browsers that don&#8217;t yet implement it natively is more than ten times the size of the library it would be replacing. Adopting it today, before broader native support lands, would make a bundle larger, not smaller. That&#8217;s a useful reminder that &#8220;native API exists&#8221; and &#8220;safe to adopt right now&#8221; aren&#8217;t always the same question, and Baseline&#8217;s own tiering system is exactly how to tell the difference.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-core-web-vitals-impact-of-replacing-legacy-libraries-with-ba\">Core Web Vitals Impact of Replacing Legacy Libraries With Baseline Features<\/h2>\n<p>None of this changes how fast your hosting server responds to a request. It changes how much work a visitor&#8217;s browser has to do after that response arrives, and that distinction matters more than it sounds. Largest Contentful Paint and other Core Web Vitals metrics that factor into search ranking are measured on the visitor&#8217;s device, and a smaller JavaScript bundle means less time spent downloading, parsing, and executing code before a page becomes interactive, independent of how capable the underlying hosting plan is.<\/p>\n<p>It also compounds with everything else that affects page speed. A site on fast hosting with an unnecessarily heavy JavaScript bundle is still going to feel sluggish on a mid-range phone over a mobile connection, which describes a meaningful share of real visitors to any small business site. The fix here doesn&#8217;t cost anything extra in hosting resources; it&#8217;s a conversation to have with whoever maintains your theme or custom scripts, framed around a specific, concrete question: which of these five library categories does our site still depend on, and is the replacement actually safe to use yet according to Baseline&#8217;s own widely-available tier.<\/p>\n<p>For a site builder or developer managing several client sites, this is also a reasonable thing to check once across every site in the portfolio rather than one at a time, since the same handful of libraries (moment-style date formatting, axios, a modal library, Lodash) tend to show up across most projects built in a similar era.<\/p>\n<p>Related reading: <a href=\"https:\/\/allcloudhost.net\/blogs\/html-dialog-element-modals-without-js-library\/\">The HTML Dialog Element: Native Modals Without a JS Library<\/a> and <a href=\"https:\/\/allcloudhost.net\/blogs\/wordpress-7-1-whats-changing\/\">WordPress 7.1 Ships August 19: What Actually Changes for Site Owners<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In short: Baseline tracks which web features work across the major browsers, so Baseline features can replace many JavaScript libraries and cut\u2026<\/p>\n","protected":false},"author":2,"featured_media":1423,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"rank_math_title":"Baseline Web Features: Cut JavaScript Bundle Size","rank_math_description":"Native browser APIs covered by Baseline can replace common JS libraries entirely. Here's where the real savings come from and what it means for page speed.","rank_math_focus_keyword":"baseline, reduce javascript bundle size, core web vitals page speed, javascript bundle size seo","rank_math_canonical_url":"","rank_math_robots":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1424","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webhosting"],"_links":{"self":[{"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/posts\/1424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/comments?post=1424"}],"version-history":[{"count":4,"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/posts\/1424\/revisions"}],"predecessor-version":[{"id":1809,"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/posts\/1424\/revisions\/1809"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/media\/1423"}],"wp:attachment":[{"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/media?parent=1424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/categories?post=1424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/allcloudhost.net\/blogs\/wp-json\/wp\/v2\/tags?post=1424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}