diff options
author | Timmy Willison <4timmywil@gmail.com> | 2016-09-12 12:32:02 -0400 |
---|---|---|
committer | Timmy Willison <4timmywil@gmail.com> | 2016-09-15 10:40:27 -0400 |
commit | 3bbcce68d7b8b8a7a2164a0f7a280ae9daf70b5c (patch) | |
tree | a65aefeef8aa62ff092254dcd5b1f2c256dc82ea /src/attributes/val.js | |
parent | 2d4f53416e5f74fa98e0c1d66b6f3c285a12f0ce (diff) | |
download | jquery-3bbcce68d7b8b8a7a2164a0f7a280ae9daf70b5c.tar.gz jquery-3bbcce68d7b8b8a7a2164a0f7a280ae9daf70b5c.zip |
Core: rnotwhite -> rhtmlnotwhite and jQuery.trim -> stripAndCollapse
- Renames and changes rnotwhite to focus on HTML whitespace chars
- Change internal use of jQuery.trim to more accurate strip and collapse
- Adds tests to ensure HTML space characters are retained where valid
- Doesn't add tests where the difference is inconsequential and
existing tests are adequate.
Fixes gh-3003
Fixes gh-3072
Close gh-3316
Diffstat (limited to 'src/attributes/val.js')
-rw-r--r-- | src/attributes/val.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/attributes/val.js b/src/attributes/val.js index e23aa9a21..fbf406929 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -1,13 +1,13 @@ define( [ "../core", + "../core/stripAndCollapse", "./support", "../core/init" -], function( jQuery, support ) { +], function( jQuery, stripAndCollapse, support ) { "use strict"; -var rreturn = /\r/g, - rspaces = /[\x20\t\r\n\f]+/g; +var rreturn = /\r/g; jQuery.fn.extend( { val: function( value ) { @@ -91,7 +91,7 @@ jQuery.extend( { // option.text throws exceptions (#14686, #14858) // Strip and collapse whitespace // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); + stripAndCollapse( jQuery.text( elem ) ); } }, select: { |