JSFiddle - React, Tailwind, and code Playground

by Leo Cavalcante

HTML

<div id="foo">
    <p id="bar">
        <a id="baz"></a>
    </p>
</div>
<div id="qunit"></div>

CSS

@import url( https://raw.github.com/jquery/qunit/master/qunit/qunit.css );

JavaScript

(function ( context, undefined ) {
    function instance ( node ) {
        if ( node.id && !global[node.id] )
            global[node.id] = node;
        if ( node.children.length )
            for ( var i = 0, l = node.children.length ; i < l ; i++ )
                instance( node.children[i] );
    }( context );
} ( document.body ));

//

test( 'instanced', function () {
    var foo = document.getElementById( 'foo' ),
        _bar = document.getElementById( 'bar' ),
        baz = document.getElementById( 'baz' );
    ok( foo === window.foo, 'works!' );
    ok( _bar === bar, 'works!' );
    ok( baz === window['baz'], 'works!' );
});