2

I've got a huge table (like a few thousand rows), and when I click a row, I do something simple like changing the color of the row. The problem is, when I click a row, it takes a really long time (1 second) to change the color. I see this in Chrome and Safari. But when I try it in Firefox or Opera, it's supersnappy.

I thought event delegation (instead of binding an event listener to each row, a parent div takes care of all events) would fix it, but no, it remains te same.

Any help?

Arthur C
  • 1,274
  • 1
  • 14
  • 34
  • 1
    It would help if we could see some code. You are right in thinking that delegating the event handler should help though. – James Allardice Jun 21 '12 at 15:16
  • Maybe it's just the rendering engine that's making the difference. – acme Jun 21 '12 at 15:22
  • [Repaints](http://www.stubbornella.org/content/2009/03/27/reflows-repaints-css-performance-making-your-javascript-slow/) and how to [benchmark/test](http://davidwalsh.name/browser-repaint) them as this could be the reason of this phenomenon – Andreas Jun 21 '12 at 15:49
  • You're right. It's the repainting, which is especially slow with tables. The problem is it can't be done without a table :(. So I guess there's no solution? Thanks anyway! – Arthur C Jun 25 '12 at 09:21

0 Answers0