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

DOM state-preserving move #976

Closed
1 task done
noamr opened this issue Jul 23, 2024 · 2 comments
Closed
1 task done

DOM state-preserving move #976

noamr opened this issue Jul 23, 2024 · 2 comments
Assignees
Labels
Focus: API design (pending) Focus: Web architecture (pending) Mode: breakout Work done during a time-limited breakout session Resolution: satisfied with concerns The TAG is satisfied with this work overall but requires changes Topic: DOM About or relating to the Document Object Model Venue: WHATWG

Comments

@noamr
Copy link

noamr commented Jul 23, 2024

こんにちは TAG-さん!

I'm requesting a TAG review of DOM state-preserving move.

This is a feature that allows moving elements around the DOM without their state being reset as a result (e.g. iframes won't reload if moved in this manner)

Further details:

  • I have reviewed the TAG's Web Platform Design Principles
  • Relevant time constraints or deadlines: N/a
  • The group where the work on this specification is currently being done: WHATWG
  • The group where standardization of this work is intended to be done (if current group is a community group or other incubation venue): WHATWG
  • Major unresolved issues with or opposition to this specification:
  • This work is being funded by: Google

You should also know that...
A lot of work on this was already done in the WHATWG context, however there is still time until anything is shipped. So this is a good time to also get some input from TAG!
.

@LeaVerou LeaVerou self-assigned this Jul 23, 2024
@jyasskin jyasskin added Progress: propose closing we think it should be closed but are waiting on some feedback or consensus and removed Progress: awaiting consensus labels Sep 18, 2024
@jyasskin
Copy link
Contributor

We consider it a mistake in the platform that element movement is handled by removing and then re-inserting nodes. We would prefer if this effort fixed the existing methods rather than adding new methods. Could the designers invest in some more thorough testing to see if this breaks a significant number of pages, rather than just assuming that it will? If changing all of the element-movement methods does break things, perhaps it would be compatible to change only the newer ones that are methods on ParentNode and ChildNode. In that case, we think the slight inconsistency between, e.g., append() and appendChild() is worth the more intuitive behavior on the newer method.

Thank you for bringing this to us. The WHATWG discussion seems like the right place to dig into the compatibility question, so we're happy to let them take it from here.

@jyasskin jyasskin added Resolution: satisfied with concerns The TAG is satisfied with this work overall but requires changes and removed Progress: propose closing we think it should be closed but are waiting on some feedback or consensus labels Sep 18, 2024
aarongable pushed a commit to chromium/chromium that referenced this issue Sep 19, 2024
With this flag (AtomicMoveAuto) on, the following Node methods behave
like moveBefore in terms of preserving state:

Node.before
Node.after
Node.prepend
Node.append

Based on this comment from TAG review: w3ctag/design-reviews#976 (comment)

This allows us to test if changing the behavior of these functions
breaks something for existing sites.

Copied the existing WPTs for moveBefore, and refurbished them to use
the existing APIs using variants.


Bug: 367985626
Change-Id: I1fe5ff063bc11a7d91622ad76ff19db4d6f7ae0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5873233
Reviewed-by: Dominic Farolino <[email protected]>
Commit-Queue: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1357837}
aarongable pushed a commit to chromium/chromium that referenced this issue Sep 23, 2024
With this flag (AtomicMoveAuto) on, the following Node methods behave
like moveBefore in terms of preserving state:

Node.before
Node.after
Node.prepend
Node.append

Based on this comment from TAG review: w3ctag/design-reviews#976 (comment)

This allows us to test if changing the behavior of these functions
breaks something for existing sites.

Copied the existing WPTs for moveBefore, and refurbished them to use
the existing APIs using variants.


(cherry picked from commit 083da4a)

Bug: 367985626
Change-Id: I1fe5ff063bc11a7d91622ad76ff19db4d6f7ae0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5873233
Reviewed-by: Dominic Farolino <[email protected]>
Commit-Queue: Noam Rosenthal <[email protected]>
Cr-Original-Commit-Position: refs/heads/main@{#1357837}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5874055
Commit-Queue: Dominic Farolino <[email protected]>
Auto-Submit: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/branch-heads/6723@{#268}
Cr-Branched-From: 985f296-refs/heads/main@{#1356013}
@jyasskin
Copy link
Contributor

This review was discussed at TPAC 2024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus: API design (pending) Focus: Web architecture (pending) Mode: breakout Work done during a time-limited breakout session Resolution: satisfied with concerns The TAG is satisfied with this work overall but requires changes Topic: DOM About or relating to the Document Object Model Venue: WHATWG
Projects
None yet
Development

No branches or pull requests

3 participants