diff options
author | Shashanka Nataraj <ShashankaNataraj@users.noreply.github.com> | 2019-08-22 05:36:26 +0530 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-09-26 01:00:55 +0200 |
commit | 56e73e0c4ae908c853c986aadeda7cfcf2df4f6f (patch) | |
tree | 6f6aaa33b8fa94c0cfdc827431a64d7d569ec7d7 /src/deprecated.js | |
parent | 2f666c1daba43d26d77d9500db09d528bf66fac8 (diff) | |
download | jquery-56e73e0c4ae908c853c986aadeda7cfcf2df4f6f.tar.gz jquery-56e73e0c4ae908c853c986aadeda7cfcf2df4f6f.zip |
Core: Deprecate jQuery.trim
Fixes gh-4363
Closes gh-4461
(cherry picked from 5ea5946094784f68437ef26d463dfcfbbbaff1f6)
Diffstat (limited to 'src/deprecated.js')
-rw-r--r-- | src/deprecated.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/deprecated.js b/src/deprecated.js index c11b0d332..141f99462 100644 --- a/src/deprecated.js +++ b/src/deprecated.js @@ -12,6 +12,10 @@ define( [ "use strict"; +// Support: Android <=4.0 only +// Make sure we trim BOM and NBSP +var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; + jQuery.fn.extend( { bind: function( types, data, fn ) { @@ -95,4 +99,9 @@ jQuery.isNumeric = function( obj ) { !isNaN( obj - parseFloat( obj ) ); }; +jQuery.trim = function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); +}; } ); |