Better handling for DOM node visibility. fixes #25