mirror of
https://github.com/jquery/jquery.git
synced 2026-02-17 03:11:28 -05:00
Fix #12350: jQuery.trim should remove BOM
This commit is contained in:
committed by
Dave Methvin
parent
465959e75c
commit
9e246dd7fa
@@ -37,8 +37,8 @@ var
|
||||
core_rnotwhite = /\S/,
|
||||
core_rspace = /\s+/,
|
||||
|
||||
// IE doesn't match non-breaking spaces with \s
|
||||
rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g,
|
||||
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
|
||||
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
||||
|
||||
// A simple way to check for HTML strings
|
||||
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
||||
@@ -605,7 +605,7 @@ jQuery.extend({
|
||||
},
|
||||
|
||||
// Use native String.trim function wherever possible
|
||||
trim: core_trim ?
|
||||
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
|
||||
function( text ) {
|
||||
return text == null ?
|
||||
"" :
|
||||
|
||||
Reference in New Issue
Block a user