You can test whether an element is a div or a span like this:
const div = document.createElement('div');
console.log(div instanceof HTMLDivElement);
const span = document.createElement('span');
console.log(span instanceof HTMLSpanElement);
This way of testing so far has worked for most HTML elements I'm aware of.
Unfortunately, the same approach of checking an element type is not available for section and article elements, which would mean I'd probably have to resort to el.tagName === 'SECTION' respectively el.tagName === 'ARTICLE'.
Edit: Just tested, the following globals all don't exist either:
HTMLNavElementHTMLHeaderElementHTMLMainElementHTMLAsideElementHTMLFooterElement
Does anyone know, and have any reference, as of why there are no HTMLSectionElement and HTMLArticleElement globals?
Is this because all of them are technically div elements with a different tag name to provide better semantics?