JSFiddle - React, Tailwind, and code Playground

HTML

<div id='one'>
    <div id='two'>
        <div id='twoOne'></div>
        <div id='twoTwo'></div>
    </div>
    <div id='three'></div>
</div>

JavaScript

Element.prototype.getElementById = function(req) {
    var elem = this, children = elem.childNodes, i, len, id;
 
    for (i = 0, len = children.length; i < len; i++) {
        elem = children[i];
        
        //we only want real elements
        if (elem.nodeType !== 1 )
            continue;

        id = elem.id || elem.getAttribute('id');
        
        if (id === req) {
            return elem;
        }
        //recursion ftw
        //find the correct element (or nothing) within the child node
        id = elem.getElementById(req);

        if (id)
            return id;
    }
    //no match found, return null
    return null;
}
    
console.log(document.getElementById('one').getElementById('three'));