No, I accept also text nodes if they are nonempty and the function goes up to its parentNode if there is no nextSibling.