Changeset 4155
- Timestamp:
- 12/14/07 17:06:41 (9 months ago)
- Location:
- trunk/jquery
- Files:
-
- 2 modified
-
src/ajax.js (modified) (1 diff)
-
test/unit/ajax.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jquery/src/ajax.js
r4149 r4155 35 35 url: url, 36 36 type: type, 37 dataType: "html", 37 38 data: params, 38 39 complete: function(res, status){ -
trunk/jquery/test/unit/ajax.js
r4123 r4155 318 318 }); 319 319 320 test("load(String, Function) with ajaxSetup on dataType json, see #2046", function() { 321 expect(1); 322 stop(); 323 $.ajaxSetup({ dataType: "json" }); 324 $("#first").ajaxComplete(function (e, xml, s) { 325 equals( s.dataType, "html", "Verify the load() dataType was html" ); 326 $("#first").unbind("ajaxComplete"); 327 $.ajaxSetup({ dataType: "" }); 328 start(); 329 }); 330 $('#first').load("data/test3.html"); 331 }); 332 320 333 test("load(String, Function) - simple: inject text into DOM", function() { 321 334 expect(2); … … 333 346 window.foobar = null; 334 347 var verifyEvaluation = function() { 335 equals( foobar, "bar", 'Check if script src was evaluated after load' );336 equals( $('#ap').html(), 'bar', 'Check if script evaluation has modified DOM');337 start();348 equals( foobar, "bar", 'Check if script src was evaluated after load' ); 349 equals( $('#ap').html(), 'bar', 'Check if script evaluation has modified DOM'); 350 start(); 338 351 }; 339 352 $('#first').load(url('data/test.html'), function() { 340 ok( $('#first').html().match(/^html text/), 'Check content after loading html' );341 equals( $('#foo').html(), 'foo', 'Check if script evaluation has modified DOM');342 equals( testFoo, "foo", 'Check if script was evaluated after load' );343 setTimeout(verifyEvaluation, 600);353 ok( $('#first').html().match(/^html text/), 'Check content after loading html' ); 354 equals( $('#foo').html(), 'foo', 'Check if script evaluation has modified DOM'); 355 equals( testFoo, "foo", 'Check if script was evaluated after load' ); 356 setTimeout(verifyEvaluation, 600); 344 357 }); 345 358 }); … … 350 363 testFoo = undefined; 351 364 $('#first').load(url('data/test2.html'), function() { 352 ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM');353 ok( testFoo == "foo", 'Check if script was evaluated after load' );354 start();365 ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM'); 366 ok( testFoo == "foo", 'Check if script was evaluated after load' ); 367 start(); 355 368 }); 356 369 });
