JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    some text
    <span> child <b> some bold</b> </span> some more text
</div>

JavaScript

// and because IE8 is a terrible browser:
// (implement our own version of .has)
jQuery.fn.originalHas = jQuery.fn.has;

if (jQuery.browser.msie && jQuery.browser.version == 8.0) {
    jQuery.fn.has = function(other_obj) {
        var result = [];

        if (false) {
            // if you want to call the original
            result = originalHas.apply(this, arguments);
        } else {
            var current = other_obj;
            console.log(current);
            $first_obj = current;
            while (current != document.body) {
                if (typeof(current) == "undefined"){
                    break;
                }
                if (current == this[0]) {
                    result.push(this[0]);
                    break;
                }
                console.log(current);
                current = jQuery(current).parent()[0];
            }


        }
        return result;


    };

}

var textNode = $("span")[0].childNodes[0];
var result = $(textNode.parentNode).has(textNode);
console.log(result);
console.log(result[0] == $(textNode.parentNode).originalHas(textNode)[0]);