I've run up against this event binding limit.  If you have 1000 or so DOM
items to bind to event handlers, you will see the slowness, and/or get ye
olde "you have a long running script" browser alert.

One way around it is to use event delegation, but this has its plusses and
minuses as well.  In my case using inline events in this limited case worked
fine and I haven't had to revisit the issue since then.

-- Josh


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Eric Garside
Sent: Thursday, January 08, 2009 10:11 AM
To: jQuery (English)
Subject: [jQuery] Re: Correct way using Jquery


For the sake of maintainability and reuseability, inline events are a
poor decision if you're using a robust library such as jQuery. A lot
of the jQuery source code is aimed at traversing, manipulating, and
hooking the DOM events. Using jQuery and inline events is like buying
a ferrari and hooking it up to a horse to pull it.

Do you have an example of a large, complex page where jQuery is too
slow to list inline events? I've never even heard such an indictment
against event handling outside of the markup.

On Jan 8, 12:26 pm, Matt Kruse <[email protected]> wrote:
> On Jan 8, 9:17 am, Eric Garside <[email protected]> wrote:
>
> > And, never, ever use inline events.
>
> I disagree. I use them all the time, because it's too slow to attach
> them after page load using jQuery, especially on large, complex pages.
>
> Matt Kruse

Reply via email to