- From: Justin Fagnani <notifications@github.com>
- Date: Tue, 06 Mar 2018 20:03:01 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 7 March 2018 04:03:25 UTC
@prlbr yes, but there are enough tricky questions about how this should be behave that it seems like we should see more user-space solution uptake in the wild. There's not so much that the browser can do here that can't be done with a very small script and `<template>`. I think if someone vended a library for this and it got uptake it might have a better chance of a comeback.
The code should be very simple, something along the lines of:
```js
for (const template of document.querySelectorAll('template[shadowroot]')) {
try {
const mode = template.getAttribute('shadowroot');
const root = template.parentElement.attachShadow({mode});
template.remove();
root.appendChild(document.adoptNode(template.content);
} catch (e) {
console.error(e);
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/510#issuecomment-371015679
Received on Wednesday, 7 March 2018 04:03:25 UTC