The range::trim change looks like a duplication of range::optimize. Am I wrong? Other than that, the documentation added is not understandable. And finally, the verb "trim" means really "cut out", so it's expected to have text nodes split.

The changes at line 87 bring no benefit. They just make the code harder to read and longer.

The range::trim change looks like a duplication of range::optimize. Am I wrong? Other than that, the documentation added is not understandable. And finally, the verb "trim" means really "cut out", so it's expected to have text nodes split.