Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add src attribute to <template> to load a template from file #10571

Open
mildred opened this issue Aug 20, 2024 · 2 comments
Open

Add src attribute to <template> to load a template from file #10571

mildred opened this issue Aug 20, 2024 · 2 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@mildred
Copy link

mildred commented Aug 20, 2024

What problem are you trying to solve?

I'm trying to include the content of another page like <iframe seamless> once did, in a purely declarative form with javascript disabled. it was dropped because shadow DOM was there but it does not fullfill everything yet.

What solutions exist today?

None exists with the shadow DOM without javascript.

It's possible to emulate the <iframe seamless> using javascript to fill a template element with HTML code fetched from an HTTP request. and put it in a shadow DOM.

How would you solve it?

Something like this should be possible:

<custom-element>
  <template shadowrootmode="open" src="included/file.html"></template>
</custom-element>

Anything else?

links should be resolved relative the the included file. Any href or src attribute should have its links made relative to the location of the included/file.html

@mildred mildred added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Aug 20, 2024
@sashafirsov
Copy link

With

<template shadowrootmode="open" src="included/file.html"></template>

there is no need for <custom-element>. or reverse, with custom-element with src, there is no need for src on template level.

@mildred
Copy link
Author

mildred commented Aug 21, 2024

No need for custom-element, you're right unless the enclosing element contains DOM nodes, in which case those nodes would be moved to the slot inside the template I believe. It get something like the iframe, you need an element in between to avoid swallowing those elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

2 participants