W3C home > Mailing lists > Public > public-mwts@w3.org > January 2008

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

From: Dominique Hazael-Massieux <dom@w3.org>
Date: Tue, 29 Jan 2008 16:14:32 +0100
To: Wilhelm Joys Andersen <wilhelmja@opera.com>
Cc: public-mwts@w3.org
Message-Id: <1201619672.29977.169.camel@localhost>

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




green.png
(image/png attachment: green.png)

red.png
(image/png attachment: red.png)

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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 29 January 2008 15:15:21 GMT