w3c / w3c/csswg-drafts

[cssom] Disabling imported styleSheet

Open
#9,538 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cssom-1
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Is it expected behavior for a styleSheet that has been imported with @import and subsequently disabled to act as though it is still enabled?

Given the following document and external CSS file, I would expect the imported style to be disabled and the body text to not be red, however that does not seem to be the case.

/* red.css */
body {
  color: red;
}
<!DOCTYPE html>
<html>
  <head>
      <style>@import 'red.css'</style>
      <script>
        const importedStyleSheet = document.styleSheets[0].cssRules[0].styleSheet;
        importedStyleSheet.disabled = true;
        console.log(importedStyleSheet.disabled) // logs true, but body remains red
      </script>
  </head>
  <body>Should not be red</body>
</html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CSSOM specification sections covering imported style sheets and the CSSStyleSheet.disabled attribute. Reproduce the supplied @import example and compare the specified behavior with the observed result. Done means the expected behavior is clarified in the specification or the issue is resolved with a documented testable conclusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.