RFC: What is expected when a root editable element's contents are completely removed via execCommand
@zcorpan is already working on this.
Since Sep 8, 2024.
- Dominant language
- HTML
- Stars
- 202
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
Simple test case:
- Load
data:text/html,<div contenteditable>foo</div> - Give focus to the editable
div - Press Ctrl+A (or use
selectAllexecCommand) - Press Del (or use
deleteexecCommand)
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.