Disappearing event handlers

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I have a table with click and dblclick handlers on each row. This works
well enough and on clicking or double-clicking the row, the expected
action takes place.

For the last version or two of Safari (I'm at 7.1.5 now), I'm observing
that for some rows, clicking/double-clicking has no effect. Using the
web inspector I found that the rows in question indeed have no
click/dblclick handlers.

Historically, I added the handlers by something like:

  rowPtr.onclick = myclickhandler;

but more recently I changed this to:

  rowPtr.addEventHandler ("click", myclickhandler, true);

either way the problem persists. The handlers are added as part of the
process of adding the row to the table.

With the earlier method of adding handlers I was able run some code on
a one-second timer to inspect the handlers for each row, write to the
console if the handlers were missing, and reinstate them. What I found
was that handlers were going AWOL at random, sometimes not at all for a
day or two, and then several at a time, perhaps repeatedly for a number
of seconds. This approach to debugging is unfortunately not possible
when using addEventHandler().

I'm minded to think of this as a Safari bug, as IIRC it seemed to start
after I'd updated to a newer version. Any suggestions as to how to look
deeper or debug more appreciated. I've tried getEventHandlers() in the
console but that's not told me a lot.

Only other (possibly) salient point is that for the most part the table
won't be part of the DOM (e.g. when rows are being added). I keep an
array of pointers to table bodies, and just switch in the one the user
wants to look at.

"People don't buy Microsoft for quality, they buy it for compatibility
with what Bob in accounting bought last year. Trace it back - they buy
Microsoft because the IBM Selectric didn't suck much" - P Seebach, afc

Site Timeline