Skip to content

Commit 14b0902

Browse files
committed
Fix and tests for appending HTML options to select elements.
Fixed previous tests for 193 and 170.
1 parent 6f7cd66 commit 14b0902

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

build/test/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ <h1>jQuery - Test Suite</h1>
7171
<option id="option3d" value="3">3</option>
7272
</select>
7373
</form>
74-
<p id="floatTest">Float test.</div>
74+
<b id="floatTest">Float test.</b>
7575
</div>
7676
</dl>
7777

src/jquery/jquery.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ jQuery.fn = jQuery.prototype = {
539539
* $('#floatTest').css({cssFloat: 'left'});
540540
* ok( $('#floatTest').css('cssFloat') == 'left', 'Modified CSS float using "cssFloat": Assert float is left');
541541
* $('#floatTest').css({'float': 'right'});
542-
* ok( $('#floatTest').css('cssFloat') == 'right', 'Modified CSS float using "cssFloat": Assert float is right');
542+
* ok( $('#floatTest').css('float') == 'right', 'Modified CSS float using "float": Assert float is right');
543543
* $('#floatTest').css({'font-size': '30px'});
544544
* ok( $('#floatTest').css('font-size') == '30px', 'Modified CSS font-size: Assert font-size is 30px');
545545
*
@@ -568,7 +568,7 @@ jQuery.fn = jQuery.prototype = {
568568
* $('#floatTest').css('cssFloat', 'right');
569569
* ok( $('#floatTest').css('cssFloat') == 'right', 'Modified CSS float using "cssFloat": Assert float is right');
570570
* $('#floatTest').css('float', 'left');
571-
* ok( $('#floatTest').css('cssFloat') == 'left', 'Modified CSS float using "cssFloat": Assert float is left');
571+
* ok( $('#floatTest').css('float') == 'left', 'Modified CSS float using "float": Assert float is left');
572572
* $('#floatTest').css('font-size', '20px');
573573
* ok( $('#floatTest').css('font-size') == '20px', 'Modified CSS font-size: Assert font-size is 20px');
574574
*
@@ -701,6 +701,7 @@ jQuery.fn = jQuery.prototype = {
701701
* @test var defaultText = 'Try them out:'
702702
* var result = $('#first').append('<b>buga</b>');
703703
* ok( result.text() == defaultText + 'buga', 'Check if text appending works' );
704+
* ok( $('#select3').append('<option value="appendTest">Append Test</option>').find('option:last-child').attr('value') == 'appendTest', 'Appending html options to select element');
704705
*
705706
* @name append
706707
* @type jQuery
@@ -764,6 +765,7 @@ jQuery.fn = jQuery.prototype = {
764765
* @test var defaultText = 'Try them out:'
765766
* var result = $('#first').prepend('<b>buga</b>');
766767
* ok( result.text() == 'buga' + defaultText, 'Check if text prepending works' );
768+
* ok( $('#select3').prepend('<option value="prependTest">Prepend Test</option>').find('option:first-child').attr('value') == 'prependTest', 'Prepending html options to select element');
767769
*
768770
* @name prepend
769771
* @type jQuery
@@ -1546,7 +1548,10 @@ jQuery.extend({
15461548

15471549
var table = "";
15481550

1549-
if ( !a[i].indexOf("<thead") || !a[i].indexOf("<tbody") ) {
1551+
if ( !a[i].indexOf("<opt") ) {
1552+
table = "thead";
1553+
a[i] = "<select>" + a[i] + "</select>";
1554+
} else if ( !a[i].indexOf("<thead") || !a[i].indexOf("<tbody") ) {
15501555
table = "thead";
15511556
a[i] = "<table>" + a[i] + "</table>";
15521557
} else if ( !a[i].indexOf("<tr") ) {

0 commit comments

Comments
 (0)