Skip to content

Commit ac043b1

Browse files
committed
Revert "Fix #12350. Remove BOM in jQuery.trim. Close jquerygh-897."
This reverts commit 2b5b4eb. String.prototype.trim doesn't trim BOM in Safari 5.0 so this won't work without additional feature detects. http://swarm.jquery.org/result/165379
1 parent 0f553ed commit ac043b1

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

AUTHORS.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,4 @@ Uri Gilad <antishok@gmail.com>
130130
Chris Faulkner <thefaulkner@gmail.com>
131131
Elijah Manor <elijah.manor@gmail.com>
132132
Daniel Chatfield <chatfielddaniel@googlemail.com>
133-
Nikita Govorov <nikita.govorov@gmail.com>
134-
Wesley Walser <wwalser@atlassian.com>
133+
Nikita Govorov <nikita.govorov@gmail.com>

src/core.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ var
3737
core_rnotwhite = /\S/,
3838
core_rspace = /\s+/,
3939

40-
// IE doesn't match many whitespace characters with \s
41-
rtrim = core_rnotwhite.test("\xA0") ? /^[\s\xA0\uFEFF]+|[\s\xA0\uFEFF]+$/g : /^\s+|\s+$/g,
40+
// IE doesn't match non-breaking spaces with \s
41+
rtrim = core_rnotwhite.test("\xA0") ? (/^[\s\xA0]+|[\s\xA0]+$/g) : /^\s+|\s+$/g,
4242

4343
// A simple way to check for HTML strings
4444
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)

test/unit/core.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ test("noConflict", function() {
264264
});
265265

266266
test("trim", function() {
267-
expect(13);
267+
expect(9);
268268

269269
var nbsp = String.fromCharCode(160);
270270

@@ -278,11 +278,6 @@ test("trim", function() {
278278
equal( jQuery.trim( null ), "", "Null" );
279279
equal( jQuery.trim( 5 ), "5", "Number" );
280280
equal( jQuery.trim( false ), "false", "Boolean" );
281-
282-
equal( jQuery.trim(" "), "", "space should be trimmed" );
283-
equal( jQuery.trim("ipad\xA0"), "ipad", "nbsp should be trimmed" );
284-
equal( jQuery.trim("\uFEFF"), "", "zwsp should be trimmed" );
285-
equal( jQuery.trim("\uFEFF \xA0! | \uFEFF"), "! |", "leading/trailing should be trimmed" );
286281
});
287282

288283
test("type", function() {

0 commit comments

Comments
 (0)