]> source.dussan.org Git - jquery.git/commitdiff
Deprecated: Remove jQuery.trim
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Mon, 18 May 2020 21:20:38 +0000 (23:20 +0200)
committerGitHub <noreply@github.com>
Mon, 18 May 2020 21:20:38 +0000 (23:20 +0200)
The API has been deprecated in 3.5.0 so it can be removed in 4.0.0.

Ref gh-4461
Closes gh-4695

src/deprecated.js
src/var/trim.js [deleted file]
test/unit/deprecated.js

index be19973216b7fde7dc5b158b69e32dab48a717e2..e58156f9ecc79fd72eb180d253baf6bad7aaea1f 100644 (file)
@@ -1,6 +1,5 @@
 import jQuery from "./core.js";
 import slice from "./var/slice.js";
-import trim from "./var/trim.js";
 
 import "./deprecated/ajax-event-alias.js";
 import "./deprecated/event.js";
@@ -43,7 +42,3 @@ jQuery.holdReady = function( hold ) {
                jQuery.ready( true );
        }
 };
-
-jQuery.trim = function( text ) {
-       return text == null ? "" : trim.call( text );
-};
diff --git a/src/var/trim.js b/src/var/trim.js
deleted file mode 100644 (file)
index 77d925f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-export default "".trim;
index 029b163e57137d99b845e5a402f0c15a8b84fd08..d6a15cd7e40d7f7840f85993eccbc64afe360c09 100644 (file)
@@ -199,25 +199,3 @@ QUnit[ jQuery.proxy ? "test" : "skip" ]( "jQuery.proxy", function( assert ) {
        cb = jQuery.proxy( fn, null, "arg1", "arg2" );
        cb.call( thisObject, "arg3" );
 } );
-
-QUnit[ jQuery.trim ? "test" : "skip" ]( "trim", function( assert ) {
-       assert.expect( 13 );
-
-       var nbsp = String.fromCharCode( 160 );
-
-       assert.equal( jQuery.trim( "hello  " ), "hello", "trailing space" );
-       assert.equal( jQuery.trim( "  hello" ), "hello", "leading space" );
-       assert.equal( jQuery.trim( "  hello   " ), "hello", "space on both sides" );
-       assert.equal( jQuery.trim( "  " + nbsp + "hello  " + nbsp + " " ), "hello", "&nbsp;" );
-
-       assert.equal( jQuery.trim(), "", "Nothing in." );
-       assert.equal( jQuery.trim( undefined ), "", "Undefined" );
-       assert.equal( jQuery.trim( null ), "", "Null" );
-       assert.equal( jQuery.trim( 5 ), "5", "Number" );
-       assert.equal( jQuery.trim( false ), "false", "Boolean" );
-
-       assert.equal( jQuery.trim( " " ), "", "space should be trimmed" );
-       assert.equal( jQuery.trim( "ipad\xA0" ), "ipad", "nbsp should be trimmed" );
-       assert.equal( jQuery.trim( "\uFEFF" ), "", "zwsp should be trimmed" );
-       assert.equal( jQuery.trim( "\uFEFF \xA0! | \uFEFF" ), "! |", "leading/trailing should be trimmed" );
-} );