document.body.innerHTML regression

David Faure faure at kde.org
Wed Mar 9 13:36:29 GMT 2005


On Tuesday 02 December 2003 21:05, ismail 'cartman' dönmez wrote:
> Hi,
> 
> Open kdelibs/khtml/ecma/jsk.html in konqi enter document.body.innerHTML in 
> "Expression" field and then press "list properties". Now konqi freezes then 
> warns that a script is eating too much cpu.

Works here, without KJS_VERBOSE.

With it enabled, well, it does take a long time indeed. There are 2000 properties to list,
and every time, the textarea's value is set, and the value is printed out.
A fix is to fix the JS code to avoid touching the widget so often :)

--- jsk.html    23 Jun 2003 20:04:41 -0000      1.2
+++ jsk.html    9 Mar 2005 13:35:34 -0000
@@ -39,6 +39,7 @@ function do_properties() {
        var result = eval(expr);
         var i;
        fo.restyp.value = typeof(result);
+       var fieldvalue = "";
         if (typeof(result) != "undefined") {
            for (i in result) {
                 var tuedel = "";
@@ -46,12 +47,12 @@ function do_properties() {
                 if (typeof(propval) == "string") {
                         tuedel = '"';
                 }
-                fo.field.value +=
+                fieldvalue +=
                         i
                         + " [" + typeof(propval) + "] = "
                         + tuedel + propval + tuedel + "\n";
            }
-
+           fo.field.value = fieldvalue;
         }
 }

:)

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kfm-devel mailing list