Added a fix for bug #1698, in which injected scripts were executed out of order, in relation to the DOM.

This commit is contained in:
John Resig 2007-10-17 22:42:12 +00:00
parent a2fc65fd32
commit e287007f6a
2 changed files with 36 additions and 20 deletions

View file

@ -834,8 +834,10 @@ test("val(String)", function() {
ok( $("#select1").val() == "3", "Check for modified (via val(String)) value of select element" );
});
var scriptorder = 0;
test("html(String)", function() {
expect(3);
expect(9);
var div = $("div");
div.html("<b>test</b>");
var pass = true;
@ -850,6 +852,8 @@ test("html(String)", function() {
$("#main").html('foo <form><script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script></form>');
$("#main").html("<script>ok(scriptorder++ == 0, 'Script is executed in order');ok($('#scriptorder').length == 0,'Execute before html')<\/script><span id='scriptorder'><script>ok(scriptorder++ == 1, 'Script is executed in order');ok($('#scriptorder').length == 1,'Execute after html')<\/script></span><script>ok(scriptorder++ == 2, 'Script is executed in order');ok($('#scriptorder').length == 1,'Execute after html')<\/script>");
setTimeout( start, 100 );
});