Side navigation
#12683 closed bug (cantfix)
Opened October 09, 2012 09:50AM UTC
Closed October 15, 2012 04:45PM UTC
Unexpected style invalidation in select (performance issue)
Reported by: | matt.nathan@gmail.com | Owned by: | matt.nathan@gmail.com |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | selector | Version: | 1.8.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery 1.8.2, Chrome Version 24.0.1284.2 dev, Linux CentOS 6 (haven't checked any other envs)
When executing the find method the style is invalidated due to the setting of an id on the root element.
// our root element var root = $("ul"); // here is where the style is invalidated due to root having an id set root.find(">li");
The find method eventually ends up in the select method which calls context.setAttribute("id", ...) which is the point that the style is invalidated.
This can cause performance problems due to repeated invalidation/revalidation cycles in some applications.
One workaround for the issue is to make sure that the root element has an id.
Attachments (0)
Change History (3)
Changed October 09, 2012 01:03PM UTC by comment:1
owner: | → matt.nathan@gmail.com |
---|---|
status: | new → pending |
Changed October 10, 2012 10:54AM UTC by comment:2
OK, here is the jsfiddle: http://jsfiddle.net/grvwm/1/
Unfortunately I don't know of a way to check in javascript that a style invalidation/recalculation was done so you will have to look at this information in a profiling tool. I'm using the Timeline tab in Chrome dev tools.
I've included docs of how to check this in the jsfiddle linked above.
Changed October 15, 2012 04:45PM UTC by comment:3
component: | unfiled → selector |
---|---|
resolution: | → cantfix |
status: | pending → closed |
Thank you for creating a test case. I don't think we can fix this because that ID attachment hack is necessary. However, it has been present for a long time so there should be no regression.
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.