Re: [whatwg/dom] Suggestion: `Node.insertAfter(newNode, referenceNode)` (#986)

@isiahmeadows thanks for clarifying, then maybe the proposal text should be updated ... but to be sure we're on the same page:

```html
<ul id="list">
  <li>first task</li>
  <!-- come comment -->
</ul>
```

Assuming a new item such as:

```js
const task = document.createElement('li');
task.textContent = 'last task';
```

### list.insertAfter(task, null)

would produce:
```html
<ul id="list">
  <li>first task</li>
  <!-- come comment -->
  <li>last task</li>
</ul>
```

while ...

### list.insertAfter(task, list.lastElementChild)

would produce:
```html
<ul id="list">
  <li>first task</li>
  <li>last task</li>
  <!-- come comment -->
</ul>
```

did I get it right?

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

Received on Monday, 14 June 2021 07:40:53 UTC