Browser Compatibility

The bundles are built for the browsers below (esbuild targets chrome93, edge93, firefox92, safari15.4), so newer syntax is lowered for them. What esbuild cannot lower is kept out of the sources of the library and of @tradik/xslt3 by a test (src/browserSupport.test.js): regular expression lookbehind, the v flag, and built-ins newer than Safari 15.4 such as isWellFormed(), toSorted() or Object.groupBy(). A lookbehind made the 1.3.4 bundle a SyntaxError in Safari 15.4 to 16.3 (issue #35). The one exception is the m flag of @tradik/xslt3's regular expressions, which builds a lookbehind at run time only after checking that the engine has it, and otherwise raises FORX0002 naming Safari before 16.4. Object.hasOwn() and Array.prototype.at() set the minimum versions.

Polyfill Support

EnvironmentMinimum VersionStatus
Chrome93+Supported
Edge93+Supported
Firefox92+Supported
Safari15.4+Supported
Opera79+Supported
Samsung Internet17+Supported
Node.js20.19+ (engines)Supported; CI tests 22, 24 and 26. Needs a DOM such as jsdom

Native XSLT Deprecation Timeline

From Chrome's announcement (updated 29 October 2025):

BrowserDeprecatedOff in stableOff for everyone
Chrome143 (2 December 2025)158 (17 November 2026)176 (17 August 2027), when the origin trial and enterprise policy end
Edge and other Chromium browsersfollow Chromiumfollow Chromiumfollow Chromium
Chrome WebView (Android)off by default in Canary, Dev and Beta from 154 (22 September 2026)
Firefoxpositive standards position, tracking bug 1990759no dateno date
Safari (WebKit)supports the removalno dateno date

XML Documents With <?xml-stylesheet?>

A browser without XSLT ignores the processing instruction and shows the XML document as it is, but it does run an XHTML <script> element found in the document (tested in Chromium with Blink's XSLT feature disabled, which is what Chrome 158 ships: the chromium-noxslt project of the browser tests). The bundle uses that: when it loads inside an unstyled XML document that carries an XSLT processing instruction, autoApplyXmlStylesheet() fetches the stylesheet relative to the document, runs importStylesheetAsync() (so xsl:import and xsl:include are fetched too), transforms the document without the XHTML script elements, and replaces the document element with the result. Script elements of the result are re-created so that they run. One line does it:

<?xml-stylesheet type="text/xsl" href="page.xsl"?>
<root><script xmlns="http://www.w3.org/1999/xhtml" src="https://cdn.jsdelivr.net/npm/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js"></script>…</root>

Browsers with XSLT apply the instruction while parsing and never execute the script. The API: findXmlStylesheet(doc), needsXmlStylesheet(doc), applyXmlStylesheet(doc, { fetch, Processor }) (a promise; false when the document needs nothing) and autoApplyXmlStylesheet(doc) (waits for DOMContentLoaded, logs errors and leaves the raw XML in place).

Feature Detection

With a bundler, one import does what the browser bundle does on load:

import "@tradik/xslt-processor/polyfill";

By hand:

import { isNativeXSLTSupported, installGlobal } from '@tradik/xslt-processor';

// Check native support and auto-install polyfill
if (!isNativeXSLTSupported()) {
  installGlobal();
  console.log('Using JavaScript XSLT polyfill');
}

This page is generated from docs/BROWSER-SUPPORT.md in the repository. Corrections are welcome as a pull request to that file.

Built with ssg