SVN commit 788596 by porten: Take a shortcut if we reach the end of the range. Fixes an off-by-one bug found by Acid3 but the code looks like it can be simplified a lot. M +2 -0 dom2_rangeimpl.cpp --- branches/KDE/4.0/kdelibs/khtml/xml/dom2_rangeimpl.cpp #788595:788596 @@ -881,6 +881,8 @@ } while(n) { + if(n == m_endContainer && m_endOffset == 0) + break; if(n->nodeType() == DOM::Node::TEXT_NODE || n->nodeType() == DOM::Node::CDATA_SECTION_NODE) {