I\'m looking to (dynamically) obtain a list of HTML elements the browser is currently aware of, such as HTMLPreElement
, HTMLSpanElement
etc. These
for (var prop in window)
console.log(prop);
That's what you need?
In Firefox, it seems to be the behavior of elements that their global object is not added unless explicitly requested as a global variable or property. Perhaps Firefox lazy loads them into the environment so that they don't consume memory unless they're actually needed.
It seems that they do not show up when simply requesting the keys of the global object via Object.getOwnPropertyNames
unless they've first been explicitly referenced as described above.
http://jsfiddle.net/mBAHm/
var obj = window;
while(obj){
for(let prop of Reflect.ownKeys(obj)){
console.log(prop);
};
obj = Object.getPrototypeOf(obj);
};