diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2016-04-04 22:42:01 +0300 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-04-04 16:22:35 -0400 |
commit | 5d20a3c3f10bda935c8370392a25e45719afa6b9 (patch) | |
tree | e815ab5b6070160a0b17875256bc357ae29e7401 /test | |
parent | c158f5761a6a66b0ef6e7ee450ab721c80620d67 (diff) | |
download | jquery-5d20a3c3f10bda935c8370392a25e45719afa6b9.tar.gz jquery-5d20a3c3f10bda935c8370392a25e45719afa6b9.zip |
Ajax: execute jQuery#load callback with correct context
Thanks @blq (Fredrik Blomqvist)
Fixes gh-3035
Close gh-3039
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/ajax.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 949bf5f20..297f051d9 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -2085,6 +2085,25 @@ if ( typeof window.ArrayBuffer === "undefined" || typeof new XMLHttpRequest().re ); QUnit.test( + "jQuery#load() - should resolve with correct context", 2, + function( assert ) { + var done = assert.async(); + var ps = jQuery( "<p></p><p></p>" ); + var i = 0; + + ps.appendTo( "#qunit-fixture" ); + + ps.load( "data/ajax/method.php", function() { + assert.strictEqual( this, ps[ i++ ] ); + + if ( i === 2 ) { + done(); + } + } ); + } + ); + + QUnit.test( "#11402 - jQuery.domManip() - script in comments are properly evaluated", 2, function( assert ) { jQuery( "#qunit-fixture" ).load( "data/cleanScript.html", assert.async() ); |