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

RFC: What is expected when a root editable element's contents are completely removed via execCommand #455

Open
joanmarie opened this issue Oct 26, 2023 · 1 comment
Assignees

Comments

@joanmarie
Copy link

joanmarie commented Oct 26, 2023

Simple test case:

  1. Load data:text/html,<div contenteditable>foo</div>
  2. Give focus to the editable div
  3. Press Ctrl+A (or use selectAll execCommand)
  4. Press Del (or use delete execCommand)

Chromium results: <div contenteditable></div>
Gecko results: <div contenteditable><br></div>

Which of the above is correct and why?

I was hoping to find the answer in https://w3c.github.io/editing/docs/execCommand/#deleting-the-selection, but I'm not seeing it. Granted, that's a very long algorithm and I have an admittedly short attention span. 😇 Could a statement be added near the top or at the bottom that specifies when a br placeholder should and should not be present as a result of using the delete execCommand?

As for why I'm interested: I am trying to fix a number of issues in Chromium's contenteditable support. I have a local bug fix which breaks a bunch of Chromium (née WebKit) tests because now a br is present whereas before it was not. Using selectAll + delete is one such example. Should I be figuring out how to remove those brs which result from my change, or updating the test expectations to reflect corrected behavior?

@masayuki-nakano
Copy link
Collaborator

Before fixing https://bugzilla.mozilla.org/show_bug.cgi?id=1098151, the <br> was required to make the empty editing host visible. So, Firefox could stop inserting <br>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants