Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
2b5b4ebb
Commit
2b5b4ebb
authored
Aug 20, 2012
by
Wesley Walser
Committed by
Dave Methvin
Aug 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #12350. Remove BOM in jQuery.trim. Close gh-897.
parent
0fea007a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
AUTHORS.txt
AUTHORS.txt
+2
-1
core.js
src/core.js
+2
-2
core.js
test/unit/core.js
+6
-1
No files found.
AUTHORS.txt
View file @
2b5b4ebb
...
@@ -131,3 +131,4 @@ Chris Faulkner <thefaulkner@gmail.com>
...
@@ -131,3 +131,4 @@ Chris Faulkner <thefaulkner@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
Elijah Manor <elijah.manor@gmail.com>
Daniel Chatfield <chatfielddaniel@googlemail.com>
Daniel Chatfield <chatfielddaniel@googlemail.com>
Nikita Govorov <nikita.govorov@gmail.com>
Nikita Govorov <nikita.govorov@gmail.com>
Wesley Walser <wwalser@atlassian.com>
\ No newline at end of file
src/core.js
View file @
2b5b4ebb
...
@@ -37,8 +37,8 @@ var
...
@@ -37,8 +37,8 @@ var
core_rnotwhite
=
/
\S
/
,
core_rnotwhite
=
/
\S
/
,
core_rspace
=
/
\s
+/
,
core_rspace
=
/
\s
+/
,
// IE doesn't match
non-breaking space
s with \s
// IE doesn't match
many whitespace character
s with \s
rtrim
=
core_rnotwhite
.
test
(
"
\
xA0"
)
?
(
/^
[\s\x
A0
]
+|
[\s\x
A0
]
+$/g
)
:
/^
\s
+|
\s
+$/g
,
rtrim
=
core_rnotwhite
.
test
(
"
\
xA0"
)
?
/^
[\s\x
A0
\u
FEFF
]
+|
[\s\x
A0
\u
FEFF
]
+$/g
:
/^
\s
+|
\s
+$/g
,
// A simple way to check for HTML strings
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
...
...
test/unit/core.js
View file @
2b5b4ebb
...
@@ -264,7 +264,7 @@ test("noConflict", function() {
...
@@ -264,7 +264,7 @@ test("noConflict", function() {
});
});
test
(
"trim"
,
function
()
{
test
(
"trim"
,
function
()
{
expect
(
9
);
expect
(
13
);
var
nbsp
=
String
.
fromCharCode
(
160
);
var
nbsp
=
String
.
fromCharCode
(
160
);
...
@@ -278,6 +278,11 @@ test("trim", function() {
...
@@ -278,6 +278,11 @@ test("trim", function() {
equal
(
jQuery
.
trim
(
null
),
""
,
"Null"
);
equal
(
jQuery
.
trim
(
null
),
""
,
"Null"
);
equal
(
jQuery
.
trim
(
5
),
"5"
,
"Number"
);
equal
(
jQuery
.
trim
(
5
),
"5"
,
"Number"
);
equal
(
jQuery
.
trim
(
false
),
"false"
,
"Boolean"
);
equal
(
jQuery
.
trim
(
false
),
"false"
,
"Boolean"
);
equal
(
jQuery
.
trim
(
" "
),
""
,
"space should be trimmed"
);
equal
(
jQuery
.
trim
(
"ipad
\
xA0"
),
"ipad"
,
"nbsp should be trimmed"
);
equal
(
jQuery
.
trim
(
"
\
uFEFF"
),
""
,
"zwsp should be trimmed"
);
equal
(
jQuery
.
trim
(
"
\
uFEFF
\
xA0! |
\
uFEFF"
),
"! |"
,
"leading/trailing should be trimmed"
);
});
});
test
(
"type"
,
function
()
{
test
(
"type"
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment