JSFiddle - React, Tailwind, and code Playground

by Hans PUFAL

HTML

<div></div>
<div id="TWO"></div>

JavaScript

function getConstructorChain(obj, type) {
  var cs = [], pt = obj; do {if ((pt = Object.getPrototypeOf(pt)) cs.push(pt.constructor);}
  while (pt != null);
    return type == 'names' ? cs.map(function(c) {
        return c.toString().split(/\s|\(/)[1]
    }) : cs;
}
var d = document.querySelector('div');

console.log(getConstructorChain(d));
console.log(getConstructorChain(d, 'names'));