mirror of
https://github.com/jquery/jquery.git
synced 2026-01-31 22:28:04 -05:00
Core: Compress stripAndCollapse
Close gh-3318
This commit is contained in:
committed by
Timmy Willison
parent
3bbcce68d7
commit
b5d09b90ca
@@ -1,12 +1,14 @@
|
||||
define( function() {
|
||||
define( [
|
||||
"../var/rnothtmlwhite"
|
||||
], function( rnothtmlwhite ) {
|
||||
"use strict";
|
||||
|
||||
// Strip and collapse whitespace according to HTML spec
|
||||
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
|
||||
var rhtmlSpace = /[\x20\t\r\n\f]+/g,
|
||||
stripAndCollapse = function( value ) {
|
||||
return ( " " + value + " " ).replace( rhtmlSpace, " " ).slice( 1, -1 );
|
||||
};
|
||||
function stripAndCollapse( value ) {
|
||||
var tokens = value.match( rnothtmlwhite ) || [];
|
||||
return tokens.join( " " );
|
||||
}
|
||||
|
||||
return stripAndCollapse;
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user