Test case details

Preparation Code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <div id="container"></div> <script>   var $img1 = $('<img/>').attr('src', 'http://www.websharedesign.com/images/icon-testing.gif'),       $img2 = $('<img/>').attr('src', 'http://www.hepcscotland.co.uk/images/testing.gif');   $img1.appendTo('#container');     var dimg = $img1.get();   var cont = $('#container'); </script>
var s = true;

Test cases

Test #1

if(s){     cont.find('img').replaceWith($img1); } else{     cont.find('img').replaceWith($img2); } s=!s;

Test #2

if(s){     $img1.attr('src', 'http://www.websharedesign.com/images/icon-testing.gif'); } else{     $img1.attr('src', 'http://www.hepcscotland.co.uk/images/testing.gif'); } s=!s;

Test #3

if(s){     dimg.src = 'http://www.websharedesign.com/images/icon-testing.gif'; } else{     dimg.src = 'http://www.hepcscotland.co.uk/images/testing.gif'; } s=!s;

Test #4

if(s){     $img1.get().src = 'http://www.websharedesign.com/images/icon-testing.gif'; } else{     $img1.get().src = 'http://www.hepcscotland.co.uk/images/testing.gif'; } s=!s;