Description
The question here is what should be printed from this sample:
<!doctype html>
<style>
@import url("lol.css") supports(lol:no);
</style>
<script>
var rule = document.styleSheets[0].cssRules[0];
console.log(rule.media);
</script>
The IDL for this is:
https://drafts.csswg.org/cssom/#ref-for-dom-cssimportrule-href
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
And the prose says:
The media attribute must return the value of the media attribute of the associated CSS style sheet.
However, the rule may not have an associated CSS style sheet, according to this note slightly below.
Note: An @import at-rule might not have an associated CSS style sheet (e.g., if it has a non-matching supports() condition).
In this case, it can't read the media attribute from the null style sheet, so returning null would make sense. (So, making the attribute nullable, and adjusting the prose to say to return null if no associated style sheet exists.) This is what Firefox does - however, Chromium seems to not represent an @import
with a non-matching supports()
clause in the CSSOM at all.