JSFiddle - React, Tailwind, and code Playground

by Paulpro

HTML

<div class="bar">
    <div class="foo">
        <div class="bar">
            How will the browser know to select this div with the selector '.bar .foo .bar'?
        </div>
    </div>
</div>
<script>
    window.onload = function(){
        var x = $('.foo');
        console.log(x);
        console.log(x.selector) // '.foo .bar .foo'
    };
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
    var $ = function(){
        return arguments[0];
    };
    $ = (function($){
        return function(selector){
            return jQuery('.bar ' + selector + ' ' + $('.bar'));
        }
    })($);
</script>