Skip to main content

Bug Tracker

Side navigation

#3471 closed enhancement (wontfix)

Opened October 12, 2008 03:58PM UTC

Closed October 13, 2008 01:01AM UTC

Performance suggestion on selector

Reported by: sandstrom Owned by:
Priority: trivial Milestone: 1.3
Component: selector Version: 1.2.6
Keywords: performance, selector, Cc:
Blocked by: Blocking:
Description

It's common to set the id of body to something page-specific (eg. body id="unique" or id="controller-action" in an MVC setup). Thus one can easily target code to specific pages.

Example: $('body#login-email input#specific').focus();

I don't know if it would be a performance benefit, perhaps it would be an idea to have jquery return (cancel) queries through the dom when the id is set for a body element, and there is nothing on the body element. So instead or parsing several hundred dom nodes one would go straight for the body, and if it's not there one can abort.

Attachments (0)
Change History (1)

Changed October 13, 2008 01:01AM UTC by scott.gonzal comment:1

resolution: → wontfix
status: newclosed

This doesn't scale to other elements besides the body and it doesn't make sense to add in extra checks just for this special case. Why not just wrap all your code in a check?

if ($('body').is('#something')) {
    // page-specific code
}