why is nav being called before the dom