nl_tokens: RangeIterator code partially borrows from IERange by Tim Ryan ( http : // github . com / timcameronryan / IERange )
pl_tokens: function RangeIterator ( range , clonePartiallySelectedTextNodes ) { this . range = range ; this . clonePartiallySelectedTextNodes = clonePartiallySelectedTextNodes ; if ( ! range . collapsed ) { this . sc = range . startContainer ; this . so = range . startOffset ; this . ec = range . endContainer ; this . eo = range . endOffset ; var root = range . commonAncestorContainer ; if ( this . sc === this . ec && dom . isCharacterDataNode ( this . sc ) ) { this . isSingleCharacterDataNode = true ; this . _first = this . _last = this . _next = this . sc ; } else { this . _first = this . _next = ( this . sc === root && ! dom . isCharacterDataNode ( this . sc ) ) ? this . sc . childNodes [ this . so ] : dom . getClosestAncestorIn ( this . sc , root , <mask> ) ; this . _last = ( this . ec === root && ! dom . isCharacterDataNode ( this . ec ) ) ? this . ec . childNodes [ this . eo - 1 ] : dom . getClosestAncestorIn ( this . ec , root , true ) ; } } }