<!DOCTYPE html>
<html>
<body>
  <object id="object1" data="resources/lime100x100.svg">
    <img src="resources/red100x100.svg">
  </object>
  <object id="object2" type="image/svg+xml" data="resources/red100x100.svg">
    <img src="resources/red100x100.svg">
  </object>
  <object width="100px" height="100px" id="object3">
    <img src="resources/red100x100.svg">
  </object>
  <object id="object4" type="dummy">
    <img src="resources/red100x100.svg">
  </object>
  <object id="object5" type="dummy">
    <img src="resources/red100x100.svg">
  </object>
  <object id="object6" type="image/svg+xml" data="resources/red100x100.svg">
    <img src="resources/lime100x100.svg">
  </object>
  <script>
    function onObjectLoad() {
      if (!window.testRunner)
        return;
        
      if (typeof onObjectLoad.counter == 'undefined')
        onObjectLoad.counter = 0;
    
      if (++onObjectLoad.counter == 4)
        testRunner.notifyDone();
    }
 
    window.addEventListener("load", function() {
      if (window.testRunner)
        testRunner.waitUntilDone();

      // change the 'type' attribute
      var object1 = document.getElementById("object1");
      object1.setAttribute("type", "image/svg+xml");

      // change the 'data' attribute
      var object2 = document.getElementById("object2");
      object2.onload = onObjectLoad;
      object2.setAttribute("data", "resources/lime100x100.svg");

      // change the 'data' attribute
      var object3 = document.getElementById("object3");
      object3.onload = onObjectLoad;
      object3.setAttribute("data", "resources/lime100x100.html");

      // change the 'type' then the 'data' attributes of an image object
      var object4 = document.getElementById("object4");
      object4.onload = onObjectLoad;
      object4.setAttribute("type", "image/png");
      object4.setAttribute("data", "resources/lime100x100.png");

      // change the 'data' then the 'type' attributes of an image object
      var object5 = document.getElementById("object5");
      object5.onload = onObjectLoad;
      object5.setAttribute("data", "resources/lime100x100.png");
      object5.setAttribute("type", "image/png");

      // object rederer fallback
      var object6 = document.getElementById("object6");
      object6.setAttribute("type", "dummy");
    });
  </script>
</body>
</html>
