You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the upgrade of jQuery to 3.2.0+ in #29837, we needed to patch some of the jQuery 3.2+ logic on how they calculate height/width of elements in order to not introduce a breaking change.
We should remove this patched logic in a breaking change version of Cypress in order to have the more correct height/width calculations.
Additional Details
In jQuery 3.2.0 a change was introduced and further iterated on with the calculation of .width() and .height(). Previously .width() and .height() would return the width and height of elements including scrollbars. In jQuery 3.2.0, they updated these methods to more closely match the CSS box model by returning the width and height excluding the scrollbars.
This would introduce a breaking change to users using the Cypress.$ API.
// jQuery 3.1.1 would pass, but in 3.2.0 it would equal 85 (minus scrollbars)expect(Cypress.$('#scroll-to-both').height()).to.equal(100)
Additionally this change in width/height calculation changes our 'scrollTo' behavior since that relies on the width/height calculated by jQuery.
While technically the height/width calculations and scrollTo behavior are more correct, we don't want to introduce breaking changes in a non-breaking change release. Consequently, I have patched jQuery 3.4.1 to overwrite the height/width getters to use the old calculations. This could result in some confusion with jQuery.height and jQuery.width returning different results than Cypress, but I guess that's already the case today and no one has raised that.
Why is this needed?
No response
Other
No response
The text was updated successfully, but these errors were encountered:
jennifer-shehane
changed the title
Remove patched logic from jQuery 3.4.1 around width and height calculation.
Remove unload patched logic from jQuery 3.4.1 + update jQuery
Oct 8, 2024
jennifer-shehane
changed the title
Remove unload patched logic from jQuery 3.4.1 + update jQuery
Remove patched logic from jQuery 3.4.1
Oct 8, 2024
What would you like?
With the upgrade of jQuery to 3.2.0+ in #29837, we needed to patch some of the jQuery 3.2+ logic on how they calculate height/width of elements in order to not introduce a breaking change.
We should remove this patched logic in a breaking change version of Cypress in order to have the more correct height/width calculations.
Additional Details
In jQuery 3.2.0 a change was introduced and further iterated on with the calculation of
.width()
and.height()
. Previously.width()
and.height()
would return the width and height of elements including scrollbars. In jQuery 3.2.0, they updated these methods to more closely match the CSS box model by returning the width and height excluding the scrollbars.This would introduce a breaking change to users using the
Cypress.$
API.Additionally this change in width/height calculation changes our 'scrollTo' behavior since that relies on the width/height calculated by jQuery.
While technically the height/width calculations and scrollTo behavior are more correct, we don't want to introduce breaking changes in a non-breaking change release. Consequently, I have patched jQuery 3.4.1 to overwrite the height/width getters to use the old calculations. This could result in some confusion with jQuery.height and jQuery.width returning different results than Cypress, but I guess that's already the case today and no one has raised that.
Why is this needed?
No response
Other
No response
The text was updated successfully, but these errors were encountered: