Fixed #1074 where .html() was incorrectly changing the selected value of an option.

This commit is contained in:
David Serduke 2007-11-17 22:09:51 +00:00
parent 32b3ac4f06
commit 264ffbc73b
2 changed files with 7 additions and 3 deletions

View file

@ -932,7 +932,7 @@ jQuery.extend({
var wrap = var wrap =
// option or optgroup // option or optgroup
!tags.indexOf("<opt") && !tags.indexOf("<opt") &&
[ 1, "<select>", "</select>" ] || [ 1, "<select multiple='multiple'>", "</select>" ] ||
!tags.indexOf("<leg") && !tags.indexOf("<leg") &&
[ 1, "<fieldset>", "</fieldset>" ] || [ 1, "<fieldset>", "</fieldset>" ] ||

View file

@ -882,7 +882,7 @@ test("val(String)", function() {
var scriptorder = 0; var scriptorder = 0;
test("html(String)", function() { test("html(String)", function() {
expect(9); expect(10);
var div = $("div"); var div = $("div");
div.html("<b>test</b>"); div.html("<b>test</b>");
var pass = true; var pass = true;
@ -891,6 +891,10 @@ test("html(String)", function() {
} }
ok( pass, "Set HTML" ); ok( pass, "Set HTML" );
$("#main").html("<select/>");
$("#main select").html("<option>O1</option><option selected='selected'>O2</option><option>O3</option>");
equals( $("#main select").val(), "O2", "Selected option correct" );
stop(); stop();
$("#main").html('<script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>'); $("#main").html('<script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>');