[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml/ecma
From:       Maks Orlovich <maksim () kde ! org>
Date:       2008-08-25 23:00:18
Message-ID: 1219705218.046028.12907.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 852517 by orlovich:

Make sourceIndex work --- neither assert-fail in release builds, 
nor always return 0 on non-empty documents with debug builds,
nor loop infinitely on empty documents.


 M  +4 -4      kjs_dom.cpp  


--- branches/KDE/4.1/kdelibs/khtml/ecma/kjs_dom.cpp #852516:852517
@@ -335,11 +335,11 @@
     if (doc->isHTMLDocument()) {
       HTMLCollectionImpl all(doc, HTMLCollectionImpl::DOC_ALL);
       unsigned long i = 0;
-      DOM::NodeImpl* n = all.firstItem();
-      for ( ; !n && n != impl(); n = all.nextItem() )
+      for (DOM::NodeImpl* n = all.firstItem(); n; n = all.nextItem() ) {
+        if (n == impl())
+            return jsNumber(i);
         ++i;
-      Q_ASSERT( n ); // node not in document.all !?
-      return jsNumber(i);
+      }
     }
     return jsUndefined();
   }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic