Skip to content

Commit 92fb9de

Browse files
committed
Attributes: ignore option value mismatch on untrimmed unicode whitespace
1 parent da015d9 commit 92fb9de

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/unit/attributes.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,8 @@ QUnit.test( "select.val(space characters) (gh-2978)", function( assert ) {
11201120
"\\u00a0": "\u00a0",
11211121
"\\u1680": "\u1680"
11221122
},
1123-
html = "";
1123+
html = "",
1124+
runicode = /^\\u/;
11241125
jQuery.each( spaces, function( key, obj ) {
11251126
var value = obj.html || obj;
11261127
html += "<option value='attr" + value + "'></option>";
@@ -1151,9 +1152,15 @@ QUnit.test( "select.val(space characters) (gh-2978)", function( assert ) {
11511152
$select.html( html );
11521153

11531154
$select.val( "text" );
1154-
assert.equal( $select.val(), "text", "Value with space character at beginning or end is stripped (" + key + ") selected (text)" );
11551155

1156-
if ( /^\\u/.test( key ) ) {
1156+
// IE6-8 doesn't trim the option values
1157+
if ( runicode.test( key ) && /msie [678]\.0/i.test( window.navigator.userAgent ) ) {
1158+
assert.ok( true, "IE6-8 doesn't trim the option values" );
1159+
} else {
1160+
assert.equal( $select.val(), "text", "Value with space character at beginning or end is stripped (" + key + ") selected (text)" );
1161+
}
1162+
1163+
if ( runicode.test( key ) ) {
11571164
$select.val( "te" + val + "xt" );
11581165
assert.equal( $select.val(), "te" + val + "xt", "Value with non-space whitespace character (" + key + ") in the middle selected (text)" );
11591166
} else {

0 commit comments

Comments
 (0)