nextNode call nodeAfter; if this returns null, it nextNode returns the container. As you said, we should avoid return null as much as we can.

Shouldn't nodeAfter check for parents Siblings?