Re: [w3c/editing] Nested editing hosts do not need to be wrapped in insertParagraph (Issue #490)

gmta left a comment (w3c/editing#490)

> [@gmta](https://github.com/gmta) could you create a test case for your scenario? We tried to reproduce this during the meeting and got different results.

This is similar to the test case I used to write the fix for Ladybird:

```html
<!DOCTYPE html>
<div id="a" contenteditable>foo <div id="b" contenteditable>bar</div></div>
<pre id="output"></pre>
<script>
getSelection().setBaseAndExtent(b.firstChild, 0, b.firstChild, 1);
document.execCommand('insertParagraph');
output.append(a.outerHTML);
</script>
```

**FIrefox:**

```html
<div id="a" contenteditable="">foo <div id="b" contenteditable=""><br></div><div contenteditable="">ar</div></div>
```

**Chrome and Safari:**

```html
<div id="a" contenteditable="">foo <div id="b" contenteditable=""><br></div><div id="b" contenteditable="">ar</div></div>
<div id="a" contenteditable="">foo <div id="b" contenteditable=""><br></div><div id="b" contenteditable="">ar</div></div>
```

**Ladybird (pre-fix):**

```html
<div id="a" contenteditable="">foo <div id="b" contenteditable=""><div><br></div><div><div>ar</div></div></div></div>
```

**Ladybird (including ad-hoc change to "is editing host"):**

```html
<div id="a" contenteditable="">foo <div id="b" contenteditable=""><br></div><div contenteditable="">ar</div></div>
```

Note that this last output is identical to Firefox' output. Also note that Chrome and Safari seem to duplicate the `id` attribute, which arguably seems like worse behavior.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/490#issuecomment-3414537447
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/490/3414537447@github.com>

Received on Friday, 17 October 2025 09:05:31 UTC