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
26bdbb80
Commit
26bdbb80
authored
Jun 21, 2012
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do jQuery.trim in less bytes (-5).
parent
e2497c68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
core.js
src/core.js
+4
-9
No files found.
src/core.js
View file @
26bdbb80
...
...
@@ -36,8 +36,9 @@ var
// Used for detecting and trimming whitespace
core_rnotwhite
=
/
\S
/
,
core_rspace
=
/
\s
+/
,
trimLeft
=
/^
\s
+/
,
trimRight
=
/
\s
+$/
,
// IE doesn't match non-breaking spaces with \s
rtrim
=
core_rnotwhite
.
test
(
"
\
xA0"
)
?
(
/^
[\s\x
A0
]
+|
[\s\x
A0
]
+$/g
)
:
/^
\s
+|
\s
+$/g
,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
...
...
@@ -601,7 +602,7 @@ jQuery.extend({
function
(
text
)
{
return
text
==
null
?
""
:
text
.
toString
().
replace
(
trimLeft
,
""
).
replace
(
trimRight
,
""
);
text
.
toString
().
replace
(
rtrim
,
""
);
},
// results is for internal usage only
...
...
@@ -913,11 +914,5 @@ if ( jQuery.browser.webkit ) {
jQuery
.
browser
.
safari
=
true
;
}
// IE doesn't match non-breaking spaces with \s
if
(
core_rnotwhite
.
test
(
"
\
xA0"
)
)
{
trimLeft
=
/^
[\s\x
A0
]
+/
;
trimRight
=
/
[\s\x
A0
]
+$/
;
}
// All jQuery objects should point back to these
rootjQuery
=
jQuery
(
document
);
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