Hi guys,

I've been developing small tool for em values (CSS) for quite time. To
cut unnecessary descriptions, go check it out on http://riddle.pl/emcalc/

Now, the problem lays in performance. Try adding 10 nodes, one under
another and notice that 8th, 9th, 10th (and further) addition works
terribly slow. I can nearly stall my whole Firefox by adding 15 nodes.

This problem came up after I had rewritten this tool to jQuery -
http://riddle.pl/emcalc/old/ - as you can see problem doesn't exist in
older version.

I tried profiling but the results Firebug gives me are really odd.
JS file is here: http://riddle.pl/emcalc/emcalc.js

There are two functions which are responsible for adding node. First
is event handling (addNode) for buttons, second is DOM creation
(createNode). I even rewrote createNode to use innerHTML, but the
result is the same.

I'd really like to ask you guys to take a closer look and tell me what
am I doing wrong. It's clear to me that after some point jQuery starts
to iterate on ancestor nodes and it takes centuries.

Thanks in advance.

Reply via email to