Why not just do: function addEvent(obj, evt, fn){ jQuery(obj).bind(evt, fn); }
Just defer everything to jQuery! --John On Mon, Jan 19, 2009 at 2:48 AM, rundmw <run...@gmail.com> wrote: > > I have an existing application which I would like to transition to use > jQuery. The app currently uses Dean Edwards addEvent() function in > many (many!) locations, mostly as addEvent(window, 'load', fn). In all > of these cases, wndow.onload is not strictly required; document.ready > () would not only suffice, but be a significant improvement. > > Rather than chase all the references in the app to addEvent(), it > would be desirable to replace the Dean Edwards implementation with > something like the following: > > function addEvent(obj, evt, fn){ > if (obj == window && evt = 'load'){ > // use document onready > } else { > use the original addEvent code > } > } > > Does this seem reasonable? Any suggestions on the precise syntax? > > [ I'm not a noob, per se, but I do confess that sometimes the jQuery > codebase ventures a bit over my head, getting a bit confusing with > issues of binding, with IE memory leaks, etc. So I apologize in > advance for the somewhat vague and possibly trivial nature of the > request. ] > > Any ideas would be greatly appreciated. > > Thanks and best regards, >