diff --git a/src/core.js b/src/core.js index ccb8d4cbe..b7b8f3b9b 100644 --- a/src/core.js +++ b/src/core.js @@ -198,18 +198,25 @@ $.extend( $.fn, { } } ); +// JQuery trim is deprecated, provide a trim method based on String.prototype.trim +var trim = function( str ) { + + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#Polyfill + return str.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "" ); +}; + // Custom selectors $.extend( $.expr.pseudos || $.expr[ ":" ], { // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support // https://jqueryvalidation.org/blank-selector/ blank: function( a ) { - return !$.trim( "" + $( a ).val() ); + return !trim( "" + $( a ).val() ); }, // https://jqueryvalidation.org/filled-selector/ filled: function( a ) { var val = $( a ).val(); - return val !== null && !!$.trim( "" + val ); + return val !== null && !!trim( "" + val ); }, // https://jqueryvalidation.org/unchecked-selector/
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: