Core: Remove native String#trim usage to save size

(cherry-picked from 279913c7)

Fixes #14794
parent b96522ac
...@@ -7,9 +7,8 @@ define([ ...@@ -7,9 +7,8 @@ define([
"./var/class2type", "./var/class2type",
"./var/toString", "./var/toString",
"./var/hasOwn", "./var/hasOwn",
"./var/trim",
"./var/support" "./var/support"
], function( deletedIds, slice, concat, push, indexOf, class2type, toString, hasOwn, trim, support ) { ], function( deletedIds, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
var var
version = "@VERSION", version = "@VERSION",
...@@ -349,20 +348,11 @@ jQuery.extend({ ...@@ -349,20 +348,11 @@ jQuery.extend({
}, },
// Support: Android<4.1, IE<9 // Support: Android<4.1, IE<9
// Use native String.trim function wherever possible trim: function( text ) {
trim: trim && !trim.call("\uFEFF\xA0") ? return text == null ?
function( text ) { "" :
return text == null ? ( text + "" ).replace( rtrim, "" );
"" : },
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only // results is for internal usage only
makeArray: function( arr, results ) { makeArray: function( arr, results ) {
......
define(function() {
return "".trim;
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment