Imagine an empty div or span that JavaScript will use to add content, like this:
<div id='id'></div>
Technically, it's incorrect to have an empty element (I can't recall the exact reason). So we often use
<div id='id'> </div>
until JavaScript does its thing.
However, I'm not a fan of using because it doesn't really represent a space. Personally, I would prefer
<div id='id' />
but there are issues with self closing tags.
Are there any other solutions that I might be overlooking? Or is truly the best option?
It's important to note that this pertains to HTML documents and not necessarily how they are rendered by browsers. We simply prevent them from being rendered and then display them with JS.
Edit: Yes, having an empty div is semantically incorrect. It should contain some content to serve a purpose, otherwise it's pointless from a semantic viewpoint. According to Eric Meyer CSS Diagnostic. If my understanding is flawed, feel free to correct me.