Order of conditions causes unnecessary Reflow
|Reported by:||ksmwsk@…||Owned by:|
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.
Change History (4)
comment:1 Changed 3 years ago by dmethvin
- Component changed from unfiled to dimensions
- Milestone changed from None to 1.11.1/2.1.1
- Priority changed from undecided to high
- Status changed from new to open