views:

35

answers:

1

I've got a single mousedown event handler on a table with dynamically increasing number of rows (right now over thousand, in perspective should have been unlimited) and I observe a drop down in performance as the number of preloaded rows increases. The purpose of event handler is simple - figure out which row was clicked and highlight it.

I do not know exactly what causes the slowdown and I'm not sure if it's event handler. I just wonder if number of child elements that could trigger mousedown bubble can affect the performance of an event handler attached to single parent element?

Update: I came up with simple example here: http://client.infinity-8.me/table.php?num=1000 (you can pass whatever number you want to num), basically it renders a table with num rows and has a single event handler attached to a parent table. I should conclude from this, that there actually is no noticeable dropdown in performance, caused by number of child elements.

+2  A: 

In theory it shouldn't. Only deepness should matter, since bubbling goes up by checking handlers on every level (one per level).

It performs great with 10 000 elements even on IE6.

See it in action.

galambalazs
Yeah, I saw that :(
jayarjo
+1 for running a test case.
George Marian
I always do. :)
galambalazs