Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove patched logic from jQuery 3.4.1 #29846

Closed
jennifer-shehane opened this issue Jul 12, 2024 · 1 comment
Closed

Remove patched logic from jQuery 3.4.1 #29846

jennifer-shehane opened this issue Jul 12, 2024 · 1 comment
Assignees
Labels
Cypress 14 Issues scoped for Cypress 14 type: breaking change Requires a new major release version

Comments

@jennifer-shehane
Copy link
Member

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.

// 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.

Screenshot 2024-07-11 at 9 43 38 AM

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

@jennifer-shehane jennifer-shehane added the type: breaking change Requires a new major release version label Jul 12, 2024
@jennifer-shehane jennifer-shehane added the Cypress 14 Issues scoped for Cypress 14 label Sep 27, 2024
@jennifer-shehane jennifer-shehane self-assigned this Sep 27, 2024
@jennifer-shehane 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 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
@jennifer-shehane
Copy link
Member Author

Closing as we don't actually want to do this as explained here: #30345 (comment)

@jennifer-shehane jennifer-shehane closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cypress 14 Issues scoped for Cypress 14 type: breaking change Requires a new major release version
Projects
None yet
Development

No branches or pull requests

1 participant