How to add an element after the opening body tag on an empty HTML page?

That’s my preferred way of doing it.
More verbose perhaps, but it lets the code do a bit more IMHO

Then there’s always

Node.removeChild(), Node.replaceChild(), Node.insertBefore(), Node.hasChildNodes()

which come in handy.

As for using the best Selector, it’s easier using a browser’s dev tools, but it still isn’t all that easy to get the “best” that hopefully will be future proof with any minor changes