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

> Are there benchmarks for this? @smaug---- @rniwa thoughts?

@annevk I don't have any benchmarks on the ready as this was years ago (though little's changed since). The main thing is C++ showing up high on profiles, and of course I want to avoid that. And `.insertAfter` is a bit simpler natively than in userland, or I'd use it:

```js
function insertAfter(parent, child, refNode) {
    parent.insertBefore(child, refNode != null ? refNode.nextSibling : null)
}
```

> It seems okay to add this assuming there is no web compatibility issue. It looks like there is at least [one (semi?) popular library](https://github.com/DmitryBaranovskiy/raphael) which implements `insertAfter` so someone needs to assess the web compatibility risk.

@rniwa [Not sure it's that significant of a risk when they also overwrite `Element#insertBefore` in exactly the same way.](https://github.com/DmitryBaranovskiy/raphael/blob/b5fdbdc9850827eb49622cd0bc81b26025f8128a/raphael.js#L6703-L6742)

-- 
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-860452656

Received on Monday, 14 June 2021 07:29:33 UTC