Side navigation
#14979 closed bug (fixed)
Opened April 09, 2014 11:43AM UTC
Closed April 18, 2014 02:15PM UTC
Order of conditions causes unnecessary Reflow
Reported by: | ksmwsk@gmail.com | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.11.1/2.1.1 |
Component: | dimensions | Version: | 2.1.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When profiling a web application which features live resizing with its components i found a spot in the jQuery code causing unnecessary reflow.
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( [...]
if i change this so that the test for the display value will be the first one:
return rdisplayswap.test( jQuery.css( [...])) && elem.offsetWidth === 0
Now offsetWidth seems to take much more performance than retrieving the display property and testing it with the regexp.
If this will be confirmed as a valid issue, i would love to contribute this change via github.
Attachments (0)
Change History (4)
Changed April 10, 2014 03:01PM UTC by comment:1
component: | unfiled → dimensions |
---|---|
milestone: | None → 1.11.1/2.1.1 |
priority: | undecided → high |
status: | new → open |
Changed April 14, 2014 01:02PM UTC by comment:2
Okay i will add a pull request today.
Changed April 14, 2014 02:56PM UTC by comment:3
I added a pull request here:
Awesome, great catch! We'd love a pull request on this.