Follow-up to work done in #4304.

all_elements should ignore root as well.