Mobile Acid Test: XmlHTTPRequest (was: [minutes] Tuesday Dec 18 teleconf)

Le mardi 08 janvier 2008 à 14:48 +0100, Wilhelm Joys Andersen a écrit :
> I have uploaded a demo here:
> 
>     http://people.opera.com/wilhelmja/mwts/demo.html
> 
> Only three tests are included so far (data URI, CSS media queries, CSS3  
> nth-child selector). The remaining 22 boxes in the demo are just copies of  
> these. They should be replaced by proper tests as work progresses. Please  
> send me any tests you want included.

Here is a test for support of XMLHTTPRequest (inspired from
http://www.w3.org/2004/CDF/TestSuite/WICD_CDR_WP1/test-xmlhttprequest.xhtml ):

<div title="Test #5: XMLHTTPRequest" class="box">
<script type="application/ecmascript">
    function callXMLFile()
    {
      var xmlHttp=null;
      if (typeof XMLHttpRequest != "undefined")
      {
        xmlHttp = new XMLHttpRequest();
      }
      else
      {
        return;
      }

      if (xmlHttp)
      {
        xmlHttp.open("GET", "ajax.xml", true);
        xmlHttp.onreadystatechange = function()
        {
          if (xmlHttp.readyState == 4)
          {
       var parsed=xmlHttp.responseXML;
       if(parsed)
       {
         var src=parsed.getElementsByTagName("src")[0].textContent;
                var
alt=parsed.getElementsByTagName("alt")[0].textContent;
                var img=document.getElementById("ajax");
                img.src=src;
                img.alt=alt;
                
       }
          }
        };
        xmlHttp.send(null);
      }
    }

    window.addEventListener("load",callXMLFile,false);

    </script>
<img src="red.png" alt="Fail" width="20" height="20" id="ajax" />
</div>

With the files attached to be served along.

Dom

Received on Tuesday, 29 January 2008 15:15:20 UTC