JavaScript Document styleSheetSets Property

Beginner
⏱️ 12 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Deprecated
Non-standard
Instance property

What You’ll Learn

Document.styleSheetSets is a deprecated read-only instance property that returns a live list of available style sheet set names. Learn how MDN builds the list from styleSheets titles, populate a theme picker UI, compare with related set properties, and modern alternatives.

01

Kind

Read-only list

02

Items

Set name strings

03

Status

Deprecated

04

Live

Updates with DOM

05

Built from

styleSheets

06

Prefer

CSS class themes

Introduction

Legacy pages with multiple alternate stylesheets needed a way to list every named theme the user could pick. document.styleSheetSets exposed those names as a live list so scripts could build menus or radio buttons.

MDN: the styleSheetSets read-only property returns a live list of all of the currently-available style sheet sets.

💡
Names, not stylesheet objects

Unlike styleSheets, which returns CSSStyleSheet objects, this property returns string titles of named sets. Use selectedStyleSheetSet to switch the active set in supporting browsers.

Related Document tutorials: selectedStyleSheetSet, preferredStyleSheetSet, lastStyleSheetSet, styleSheets.

Understanding Document.styleSheetSets

A read-only instance property from the alternate stylesheet era. MDN marks it deprecated and non-standard.

  • Value — live list of available style sheet set name strings (MDN).
  • Construction — from styleSheets titles, in sheet order; duplicates dropped case-sensitively (MDN Notes).
  • Sheets without title — omitted from the list (MDN Notes).
  • Switch active set — use selectedStyleSheetSet, not this list.
  • Status — Deprecated and Non-standard (MDN).

📝 Syntax

JavaScript
document.styleSheetSets

Value

A list of style sheet sets that are available (MDN).

MDN: populate a list UI

JavaScript
const list = document.getElementById("sheetList");
const sheets = document.styleSheetSets;

list.textContent = "";

for (const sheet of sheets) {
  const item = document.createElement("li");
  item.textContent = sheet;
  list.appendChild(item);
}

⚡ Quick Reference

GoalCode / note
Get available setsdocument.styleSheetSets
Feature detect"styleSheetSets" in document
Loop set namesfor (const name of document.styleSheetSets)
Switch active setdocument.selectedStyleSheetSet = name
Author defaultdocument.preferredStyleSheetSet
Modern themesYour own config + classList.toggle("dark")

🔍 At a Glance

Four facts about document.styleSheetSets.

Type
string list

Read-only

Status
deprecated

Avoid

Source
styleSheets

MDN

Prefer
CSS themes

Modern

📋 styleSheetSets vs styleSheets

styleSheetSetsstyleSheets
MDN statusDeprecated + Non-standardBaseline Widely available
Item typeSet name stringsCSSStyleSheet objects
DeduplicationYes (case-sensitive, MDN)One entry per sheet
Use in 2026?NoYes — inspect CSS

Examples Gallery

Examples follow MDN Document: styleSheetSets. Many browsers will report the property as missing—that is expected.

📚 Getting Started

Detect support and safely read the legacy list.

Example 1 — Feature Detect styleSheetSets

Never assume the property exists.

JavaScript
const supported = "styleSheetSets" in document;
console.log("styleSheetSets supported?", supported);
Try It Yourself

How It Works

Because MDN marks the API deprecated and non-standard, missing support is normal.

Example 2 — Loop Available Set Names

Log each name when the API is present.

JavaScript
if ("styleSheetSets" in document) {
  for (const name of document.styleSheetSets) {
    console.log(name);
  }
} else {
  console.log("Property not available");
}
Try It Yourself

How It Works

Each string is a unique set title gathered from stylesheet title attributes.

📈 MDN UI Pattern, Compare & Modern Themes

Build a picker UI and learn the recommended replacement.

Example 3 — Populate a List (MDN)

MDN example: fill a <ul> with every available set name.

JavaScript
const list = document.getElementById("sheetList");
const sheets = document.styleSheetSets;

list.textContent = "";

for (const sheet of sheets) {
  const item = document.createElement("li");
  item.textContent = sheet;
  list.appendChild(item);
}
Try It Yourself

How It Works

Classic pattern for a browser-style theme picker in legacy Firefox-era pages.

Example 4 — Compare Sets List with Selected Set

Show available names alongside the active set.

JavaScript
function reportSets() {
  if (!("styleSheetSets" in document)) {
    return "Style sheet set API not supported";
  }
  const available = [...document.styleSheetSets];
  return {
    available,
    selected: document.selectedStyleSheetSet
  };
}

console.log(reportSets());
Try It Yourself

How It Works

available lists every set; selected is which one is active now.

Example 5 — Modern Theme List (Recommended)

Replace legacy set discovery with your own theme config.

JavaScript
const themes = ["light", "dark", "high-contrast"];

themes.forEach((theme) => {
  const btn = document.createElement("button");
  btn.textContent = theme;
  btn.addEventListener("click", () => {
    document.documentElement.dataset.theme = theme;
    console.log("theme:", theme);
  });
  document.body.appendChild(btn);
});
Try It Yourself

How It Works

Use [data-theme="dark"] selectors in CSS instead of alternate stylesheet titles.

🚀 Common Use Cases

  • Legacy theme menus — populate radio buttons with set names.
  • Code audits — find pages still reading styleSheetSets.
  • Migration — map old set names to new CSS theme tokens.
  • Teaching — explain how alternate stylesheets worked.
  • Do not use for new pickers — define themes in app config.
  • Pair with selectedStyleSheetSet — list options, then assign active set (legacy only).

🧠 How document.styleSheetSets Is Built

1

Page links titled stylesheets

<link title="Dark"> and <style title="...">.

Markup
2

Browser walks styleSheets

In document.styleSheets order (MDN Notes).

Enumerate
3

Titles deduplicated

Case-sensitive unique set names become styleSheetSets.

List
4

Today: own theme config

Define ["light","dark"] in JS and toggle classes or data attributes.

📝 Notes

  • MDN: Deprecated and Non-standard — both banners shown above.
  • MDN Notes: list built from styleSheets titles; sheets without titles skipped; duplicates dropped case-sensitively.
  • Live list — changes when stylesheets are added or removed.
  • Often unavailable in Chromium and other modern engines.
  • Related: selectedStyleSheetSet, styleSheets, adoptedStyleSheets.

Browser Support

Document.styleSheetSets is marked Deprecated and Non-standard on MDN. Do not rely on it in new apps. Logos use the shared browser-image-sprite.png sprite from this project.

Deprecated · Non-standard

Document.styleSheetSets

Legacy live list of available alternate style sheet set names.

Legacy Avoid in new code
Google Chrome Generally not available
No / removed
Mozilla Firefox Legacy / may be limited
Legacy only
Apple Safari Not reliable
No / limited
Microsoft Edge Chromium — generally not available
No / removed
Opera Follow Chromium
No / removed
Internet Explorer Legacy era only
Legacy only
Document.styleSheetSets Limited / removed

Bottom line: Feature-detect if you must read legacy code. Prefer your own theme config with CSS classes, custom properties, or adoptedStyleSheets.

Conclusion

Document.styleSheetSets exposed every named alternate stylesheet set on a page as a live string list. MDN deprecates the entire API. Modern theme pickers should use your own configuration with CSS classes, custom properties, or adoptedStyleSheets.

Continue with linkColor, selectedStyleSheetSet, styleSheets, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Feature-detect before reading styleSheetSets
  • Migrate set names to explicit theme config arrays
  • Use data-theme or class toggles on <html>
  • Learn the full set API family for legacy audits
  • Use styleSheets for modern CSS inspection

❌ Don’t

  • Build new theme UIs on styleSheetSets
  • Assume Chromium supports the property
  • Confuse set name strings with CSSStyleSheet objects
  • Expect untitled stylesheets to appear in the list
  • Rely on case-insensitive duplicate handling (MDN: case-sensitive)

Key Takeaways

Knowledge Unlocked

Five things to remember about document.styleSheetSets

Legacy live list of alternate set name strings.

5
Core concepts
📝02

Built from

titles

MDN
⚠️03

Status

deprecated

Avoid
🔄04

Live

DOM sync

List
05

Prefer

CSS themes

Modern

❓ Frequently Asked Questions

A live list of all currently available style sheet set names on the document (MDN). Each item is a string title identifying a set.
Yes. MDN marks Document.styleSheetSets as Deprecated and Non-standard. Do not use it in new code.
MDN Notes: enumerate document.styleSheets in order, add each sheet title that has a title, and drop duplicates using a case-sensitive comparison.
No. styleSheets returns CSSStyleSheet objects. styleSheetSets returns deduplicated string names of alternate sets derived from those sheets titles.
No. MDN describes it as read-only. To switch sets in the legacy API, assign selectedStyleSheetSet instead.
Build a list from your own theme config, toggle a class on document.documentElement, use CSS custom properties, or adoptedStyleSheets.
Did you know?

MDN Notes say the available set list is built by walking document.styleSheets in order and collecting each sheet’s title, skipping sheets without a title and removing duplicates with a case-sensitive comparison.

Next: linkColor

Learn about another deprecated Document color property from the legacy era.

linkColor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful