Ticket #10644 (closed bug: worksforme)
jQuery performce issue in support function
| Reported by: | nkhanna@… | Owned by: | timmywil |
|---|---|---|---|
| Priority: | high | Milestone: | 1.next |
| Component: | support | Version: | 1.6.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
We are using jQuery 1.6.4 in few project at eBay and found that following line of code in jQuery.support takes around 100 ms in Firefox and IE:
support.boxModel = div.offsetWidth === 2;
if ( "zoom" in div.style ) { ...... }
Any suggestions how can this be improved or can it be fixed.
It is HTML5 page with <!DOCTYPE html>
Thanks Neeraj
Change History
comment:1 Changed 19 months ago by dmethvin
- Owner set to nkhanna@…
- Status changed from new to pending
comment:2 Changed 19 months ago by Neeraj Khanna <nkhanna@…>
We are using "dynatrace" to check the execution time for each function and this turned out to be one of the biggest issue on our page, total execution is about 280 ms and 100 ms accounts for just this one line.
comment:3 Changed 19 months ago by anonymous
Run dyntrace against http://r1test.ebay.com/sch/i.html?_nkw=nike for Firefox
comment:4 Changed 19 months ago by dmethvin
- Priority changed from undecided to high
- Status changed from pending to open
- Component changed from unfiled to support
- Milestone changed from None to 1.7.1
We'll look into this for 1.7.1, we were planning to do some work there anyway. Thanks!
comment:5 Changed 19 months ago by Neeraj Khanna <nkhanna@…>
Thanks,
What is timeline for 1.7? In the meanwhile can you suggest a patch to fix this?
comment:6 Changed 19 months ago by timmywil
For now, you could change the line to:
if ( typeof div.style.zoom !== "undefined ) {
but we'll be doing extensive performance testing of support.js in 1.7.1
comment:7 Changed 19 months ago by timmywil
- Owner changed from nkhanna@… to timmywil
- Status changed from open to assigned
comment:8 Changed 19 months ago by Neeraj Khanna <nkhanna@…>
I apologize if I was not clear in my ticket, problem is in this line:
support.boxModel = div.offsetWidth === 2;
not in zoom.
I found the following thread in stackoverflow discussing the same thing, but the reason mentioned doesn't apply to our case as we have doctype for HTML5 on the page.
http://stackoverflow.com/questions/6225664/jquery-div-offsetwidth-poor-perfomance
comment:9 Changed 19 months ago by timmywil
I'm not able to reproduce. http://jsfiddle.net/timmywil/nLxmG/6/show
comment:11 Changed 18 months ago by timmywil
- Status changed from assigned to closed
- Resolution set to worksforme
Closing until this issue can be reproduced. Support has already undergone some changes.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Interesting. How are you measuring the time it takes?