- From: Noam Rosenthal <notifications@github.com>
- Date: Thu, 11 Jul 2024 00:27:09 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/1255/2222227134@github.com>
> ### Alternative Suggestion to reparenting/reordering > I hop in here with a suggestion that would replace this but might make the implementation easier. > > Referencing my other [comment ](https://github.com/whatwg/html/issues/5484#issuecomment-1851327170) on another thread. Instead of reparenting and reordering elements, we allowed something like the `<slot>` element to work outside of shadow dom, or create a whole new element whos purpose is to "render" another element inside of itself just like the `<slot>` element does. And by [reassigning](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assign) the slot or moving around the slot names, we can "move" elements around in dom. > > We wont actually be moving the elements or effecting the dom three, Just render it in place of the `<slot>`. > > By doing this we wont need to change structure of dom elements or worry about states, three structure etc, since we never move the element just render it somewhere else. Thanks! We've actually a similar (or identical) suggestion internally. This requires the author to create a DOM structure especially to support this, e.g. put all the iframes and elements that need to preserve focus as children of the `body` element (or at the top level inside which they're supposed to be able to preserve focus) and then "ghost" them with slots in their actual DOM locations. Though this might be easier implementation-wise, I think it would create an effect where your DOM structure and your page diverge and it wouldn't be good for authors or the web... e.g. you'd have to account especially for styling (or use `::slotted? eek) and `document.querySelector` and would work totally different way. So I think there are good reasons to push for the direction we're going to which is a DOM operation, that wouldn't require people to make big (or any) adjustments to the semantic structure of their HTML. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1255#issuecomment-2222227134 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1255/2222227134@github.com>
Received on Thursday, 11 July 2024 07:27:14 UTC