JS DOM tree implementation