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

fix(form): file upload fields trigger error using jquery > 3.4.0 #1950

Merged

Conversation

lubber-de
Copy link
Member

@lubber-de lubber-de commented Apr 18, 2021

Description

When a form contains a file upload field it is also bound to several form events which are not supposed to happen on those and do not work because flie upload fields are limited in access.

That said, when using jQuery > 3.4.0, it triggers a Maximum callstack exceeded instead

Testcase

  • Click on the "Upload image" Button and select something you like
  • Watch console

Broken

"maximum callstack exceeded"
https://jsfiddle.net/vzctb5pu/2/

Fixed

Nothing 🙂
https://jsfiddle.net/lubber/7f269p84/8/

Screenshot

Broken Fixed
formfilebroken formfilefixed

@lubber-de lubber-de added type/bug Any issue which is a bug or PR which fixes a bug lang/javascript Anything involving JavaScript state/awaiting-reviews Pull requests which are waiting for reviews labels Apr 18, 2021
@lubber-de lubber-de added this to the 2.8.8 milestone Apr 18, 2021
Copy link
Contributor

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@Yahav
Copy link

Yahav commented Apr 18, 2021

That was fast, thanks.

@lubber-de lubber-de changed the title [Form] File upload fields in forms trigger "maximum callstack exceeded" using jquery > 3.4.0 fix(form): file upload fields trigger error using jquery > 3.4.0 May 16, 2021
@lubber-de lubber-de merged commit fdc46e7 into fomantic:develop May 16, 2021
@lubber-de lubber-de deleted the fix/uploadFieldFormHandlerjqError branch May 16, 2021 13:22
@lubber-de lubber-de removed the state/awaiting-reviews Pull requests which are waiting for reviews label Jun 17, 2021
lubber-de added a commit that referenced this pull request Feb 26, 2023
This PR reverts #1950 as the cause of the original issue was related to the separate dirty events which were refactored before 2.8.8 was released.
I also added some checks for reset and set values as file inputs would otherwise return a js error as file input cannot be set any value other than an empty string.

Additionally this PR simplifies the input change event detection as we dont support older browsers than ie11 and avoid memory leaks when attachEvents behavior is used and the form gets detroyed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/javascript Anything involving JavaScript type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants