I'm looking to (dynamically) obtain a list of HTML elements the browser is currently aware of, such as HTMLPreElement
, HTMLSpanElement
etc. These objects are global, i.e.
console.log('HTMLPreElement' in window); //=> true
So I thought I'd be able to use getOwnPropertyNames
like this:
console.log(Object.getOwnPropertyNames(window));
to obtain the full list of global properties (MDN states that this returns both enumerable and non-enumerable properties).
Using the above, I get an array with around 70 property nanes. But, it doesn't include objects like HTMLPreElement
- only HTMLElement
. I also tried:
console.log(Object.getOwnPropertyNames(window.Window.prototype));
which brings back a bigger list (including addEventListener
etc) but again, no HTMLPreElement
.
So, where the heck do these HTML{Tag}Element
objects reside?