Re: [whatwg/dom] Atomic move operation for element reparenting & reordering (Issue #1255)

> 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.

Yeah, i agree with this that having the DOM operation api would be quite nice to work with indeed.  I would really love to be able to reorder and reparent elements without their internal states being lost.

About the `::slotted` styling, we could just treat the slotted component as a normal component so if the slotted component is a `<p>` element, then the normal styling the slot parent element has for paragraphs should work for that as well (or a flag/attribute to enable this for that slot)?

About the change to semantic structure of HTML changing, i at the moment don't have any ideas that would cover this, except recommending that placing the to be slotted elements as close as possible to the place where we use our slots in context with our use case.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1255#issuecomment-2222294098
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1255/2222294098@github.com>

Received on Thursday, 11 July 2024 08:05:43 UTC