Skip to content

Instantly share code, notes, and snippets.

@leocavalcante
Created June 29, 2012 19:42
Show Gist options
  • Save leocavalcante/3020215 to your computer and use it in GitHub Desktop.
Save leocavalcante/3020215 to your computer and use it in GitHub Desktop.
(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 ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment