]> source.dussan.org Git - jquery.git/commitdiff
Core: Remove native String#trim usage to save size
authorMichał Gołębiowski <m.goleb@gmail.com>
Tue, 4 Mar 2014 22:15:12 +0000 (23:15 +0100)
committerMichał Gołębiowski <m.goleb@gmail.com>
Tue, 4 Mar 2014 22:15:30 +0000 (23:15 +0100)
(cherry-picked from 279913c71b63da721fa2f118cdce150effbf773e)

Fixes #14794

src/core.js
src/var/trim.js [deleted file]

index b07463ca138e4a82b23b003605d250670d6c84e8..f446ec30437f457ddb471b602d8ba98d1655dc15 100644 (file)
@@ -7,9 +7,8 @@ define([
        "./var/class2type",
        "./var/toString",
        "./var/hasOwn",
-       "./var/trim",
        "./var/support"
-], function( deletedIds, slice, concat, push, indexOf, class2type, toString, hasOwn, trim, support ) {
+], function( deletedIds, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
 
 var
        version = "@VERSION",
@@ -349,20 +348,11 @@ jQuery.extend({
        },
 
        // Support: Android<4.1, IE<9
-       // Use native String.trim function wherever possible
-       trim: trim && !trim.call("\uFEFF\xA0") ?
-               function( text ) {
-                       return text == null ?
-                               "" :
-                               trim.call( text );
-               } :
-
-               // Otherwise use our own trimming functionality
-               function( text ) {
-                       return text == null ?
-                               "" :
-                               ( text + "" ).replace( rtrim, "" );
-               },
+       trim: function( text ) {
+               return text == null ?
+                       "" :
+                       ( text + "" ).replace( rtrim, "" );
+       },
 
        // results is for internal usage only
        makeArray: function( arr, results ) {
diff --git a/src/var/trim.js b/src/var/trim.js
deleted file mode 100644 (file)
index 18f8356..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-define(function() {
-       return "".trim;
-});