Re: [csswg-drafts] [cssom] Can we lift the restriction on constructed flag for adoptedStylesheets? (#10013)

The CSS Working Group just discussed `[cssom] Can we lift the restriction on constructed flag for adoptedStylesheets?`, and agreed to the following:

* `RESOLVED: We do want to remove this restriction, and will work on how to address this`

<details><summary>The full IRC log of that discussion</summary>
&lt;jarhar> emilio: so basically this is about adopted stylesheets being, this came up as a more general problem which is sometimes you want to apply some stylesheets across shadow boundaries, use case for global ish stylesheets<br>
&lt;jarhar> emilio: right now that requires making them adopted stylesheets and adoping them in shadowroots or making them insert markup in all the shadowroots with a link or style element<br>
&lt;jarhar> emilio: theyre not great, yhou should be able to magically - adopted by the shadowroot without changing the shadowroot markjup<br>
&lt;jarhar> emilio: on paper theres nothing terribly possible about it. there ssome solutions - assumptions about stylesheet being a constructed or adopted or owned by a dom element which would stop holding but my intuition is that those are effectively fixable<br>
&lt;futhark> q+<br>
&lt;jarhar> emilio: another alternative to this would be to expose a cheap clone of a stylesheet that gives you basically gives you a construcuted stylesheet from a constructued one. all browsers have this concept of cheap copyable stylesheets contents for caching<br>
&lt;jarhar> emilio: that would be a potential another path which would sidestep the ownership issues<br>
&lt;TabAtkins> q+<br>
&lt;jarhar> emilio: i added this to the agenda because this came up when discussing with keith and it seems like it would be a useful thing to do for web component authors especially - massive thread in web compoentns repo about how to mix web compoentns with ? global stylesheets and this gives you the author level tool to do this in a less disruptive way<br>
&lt;lwarlow> https://github.com/WICG/webcomponents/issues/909 - here's the issue mentioned<br>
&lt;jarhar> emilio: i am not looking ofr a particular solution but is there anybody who thinks this would be terrible or is there something that i missed? if not should we ?<br>
&lt;astearns> ack futhark<br>
&lt;jarhar> futhark: i think that i have basically the same take. some minor issues? what if you have a linked stylesheet and then you remove the link, but thats details we can resolve. i think that the cheap cloning is probably ? in all browsers also. thats the way in general to ?<br>
&lt;astearns> ack TabAtkins<br>
&lt;bkardell_> futhark: doesn't this happen with imported sheets today though?<br>
&lt;jarhar> TabAtkins: my concern was about what exaclty the reasining was behind a consturcted flag and now that rune said that its about the ? adopted stylesheet, the cheap clone would avoid those issues. you still havoid the document association<br>
&lt;emilio> q+<br>
&lt;lwarlow> q+<br>
&lt;astearns> ack emilio<br>
&lt;jarhar> TabAtkins: it would be clear as a lcone that in a separate stylesheet we did disconnec thte ? make sure you mantain the base url youre associated with if you move to a new document. ? cheap clone because it makes things less weird in those cases, you can construct a stylesheet ? i would like to address that, construct an api if possible so you can<br>
&lt;jarhar> only create this this way. i would like this to get fixed better<br>
&lt;jarhar> emilio: regarding that, i think the baseuri association is basically ? so if you basically keep a reference to a stylesheet and then keep a link theres nothing - gecko keeps the baseuri in the stylesheet so theres nothing that would prevent that from working<br>
&lt;jarhar> emilio: i dont think any browsers ? based mutations that would be terrible<br>
&lt;jarhar> TabAtkins: so as long as that is indeed stable<br>
&lt;jarhar> TabAtkins: if thats stable rather than dynamic then i dont have an issue except that ? i would like to pursue being able to set the baseurl in the dconstructed stylesheetg construcotr so its not only availbe for this behavior<br>
&lt;jarhar> emilio: you can already do that, baseuri in stylesheet options<br>
&lt;astearns> ack lwarlow<br>
&lt;jarhar> TabAtkins: then ive got no qualms<br>
&lt;jarhar> lwarlow: how does this work with cross origin stylesheets? you cant get access to the source<br>
&lt;jarhar> lwarlow: if you turn it into a css stylesheet you can read the source from it<br>
&lt;emilio> q+<br>
&lt;jarhar> TabAtkins: i imagine we just dont allow that. has to be a same origin stylesheet<br>
&lt;bkardell_> q+<br>
&lt;jarhar> emilio: my understanding is that if we do this cloned stuff then you shoul dhave the same checks that regular stylesheets do, you get a css stylesheet reference you just dont get access to .cssrules and so on<br>
&lt;bkardell_> q-<br>
&lt;astearns> ack emilio<br>
&lt;bkardell_> (I think Emilio just said what I was queuing for)<br>
&lt;jarhar> emilio: another thing to maybe check would be whether we should reuse the stylesheet presumably we also raise the media condition that you get with ? ink, these is things that can get sorted out while we work on this<br>
&lt;jarhar> astearns: proposed resolution that yes we would like to have adopted stylesheets be able to use non construcuted?<br>
&lt;jarhar> emilio: either that or exposing some sort of clone method, but presumably former is a nicer api because it allows you to clone directly from document.stylesheets which seems nicer<br>
&lt;jarhar> astearns: so yes we would like to fix it, ?<br>
&lt;jarhar> emilio: yeah that sounds good<br>
&lt;jarhar> emilio: no objection to this, so yeah thats not a resolution<br>
&lt;jarhar> astearns: this is the point where i call to objections<br>
&lt;jarhar> astearns: anyone have concerns?<br>
&lt;jarhar> emilio: we would like to do this<br>
&lt;bramus> Seems a useful additinon<br>
&lt;bramus> s/additinon/addition<br>
&lt;bkardell_> astearns: I will drop your thing at your door in a few<br>
&lt;jarhar> topic lunch<br>
&lt;astearns> wait<br>
&lt;astearns> let me do the resolution<br>
&lt;astearns> RESOLVED: We do want to remove this restriction, and will work on how to address this<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10013#issuecomment-2165396092 using your GitHub account


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

Received on Thursday, 13 June 2024 11:34:07 UTC