dom/tests/mochitest/dom-level2-html/test_HTMLDocument20.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/dom-level2-html/test_HTMLDocument20.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,152 @@
     1.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     1.5 +<html>
     1.6 +<head>
     1.7 +<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
     1.8 +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
     1.9 +<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument20</title>
    1.10 +<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
    1.11 +<script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script>
    1.12 +<script src="DOMTestCase.js" type="text/javascript"></script>
    1.13 +<script type="text/javascript">
    1.14 +// expose test function names
    1.15 +function exposeTestFunctionNames()
    1.16 +{
    1.17 +return ['HTMLDocument20'];
    1.18 +}
    1.19 +
    1.20 +var docsLoaded = -1000000;
    1.21 +var builder = null;
    1.22 +
    1.23 +//
    1.24 +//   This function is called by the testing framework before
    1.25 +//      running the test suite.
    1.26 +//
    1.27 +//   If there are no configuration exceptions, asynchronous
    1.28 +//        document loading is started.  Otherwise, the status
    1.29 +//        is set to complete and the exception is immediately
    1.30 +//        raised when entering the body of the test.
    1.31 +//
    1.32 +function setUpPage() {
    1.33 +   setUpPageStatus = 'running';
    1.34 +   try {
    1.35 +     //
    1.36 +     //   creates test document builder, may throw exception
    1.37 +     //
    1.38 +     builder = createConfiguredBuilder();
    1.39 +
    1.40 +      docsLoaded = 0;
    1.41 +      
    1.42 +      var docRef = null;
    1.43 +      if (typeof(this.doc) != 'undefined') {
    1.44 +        docRef = this.doc;
    1.45 +      }
    1.46 +      docsLoaded += preload(docRef, "doc", "document");
    1.47 +        
    1.48 +       if (docsLoaded == 1) {
    1.49 +          setUpPage = 'complete';
    1.50 +       }
    1.51 +    } catch(ex) {
    1.52 +    	catchInitializationError(builder, ex);
    1.53 +        setUpPage = 'complete';
    1.54 +    }
    1.55 +}
    1.56 +
    1.57 +
    1.58 +
    1.59 +//
    1.60 +//   This method is called on the completion of 
    1.61 +//      each asychronous load started in setUpTests.
    1.62 +//
    1.63 +//   When every synchronous loaded document has completed,
    1.64 +//      the page status is changed which allows the
    1.65 +//      body of the test to be executed.
    1.66 +function loadComplete() {
    1.67 +    if (++docsLoaded == 1) {
    1.68 +        setUpPageStatus = 'complete';
    1.69 +        runJSUnitTests();
    1.70 +        SimpleTest.finish();
    1.71 +    }
    1.72 +}
    1.73 +
    1.74 +
    1.75 +/**
    1.76 +* 
    1.77 +Replaces the current document with a valid HTML document using HTMLDocument.open, writeln and close.
    1.78 +
    1.79 +* @author Curt Arnold
    1.80 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170
    1.81 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567
    1.82 +* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390
    1.83 +*/
    1.84 +function HTMLDocument20() {
    1.85 +   var success;
    1.86 +    if(checkInitialization(builder, "HTMLDocument20") != null) return;
    1.87 +    var doc;
    1.88 +      var docElem;
    1.89 +      var title;
    1.90 +      
    1.91 +      var docRef = null;
    1.92 +      if (typeof(this.doc) != 'undefined') {
    1.93 +        docRef = this.doc;
    1.94 +      }
    1.95 +      doc = load(docRef, "doc", "document");
    1.96 +      doc.open();
    1.97 +      
    1.98 +	if(
    1.99 +	
   1.100 +	(builder.contentType == "text/html")
   1.101 +
   1.102 +	) {
   1.103 +	doc.writeln("&lt;html>");
   1.104 +      
   1.105 +	}
   1.106 +	
   1.107 +		else {
   1.108 +			doc.writeln("&lt;html xmlns='http://www.w3.org/1999/xhtml'>");
   1.109 +      
   1.110 +		}
   1.111 +	doc.writeln("&lt;body>");
   1.112 +      doc.writeln("&lt;title>Replacement&lt;/title>");
   1.113 +      doc.writeln("&lt;/body>");
   1.114 +      doc.writeln("&lt;p>");
   1.115 +      doc.writeln("Hello, World.");
   1.116 +      doc.writeln("&lt;/p>");
   1.117 +      doc.writeln("&lt;/body>");
   1.118 +      doc.writeln("&lt;/html>");
   1.119 +      doc.close();
   1.120 +      
   1.121 +      // Ensure at least one SimpleTest check is reported. (Bug 483992)
   1.122 +      ok(true, "Test complete");
   1.123 +}
   1.124 +
   1.125 +</script>
   1.126 +</head>
   1.127 +<body>
   1.128 +<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument20</h2>
   1.129 +<p>&lt;test name='HTMLDocument20' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLDocument20&lt;/title&gt;
   1.130 +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Curt Arnold&lt;/creator&gt;
   1.131 +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
   1.132 +Replaces the current document with a valid HTML document using HTMLDocument.open, writeln and close.
   1.133 +&lt;/description&gt;
   1.134 +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-03-18&lt;/date&gt;
   1.135 +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-72161170</a>'/&gt;
   1.136 +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-98948567</a>'/&gt;
   1.137 +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-35318390</a>'/&gt;
   1.138 +<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='docElem' type='Element'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='title' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='document' willBeModified='true'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;open obj='doc'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contentType type='text/html'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;html xmlns='http://www.w3.org/1999/xhtml'&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/else&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/if&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;title&gt;Replacement&lt;/title&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;p&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"Hello, World."'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/p&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/body&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;writeln obj='doc' text='"&lt;/html&gt;"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;close obj='doc'/&gt;<br>&lt;/test&gt;<br>
   1.139 +</p>
   1.140 +<p>
   1.141 +			Copyright (c) 2001-2004 World Wide Web Consortium,
   1.142 +			(Massachusetts Institute of Technology, Institut National de
   1.143 +			Recherche en Informatique et en Automatique, Keio University). All
   1.144 +			Rights Reserved. This program is distributed under the W3C's Software
   1.145 +			Intellectual Property License. This program is distributed in the
   1.146 +			hope that it will be useful, but WITHOUT ANY WARRANTY; without even
   1.147 +			the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
   1.148 +			PURPOSE.
   1.149 +			</p>
   1.150 +<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a> 
   1.151 + for more details.</p>
   1.152 +<iframe name="doc" src="files/document.html"></iframe>
   1.153 +<br>
   1.154 +</body>
   1.155 +</html>

mercurial