Re: [csswg-drafts] [cssom-1] Incorrect handling of `media` in Create a constructed `CSSStyleSheet`? (#11778)

> I think step 12 confused me by refering to "the attribute"

This is referring to an IDL attribute, not a DOM attribute

>  the media query list associated to the new MediaList should be updated whenever the attribute (of the owner node) is updated

My understanding is that the serialization thingie is precisely trying to avoid this. Servo and Firefox don't actually serialize and reparse, but they still clone the `MediaList` instead of reusing the same thing.

```html
<!DOCTYPE html>
<style media="(min-width: 100px)"></style>
<pre><script>
var media = document.styleSheets[0].media;
var stylesheet = new CSSStyleSheet({media});
document.writeln(stylesheet.media); // (min-width: 100px)
media.appendMedium("(min-height: 100px)");
document.writeln(stylesheet.media); // (min-width: 100px)
document.writeln(media);            // (min-width: 100px), (min-height: 100px)
</script>
```

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11778#issuecomment-2814082090 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 17 April 2025 21:45:09 UTC