We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bbcce6 commit b5d09b9Copy full SHA for b5d09b9
src/core/stripAndCollapse.js
@@ -1,12 +1,14 @@
1
-define( function() {
+define( [
2
+ "../var/rnothtmlwhite"
3
+], function( rnothtmlwhite ) {
4
"use strict";
5
6
// Strip and collapse whitespace according to HTML spec
7
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
- var rhtmlSpace = /[\x20\t\r\n\f]+/g,
- stripAndCollapse = function( value ) {
8
- return ( " " + value + " " ).replace( rhtmlSpace, " " ).slice( 1, -1 );
9
- };
+ function stripAndCollapse( value ) {
+ var tokens = value.match( rnothtmlwhite ) || [];
10
+ return tokens.join( " " );
11
+ }
12
13
return stripAndCollapse;
14
} );
0 commit comments