test_HTMLTableElement29.html (8429B)
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 2 <html> 3 <head> 4 <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> 6 <title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement29</title> 7 <link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css"> 8 <script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script> 9 <script src="DOMTestCase.js" type="text/javascript"></script> 10 <script type="text/javascript"> 11 // expose test function names 12 function exposeTestFunctionNames() 13 { 14 return ['HTMLTableElement29']; 15 } 16 17 var docsLoaded = -1000000; 18 var builder = null; 19 20 // 21 // This function is called by the testing framework before 22 // running the test suite. 23 // 24 // If there are no configuration exceptions, asynchronous 25 // document loading is started. Otherwise, the status 26 // is set to complete and the exception is immediately 27 // raised when entering the body of the test. 28 // 29 function setUpPage() { 30 setUpPageStatus = 'running'; 31 try { 32 // 33 // creates test document builder, may throw exception 34 // 35 builder = createConfiguredBuilder(); 36 37 docsLoaded = 0; 38 39 var docRef = null; 40 if (typeof(this.doc) != 'undefined') { 41 docRef = this.doc; 42 } 43 docsLoaded += preload(docRef, "doc", "table"); 44 45 if (docsLoaded == 1) { 46 setUpPage = 'complete'; 47 } 48 } catch(ex) { 49 catchInitializationError(builder, ex); 50 setUpPage = 'complete'; 51 } 52 } 53 54 55 56 // 57 // This method is called on the completion of 58 // each asychronous load started in setUpTests. 59 // 60 // When every synchronous loaded document has completed, 61 // the page status is changed which allows the 62 // body of the test to be executed. 63 function loadComplete() { 64 if (++docsLoaded == 1) { 65 setUpPageStatus = 'complete'; 66 runJSUnitTests(); 67 SimpleTest.finish(); 68 } 69 } 70 71 72 /** 73 * 74 The insertRow() method inserts a new empty table row. 75 76 Retrieve the second TABLE element and invoke the insertRow() method 77 with an index of two. Currently the 2nd indexed row is in the TBODY 78 section of the TABLE. The number of rows in the TBODY section before 79 insertion of the new row is two. After the new row is inserted the number 80 of rows in the TBODY section is three. 81 82 * @author NIST 83 * @author Rick Rivello 84 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903 85 */ 86 function HTMLTableElement29() { 87 var success; 88 if(checkInitialization(builder, "HTMLTableElement29") != null) return; 89 var nodeList; 90 var tbodiesnodeList; 91 var testNode; 92 var bodyNode; 93 var newRow; 94 var rowsnodeList; 95 var vsection1; 96 var vsection2; 97 var vrows; 98 var doc; 99 100 var docRef = null; 101 if (typeof(this.doc) != 'undefined') { 102 docRef = this.doc; 103 } 104 doc = load(docRef, "doc", "table"); 105 nodeList = doc.getElementsByTagName("table"); 106 assertSize("Asize",3,nodeList); 107 testNode = nodeList.item(1); 108 tbodiesnodeList = testNode.tBodies; 109 110 bodyNode = tbodiesnodeList.item(0); 111 rowsnodeList = bodyNode.rows; 112 113 vrows = rowsnodeList.length; 114 115 assertEquals("rowsLink1",2,vrows); 116 newRow = testNode.insertRow(2); 117 tbodiesnodeList = testNode.tBodies; 118 119 bodyNode = tbodiesnodeList.item(0); 120 rowsnodeList = bodyNode.rows; 121 122 vrows = rowsnodeList.length; 123 124 assertEquals("rowsLink2",3,vrows); 125 126 } 127 128 </script> 129 </head> 130 <body> 131 <h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLTableElement29</h2> 132 <p><test name='HTMLTableElement29' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'><br> <metadata><br> <title>HTMLTableElement29</title> 133 <br> <creator>NIST</creator> 134 <br> <description> 135 The insertRow() method inserts a new empty table row. 136 137 Retrieve the second TABLE element and invoke the insertRow() method 138 with an index of two. Currently the 2nd indexed row is in the TBODY 139 section of the TABLE. The number of rows in the TBODY section before 140 insertion of the new row is two. After the new row is inserted the number 141 of rows in the TBODY section is three. 142 </description> 143 <br> <contributor>Rick Rivello</contributor> 144 <br> <date qualifier='created'>2002-05-02</date> 145 <br> <subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-39872903</a>'/> 146 <br></metadata><br> <var name='nodeList' type='NodeList'/><br> <var name='tbodiesnodeList' type='HTMLCollection'/><br> <var name='testNode' type='Node'/><br> <var name='bodyNode' type='Node'/><br> <var name='newRow' type='HTMLElement'/><br> <var name='rowsnodeList' type='HTMLCollection'/><br> <var name='vsection1' type='HTMLTableSectionElement'/><br> <var name='vsection2' type='HTMLTableSectionElement'/><br> <var name='vrows' type='int'/><br> <var name='doc' type='Document'/><br> <load var='doc' href='table' willBeModified='true'/><br> <getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"table"'/><br> <assertSize collection='nodeList' size='3' <a id="Asize">id='Asize'</a>/><br> <item interface='NodeList' obj='nodeList' var='testNode' index='1'/><br> <tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/><br> <item interface='HTMLCollection' obj='tbodiesnodeList' var='bodyNode' index='0'/><br> <rows interface='HTMLTableSectionElement' obj='bodyNode' var='rowsnodeList'/><br> <length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/><br> <assertEquals actual='vrows' expected='2' <a id="rowsLink1">id='rowsLink1'</a> ignoreCase='false'/><br> <insertRow interface='HTMLTableElement' obj='testNode' var='newRow' index='2'/><br> <tBodies interface='HTMLTableElement' obj='testNode' var='tbodiesnodeList'/><br> <item interface='HTMLCollection' obj='tbodiesnodeList' var='bodyNode' index='0'/><br> <rows interface='HTMLTableSectionElement' obj='bodyNode' var='rowsnodeList'/><br> <length interface='HTMLCollection' obj='rowsnodeList' var='vrows'/><br> <assertEquals actual='vrows' expected='3' <a id="rowsLink2">id='rowsLink2'</a> ignoreCase='false'/><br></test><br> 147 </p> 148 <p> 149 Copyright (c) 2001-2004 World Wide Web Consortium, 150 (Massachusetts Institute of Technology, Institut National de 151 Recherche en Informatique et en Automatique, Keio University). All 152 Rights Reserved. This program is distributed under the W3C's Software 153 Intellectual Property License. This program is distributed in the 154 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 155 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 156 PURPOSE. 157 </p> 158 <p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a> 159 for more details.</p> 160 <iframe name="doc" src="files/table.html"></iframe> 161 <br> 162 </body> 163 </html>