Skip to content

Rendering components in other documents #331

@cristinecula

Description

@cristinecula

Hello!

First of all, thank you for releasing this project and the time that's been invested in it! I am amazed by it's pure awesomeness and I am sure it will spark a revolution in the frontend frameworks landscape!

I have started to use Svelte in a production app and I am very satisfied with it's capabilities and performance.

One of my app's requirements is to render bits of UI in dynamically created iframes, so they can be overlayed over a customer's website and not be affected by the existing css and scripts (I can't wait for native custom elements browser support!). The problem is that Svelte components use the global document for adding the css and this leads to missing styles in the iframe. Here is a repl demonstrating the behaviour:

https://svelte.technology/repl/?version=1.9.1&gist=55752a08defcbd1423e2a2029eb02ef7

I have already made a branch with some code partially fixing the problem: master...widgetic:feature/ownerDocument

There are actually two issues here:

  1. adding the css to the correct document (based on the target's ownerDocument) [fixed]
  2. adding the css to both documents if needed (the global addedCss flag is not fitting anymore) [not sure of best way to fix]

I would love to hear your thoughts about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions