mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Switch to using String.prototype.trim from String.trim as it's more-widely available.
This commit is contained in:
parent
da26d0eb4e
commit
ba8938d444
@ -53,6 +53,7 @@ var jQuery = function( selector, context ) {
|
|||||||
hasOwn = Object.prototype.hasOwnProperty,
|
hasOwn = Object.prototype.hasOwnProperty,
|
||||||
push = Array.prototype.push,
|
push = Array.prototype.push,
|
||||||
slice = Array.prototype.slice,
|
slice = Array.prototype.slice,
|
||||||
|
trim = String.prototype.trim,
|
||||||
indexOf = Array.prototype.indexOf;
|
indexOf = Array.prototype.indexOf;
|
||||||
|
|
||||||
jQuery.fn = jQuery.prototype = {
|
jQuery.fn = jQuery.prototype = {
|
||||||
@ -569,11 +570,11 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Use native String.trim function wherever possible
|
// Use native String.trim function wherever possible
|
||||||
trim: String.trim ?
|
trim: trim ?
|
||||||
function( text ) {
|
function( text ) {
|
||||||
return text == null ?
|
return text == null ?
|
||||||
"" :
|
"" :
|
||||||
String.trim( text );
|
trim.call( text );
|
||||||
} :
|
} :
|
||||||
|
|
||||||
// Otherwise use our own trimming functionality
|
// Otherwise use our own trimming functionality
|
||||||
|
Loading…
Reference in New Issue
Block a user