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
Core: Fixes deprecated calls to jQuery trim. Fixes #2327 #2328
Core: Fixes deprecated calls to jQuery trim. Fixes #2327 #2328
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
src/core.js
Outdated
@@ -1,3 +1,12 @@ | |||
// JQuery trim is deprecated, polyfill native js method if not defined | |||
if ( !String.prototype.trim ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not pollute the prototype of builtin objects. Please instead create a local trim-function instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/core.js
Outdated
@@ -1,3 +1,10 @@ | |||
// JQuery trim is deprecated, provide a trim method based on String.prototype.trim | |||
function trim( str ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the function into a local variable and move it down to the functions where it is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm - thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks.
@Arkni could you take care of merging this and tagging a new release? |
@staabm, I will try my best doing it this night or tomorrow. |
My machine is behaving strangely and I couldn't run Thank you and sorry for the inconvenience. |
trying to do a release now |
Thanks a lot @staabm for the release :) (And sorry for not being active. I'm still in a long pause from a lot of things including open source. It may take me a few more months to be able to help triaging issues or review PRs the way I used to.) |
@Arkni no worries. Take your time - there are a lot of things which are more important then this project. Best wishes |
This doesn't resolve all deprecations. Will send another PR |
Created #2335 |
Hi...i'am using jquery -v3.5.1 and jquery.validate -v1.9.2 My code is it gives error When i was on older version jquey -v2.1.4 then it was working fine but now not working with jquey- v3.5.1 Please give some solution on it. |
@Tandulje please open a new issue, this is nothing to do with this PR |
This fixes the issue with deprecation and adds the polyfill for
String.prototype.trim
for browser support.