document.enableStyleSheetsForSet(name) enables every stylesheet whose title matches name, and disables other titled sheets. Sheets with no title stay enabled (MDN). Returns undefined.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call document.enableStyleSheetsForSet. Start with this line.
JavaScript
document.enableStyleSheetsForSet(name)
Call
What it does
document.enableStyleSheetsForSet(name)
Primary signature.
document.enableStyleSheetsForSet(...)
Call with the arguments your case needs.
Built into the browser. Call enableStyleSheetsForSet(...) on document — no import required.
Library declarations
JavaScript
document.enableStyleSheetsForSet(name)
Parameters
Parameter
Description
name
Required. Title to enable; "" disables titled alternates
Return Value
Return Value
Description
*
Always undefined
JavaScript Examples
Example 1 — Feature-Detect
Check for a function before calling this legacy method.
JavaScript
const ok = typeof document.enableStyleSheetsForSet === "function";
console.log(ok ? "legacy API available" : "missing — use modern themes");
Document.enableStyleSheetsForSet() is Deprecated and Non-standard on MDN. It is not part of any specification. Do not rely on it in new code.
✓ Deprecated · Non-standard
Document.enableStyleSheetsForSet()
Legacy alternate-stylesheet helper. Feature-detect if you must inspect old pages; ship modern theming instead.
LegacyDeprecated API
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
document.enableStyleSheetsForSet()Avoid
Bottom line: Literacy only. Prefer data-theme / class toggles or adoptedStyleSheets for production themes.
Frequently Asked Questions
MDN: it enables the style sheets matching the specified name in the current style sheet set, and disables all other style sheets (except those without a title, which are always enabled).
Yes. MDN marks Document.enableStyleSheetsForSet() as Deprecated and Non-standard. It is not part of any specification.
MDN: the name of the style sheets to enable. All style sheets with a matching title are enabled; other titled sheets are disabled. Pass "" to disable all alternate and preferred sheets (persistent untitled sheets stay enabled).
No. MDN: calling with a null name has no effect. To disable alternate/preferred sheets you must pass the empty string "".
No. MDN Notes: this method never affects document.lastStyleSheetSet or document.preferredStyleSheetSet.
Prefer modern theming: toggle a class or data-theme on document.documentElement, CSS custom properties, prefers-color-scheme, or adoptedStyleSheets. Do not build new apps on the alternate stylesheet set API.