Changeset 5793
- Timestamp:
- 07/23/08 17:00:32 (6 months ago)
- Location:
- trunk/jquery
- Files:
-
- 4 modified
-
src/core.js (modified) (2 diffs)
-
test/index.html (modified) (1 diff)
-
test/unit/core.js (modified) (2 diffs)
-
test/unit/selector.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jquery/src/core.js
r5792 r5793 363 363 var elem = this[0]; 364 364 365 if( jQuery.nodeName( elem, 'option' ) ) 366 return (elem.attributes.value || {}).specified ? elem.value : elem.text; 367 365 368 // We need to handle select boxes special 366 369 if ( jQuery.nodeName( elem, "select" ) ) { … … 380 383 if ( option.selected ) { 381 384 // Get the specifc value for the option 382 value = jQuery .browser.msie && !option.attributes.value.specified ? option.text : option.value;385 value = jQuery(option).val(); 383 386 384 387 // We don't need an array for one selects -
trunk/jquery/test/index.html
r5708 r5793 87 87 <option id="option3c" selected="selected" value="2">2</option> 88 88 <option id="option3d" value="3">3</option> 89 <option id="option3e">no value</option> 89 90 </select> 90 91 -
trunk/jquery/test/unit/core.js
r5792 r5793 1143 1143 1144 1144 test("val()", function() { 1145 expect(3); 1145 expect(8); 1146 1146 1147 equals( jQuery("#text1").val(), "Test", "Check for value of input element" ); 1147 1148 // ticket #1714 this caused a JS error in IE 1148 1149 equals( jQuery("#first").val(), "", "Check a paragraph element to see if it has a value" ); 1149 1150 ok( jQuery([]).val() === undefined, "Check an empty jQuery object will return undefined from val" ); 1151 1152 equals( jQuery('#select2').val(), '3', 'Call val() on a single="single" select' ); 1153 1154 isSet( jQuery('#select3').val(), ['1', '2'], 'Call val() on a multiple="multiple" select' ); 1155 1156 equals( jQuery('#option3c').val(), '2', 'Call val() on a option element with value' ); 1157 1158 equals( jQuery('#option3a').val(), '', 'Call val() on a option element with empty value' ); 1159 1160 equals( jQuery('#option3e').val(), 'no value', 'Call val() on a option element with no value attribute' ); 1161 1150 1162 }); 1151 1163 … … 1236 1248 isSet( jQuery("p").not(jQuery("#ap, #sndp, .result")).get(), q("firstp", "en", "sap", "first"), "not(jQuery)" ); 1237 1249 equals( jQuery("p").not(document.getElementsByTagName("p")).length, 0, "not(Array-like DOM collection)" ); 1238 isSet( jQuery("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d" ), "not('complex selector')");1250 isSet( jQuery("#form option").not("option.emptyopt:contains('Nothing'),[selected],[value='1']").get(), q("option1c", "option1d", "option2c", "option3d", "option3e" ), "not('complex selector')"); 1239 1251 1240 1252 var selects = jQuery("#form select"); -
trunk/jquery/test/unit/selector.js
r5708 r5793 196 196 t( "Element Preceded By", "p ~ div", ["foo","fx-queue","fx-tests", "moretests"] ); 197 197 t( "Not", "a.blog:not(.link)", ["mark"] ); 198 t( "Not - multiple", "#form option:not(:contains('Nothing'),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d" ] );199 t( "Not - complex", "#form option:not([id^='opt']:gt(0):nth-child(-n+3))", [ "option1a", "option1d", "option2d", "option3d" ] );198 t( "Not - multiple", "#form option:not(:contains('Nothing'),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e"] ); 199 t( "Not - complex", "#form option:not([id^='opt']:gt(0):nth-child(-n+3))", [ "option1a", "option1d", "option2d", "option3d", "option3e"] ); 200 200 t( "Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c"] ); 201 201
