Alessandro,

>I have a page with about 12000 links in it. A few of these links point
>to anchors on the same page. A function should be called when those
>"intra page" links are clicked.

The bottom line is anything you do to parse 12,000 DOM objects on the same
page is going to be slow--even more so if each link would reside inside one
or more other elements. 

While not unobtrusive, you'd be better off generated that content w/embedded
onclick events. You can still minimize the obtrusiveness of your code by
doing something like:

<a href="url.htm" onclick="return clickHandler(this);">link</a>

function clickHandler(el){
        // do whatever you want w/the element reference
        alert(el.href);
        // prevent the href from happening
        return false;
}

This seriously goes against the jQuery philosophy, but DOM parsing is just
sluggish when you have thousands of elements.

With all that said, I can't ever imagine why I'd need a page w/12,000 links
on it. It sure seems like you'd be better served by generated links
on-demand.

-Dan

Reply via email to