Coder Social home page Coder Social logo

Should adopting from a Document into its associated inert template document (and vice versa) clear the adoptedStyleSheets? about construct-stylesheets HOT 11 OPEN

rakina avatar rakina commented on May 24, 2024 3
Should adopting from a Document into its associated inert template document (and vice versa) clear the adoptedStyleSheets?

from construct-stylesheets.

Comments (11)

brandonseydel avatar brandonseydel commented on May 24, 2024 1

@rakina - Yea the bug is a simple case, but the workaround would need to be applied to our HTML rendering core for Aurelia 2. I think we will probably be fine waiting as Aurelia 2 won't be RC till after that timeframe. Thank you!

from construct-stylesheets.

domenic avatar domenic commented on May 24, 2024

Treating template content documents specially seems like a rather inelegant hack from a theoretical purity perspective. But... it looks like it would significantly improve the lives of web developers. So, we should fix it in the way you suggest, theoretical purity be damned.

I agree that this won't have any of the negative consequences that fueled the original decision.

from construct-stylesheets.

rakina avatar rakina commented on May 24, 2024

Thanks! Yeah it's quite unfortunate.
Also, when trying to update the spec, I found out that the adopting steps passes node and oldDocument but not the new document (the document that the node will be adopted into). Is this intentional? If so, I wonder if there's a way for us to check the equality of the new document and the oldDocument or the constructor document with just these two...

from construct-stylesheets.

mfreed7 avatar mfreed7 commented on May 24, 2024

This sounds like a reasonable proposal to me! It will definitely fix the potential footgun of moving nodes to a template and back. Does the solution here avoid the multi-document issues discussed on the other threads (e.g. 23, 15, and webcomponents/759-comment)?

from construct-stylesheets.

rakina avatar rakina commented on May 24, 2024

This sounds like a reasonable proposal to me! It will definitely fix the potential footgun of moving nodes to a template and back. Does the solution here avoid the multi-document issues discussed on the other threads (e.g. 23, 15, and webcomponents/759-comment)?

Yeah, I think unlike the true multi-document case (moving betweeen documents in different frames), the associated-inert-template-document can be treated as the same as its "actual" document (the fetch groups etc is the same).

from construct-stylesheets.

brandonseydel avatar brandonseydel commented on May 24, 2024

Chromium reporter here. I just wondering what the timeline looks like on this fix? I was going to spend some time putting the workaround in, but it looks like we have some agreements on how to handle which may be introduced fairly soon. LMK TY

from construct-stylesheets.

rakina avatar rakina commented on May 24, 2024

Chromium reporter here. I just wondering what the timeline looks like on this fix? I was going to spend some time putting the workaround in, but it looks like we have some agreements on how to handle which may be introduced fairly soon. LMK TY

Heya, the spec and impl change is underway, it will be in Chrome M88 release. That won't hit Stable until January, so it's probably good to have the workaround. (from the bug, it seems simple enough?)

from construct-stylesheets.

annevk avatar annevk commented on May 24, 2024

I don't think this specification should be defining adopting steps for ShadowRoot. That should be directly done in the DOM Standard. Per class only one specification gets to define those after all. (That might mean HTML still needs to export something, but for a different reason.)

from construct-stylesheets.

rakina avatar rakina commented on May 24, 2024

I don't think this specification should be defining adopting steps for ShadowRoot. That should be directly done in the DOM Standard. Per class only one specification gets to define those after all. (That might mean HTML still needs to export something, but for a different reason.)

Ah I see, didn't know that before, thanks! If we do that, we need the DOM spec to reference adoptedStyleSheets (because that's cleared on adoption), so I guess updating the spec for this issue is blocked on moving this spec to CSSOM. @mfreed7, do you know what's the latest status on that?

Anyways, I think the impl part in Blink can move forward for now, unless Mozilla folks has other opinions on this. cc @emilio @nordzilla

from construct-stylesheets.

emilio avatar emilio commented on May 24, 2024

So to be clear the proposal is to only allow adopts from a document's own template-owner document right? Not between arbitrary template/document pairs.

If so I think that should be ok... Otherwise you could use something like this to effectively move stuff across documents.

templateFromDocumentA.content.appendChild(hostFromDocumentA);
documentB.appendChild(hostFromDocumentA);

But yeah it seems ok, I think. A bit of an odd special case to be fair...

from construct-stylesheets.

rakina avatar rakina commented on May 24, 2024

So to be clear the proposal is to only allow adopts from a document's own template-owner document right? Not between arbitrary template/document pairs.

Yep, exactly! It is quite an odd case, but I think not clearing is less surprising than clearing in this case so hopefully this is a good change.

from construct-stylesheets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.