Document.selectedStyleSheetSet is a deprecated instance property that names the style sheet set currently in use. Learn how to read and (in legacy browsers) set it, its link to enableStyleSheetsForSet and lastStyleSheetSet, and modern CSS theme alternatives.
01
Kind
Get / set property
02
Returns
Set name string
03
Status
Deprecated
04
Live
disabled sync
05
Sets
lastStyleSheetSet
06
Prefer
CSS class themes
Fundamentals
Introduction
In the early web, authors could link multiple stylesheets with title attributes and let users (or scripts) switch between named style sheet sets—for example “Default” vs “High contrast.” document.selectedStyleSheetSet reports which set is active.
MDN: the selectedStyleSheetSet property indicates the name of the style sheet set that’s currently in use. You can read it and, in supporting browsers, assign a new set name to switch themes.
💡
The writable legacy switch
Among the three set properties (preferred, selected, last), selectedStyleSheetSet is the one scripts used to change themes. MDN: assigning it is equivalent to enableStyleSheetsForSet() plus updating lastStyleSheetSet.
Because MDN marks the API deprecated and non-standard, missing support is normal.
Example 2 — Read Current Set (MDN)
MDN logs the active style sheet set name.
JavaScript
if ("selectedStyleSheetSet" in document) {
console.log(`Current style sheet set: ${document.selectedStyleSheetSet}`);
} else {
console.log("Property not available in this browser");
}
When supported, the string matches the title of the enabled alternate stylesheet group.
📈 MDN Set Pattern, Compare & Modern Themes
Legacy switching and the recommended replacement.
Example 3 — MDN: Assign a New Set Name
Switch themes by assigning selectedStyleSheetSet (legacy only).
JavaScript
if ("selectedStyleSheetSet" in document) {
console.log(`Before: ${document.selectedStyleSheetSet}`);
document.selectedStyleSheetSet = "Some other style sheet";
console.log(`After: ${document.selectedStyleSheetSet}`);
} else {
console.log("Cannot switch — API not supported");
}
MDN: assignment calls enableStyleSheetsForSet() and updates lastStyleSheetSet.
Example 4 — Compare Preferred, Selected, and Last
Inspect all three legacy set properties together.
JavaScript
function reportStyleSheetSets() {
if (!("selectedStyleSheetSet" in document)) {
return "Style sheet set API not supported";
}
return {
preferred: document.preferredStyleSheetSet,
selected: document.selectedStyleSheetSet,
last: document.lastStyleSheetSet
};
}
console.log(reportStyleSheetSets());
Document.selectedStyleSheetSet 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.selectedStyleSheetSet
Legacy active style sheet set — read/write in old browsers; use CSS class themes today.
LegacyAvoid in new code
Google ChromeGenerally not available
No / removed
Mozilla FirefoxLegacy / may be limited
Legacy only
Apple SafariNot reliable
No / limited
Microsoft EdgeChromium — generally not available
No / removed
OperaFollow Chromium
No / removed
Internet ExplorerLegacy era only
Legacy only
Document.selectedStyleSheetSetLimited / removed
Bottom line: Feature-detect if you must read legacy code. Prefer CSS class themes, custom properties, or adoptedStyleSheets for modern theme switching.
Wrap Up
Conclusion
Document.selectedStyleSheetSet named the active alternate style sheet set and could switch sets when assigned. MDN deprecates the entire API. Modern pages should use CSS classes, custom properties, or adoptedStyleSheets instead.
Use document.documentElement.classList for dark mode
Learn the trio: preferred, selected, last (for audits only)
Prefer prefers-color-scheme for system themes
❌ Don’t
Build new theme UIs on selectedStyleSheetSet
Assume Chromium supports the API
Confuse selected (active) with preferred (author default)
Expect enableStyleSheetsForSet() to update last alone
Ignore the live disabled sync behavior in legacy code
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about document.selectedStyleSheetSet
Legacy active set — read/write in old browsers only.
5
Core concepts
🎨01
Active set
string name
MDN
✎️02
Writable
legacy switch
MDN
⚠️03
Status
deprecated
Avoid
🔄04
Live
disabled sync
MDN
✅05
Prefer
CSS themes
Modern
❓ Frequently Asked Questions
The name of the style sheet set currently in use on the page (MDN). It indicates which alternate stylesheet group is active.
Yes. MDN marks Document.selectedStyleSheetSet as Deprecated and Non-standard. Do not use it in new code.
Yes in supporting browsers. MDN: setting the value is equivalent to calling document.enableStyleSheetsForSet() with that name, then setting lastStyleSheetSet to the same value.
Yes. MDN notes the attribute value is live — directly changing the disabled attribute on stylesheets affects selectedStyleSheetSet.
preferredStyleSheetSet is the author default (read-only, may be empty string). selectedStyleSheetSet is the currently active set and can be read or written by scripts (MDN).
Prefer toggling a class on document.documentElement, CSS custom properties, prefers-color-scheme, or adoptedStyleSheets for constructable stylesheets.
Did you know?
MDN states that assigning document.selectedStyleSheetSet is equivalent to calling enableStyleSheetsForSet() with the new value, then setting lastStyleSheetSet to match. That is why lastStyleSheetSet only changes when selectedStyleSheetSet is assigned—not when the method alone is called.