var hc_staff = require('./html/files/hc_staff.html'); exports.tests = { /** * The "getDoctype()" method returns null for XML documents without a document type declaration. Retrieve the XML document without a DTD and invoke the "getDoctype()" method. It should return null. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ documentgetdoctypenodtd: function(test) { var doc = require('./html/files/hc_nodtdstaff.html').hc_nodtdstaff(); test.equal(doc.doctype, null, 'documentGetDocTypeNoDTDAssert'); test.done(); }, /** * The "createEntityReference(tagName)" method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ documentinvalidcharacterexceptioncreateentref: function(test) { var badEntityRef; var doc = hc_staff.hc_staff(); var success = false; try { badEntityRef = doc.createEntityReference("foo"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 9); } test.ok(success, 'throw_NOT_SUPPORTED_ERR'); test.done(); }, /** * Creating an entity reference with an empty name should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-392B75AE * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-392B75AE')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ documentinvalidcharacterexceptioncreateentref1: function(test) { var badEntityRef; var doc = hc_staff.hc_staff(); var success = false; try { badEntityRef = doc.createEntityReference("foo"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 9); } test.ok(success, 'throw_NOT_SUPPORTED_ERR'); test.done(); }, /** * The "createProcessingInstruction(target,data) method raises an INVALID_CHARACTER_ERR DOMException if the specified tagName contains an invalid character. * @author NIST * @author Mary Brady * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=249 */ documentinvalidcharacterexceptioncreatepi: function(test) { var success; var badPI; var doc = hc_staff.hc_staff(); success = false; try { badPI = doc.createProcessingInstruction("foo","data"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 9); } test.ok(success, 'throw_NOT_SUPPORTED_ERR'); test.done(); }, /** * Creating a processing instruction with an empty target should cause an INVALID_CHARACTER_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-135944439 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 */ documentinvalidcharacterexceptioncreatepi1: function(test) { var success; var badPI; var doc = hc_staff.hc_staff(); success = false; try { badPI = doc.createProcessingInstruction("foo","data"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 9); } test.ok(success, 'throw_NOT_SUPPORTED_ERR'); test.done(); }, /** * Appends a text node to an attribute and checks if the value of the attribute is changed. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ hc_attrappendchild1: function(test) { var success; var doc; var acronymList; var testNode; var attributes; var titleAttr; var value; var textNode; var retval; var lastChild; doc = hc_staff.hc_staff(); acronymList = doc.getElementsByTagName("acronym"); testNode = acronymList.item(3); attributes = testNode.attributes; titleAttr = attributes.getNamedItem("title"); textNode = doc.createTextNode("terday"); retval = titleAttr.appendChild(textNode); value = titleAttr.value; test.equal(value, "Yesterday", 'attrValue'); value = titleAttr.nodeValue; test.equal(value, "Yesterday", 'attrNodeValue'); value = retval.nodeValue; test.equal(value, "terday", 'retvalValue'); lastChild = titleAttr.lastChild; value = lastChild.nodeValue; test.equal(value, "terday", 'lastChildValue'); test.done(); }, /** * Attempts to append an element to the child nodes of an attribute. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ hc_attrappendchild2: function(test) { var doc = hc_staff.hc_staff(); var titleAttr = doc.getElementsByTagName("acronym").item(3).attributes.getNamedItem("title"); var newChild = doc.createElement("terday"); var success = false; try { titleAttr.appendChild(newChild); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 3); } test.ok(success, 'throw_HIERARCHY_REQUEST_ERR'); test.done(); }, /** * Appends a document fragment to an attribute and checks if the value of the attribute is changed. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ hc_attrappendchild3: function(test) { var success; var doc; var acronymList; var testNode; var attributes; var titleAttr; var value; var terNode; var dayNode; var retval; var lastChild; var docFrag; doc = hc_staff.hc_staff(); acronymList = doc.getElementsByTagName("acronym"); testNode = acronymList.item(3); attributes = testNode.attributes; titleAttr = attributes.getNamedItem("title"); terNode = doc.createTextNode("ter"); dayNode = doc.createTextNode("day"); docFrag = doc.createDocumentFragment(); retval = docFrag.appendChild(terNode); retval = docFrag.appendChild(dayNode); retval = titleAttr.appendChild(docFrag); value = titleAttr.value; test.equal(value, "Yesterday", 'attrValue'); value = titleAttr.nodeValue; test.equal(value, "Yesterday", 'attrNodeValue'); value = retval.nodeValue; test.equal(value, null, 'retvalValue'); lastChild = titleAttr.lastChild; value = lastChild.nodeValue; test.equal(value, "day", 'lastChildValue'); test.done(); }, /** * Attempt to append a CDATASection to an attribute which should result in a HIERARCHY_REQUEST_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ hc_attrappendchild4: function(test) { var doc = hc_staff.hc_staff(); var success = false; try { doc.createCDATASection("terday"); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 9); } test.ok(success, 'throw_NOT_SUPPORTED_ERR'); test.done(); }, /** * Attempt to append a node from another document to an attribute which should result in a WRONG_DOCUMENT_ERR. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ hc_attrappendchild5: function(test) { var doc = hc_staff.hc_staff(); var otherDoc = hc_staff.hc_staff(); var titleAttr = doc.getElementsByTagName("acronym").item(3).attributes.getNamedItem("title"); var textNode = otherDoc.createTextNode("terday"); var success = false; try { titleAttr.appendChild(textNode); } catch(ex) { success = (typeof(ex.code) != 'undefined' && ex.code == 4); } test.ok(success, 'throw_WRONG_DOCUMENT_ERR'); test.done(); }, /** * Creates an new attribute node and appends a text node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-184E7107 */ hc_attrappendchild6: function(test) { var success; var doc; var acronymList; var testNode; var attributes; var titleAttr; var value; var textNode; var retval; var lastChild; doc = hc_staff.hc_staff(); titleAttr = doc.createAttribute("title"); textNode = doc.createTextNode("Yesterday"); retval = titleAttr.appendChild(textNode); value = titleAttr.value; test.equal(value, "Yesterday", 'attrValue'); value = titleAttr.nodeValue; test.equal(value, "Yesterday", 'attrNodeValue'); value = retval.nodeValue; test.equal(value, "Yesterday", 'retvalValue'); lastChild = titleAttr.lastChild; value = lastChild.nodeValue; test.equal(value, "Yesterday", 'lastChildValue'); test.done(); }, /** * Checks that Node.childNodes for an attribute node contains the expected text node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 */ hc_attrchildnodes1: function(test) { var success; var doc; var acronymList; var testNode; var attributes; var titleAttr; var value; var textNode; var childNodes; doc = hc_staff.hc_staff(); acronymList = doc.getElementsByTagName("acronym"); testNode = acronymList.item(3); attributes = testNode.attributes; titleAttr = attributes.getNamedItem("title"); childNodes = titleAttr.childNodes; test.equal(childNodes.length, 1, 'childNodesSize'); textNode = childNodes.item(0); value = textNode.nodeValue; test.equal(value, "Yes", 'child1IsYes'); textNode = childNodes.item(1); test.equal(textNode, null, 'secondItemIsNull'); test.done(); }, /** * Checks Node.childNodes for an attribute with multiple child nodes. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1451460987 */ hc_attrchildnodes2: function(test) { var success; var doc; var acronymList; var testNode; var attributes; var titleAttr; var value; var textNode; var childNodes; var retval; doc = hc_staff.hc_staff(); acronymList = doc.getElementsByTagName("acronym"); testNode = acronymList.item(3); attributes = testNode.attributes; titleAttr = attributes.getNamedItem("title"); childNodes = titleAttr.childNodes; textNode = doc.createTextNode("terday"); retval = titleAttr.appendChild(textNode); test.equal(childNodes.length, 2, 'childNodesSize'); textNode = childNodes.item(0); value = textNode.nodeValue; test.equal(value, "Yes", 'child1IsYes'); textNode = childNodes.item(1); value = textNode.nodeValue; test.equal(value, "terday", 'child2IsTerday'); textNode = childNodes.item(2); test.equal(textNode, null, 'thirdItemIsNull'); test.done(); }, /** * Appends a text node to an attribute and clones the node. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3A0ED0A4 */ hc_attrclonenode1: function(test) { var success; var doc; var acronymList; var testNode; var attributes; var titleAttr; var value; var textNode; var retval; var lastChild; var clonedTitle; doc = hc_staff.hc_staff(); acronymList = doc.getElementsByTagName("acronym"); testNode = acronymList.item(3); attributes = testNode.attributes; titleAttr = attributes.getNamedItem("title"); textNode = doc.createTextNode("terday"); retval = titleAttr.appendChild(textNode); clonedTitle = titleAttr.cloneNode(false); textNode.nodeValue = "text_node_not_cloned"; value = clonedTitle.value; test.equal(value, "Yesterday", 'attrValue'); value = clonedTitle.nodeValue; test.equal(value, "Yesterday", 'attrNodeValue'); lastChild = clonedTitle.lastChild; value = lastChild.nodeValue; test.equal(value, "terday", 'lastChildValue'); test.done(); }, /** * Create a new DocumentFragment and add a newly created Element node(with one attribute). Once the element is added, its attribute should be available as an attribute associated with an Element within a DocumentFragment. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68F082 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A3 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=184 */ hc_attrcreatedocumentfragment: function(test) { var langAttrCount = 0; var doc = hc_staff.hc_staff(); var docFragment = doc.createDocumentFragment(); var newOne = doc.createElement("html"); newOne.setAttribute("lang","EN"); docFragment.appendChild(newOne); var attributes = docFragment.firstChild.attributes; for(var i=0;i length (19 > 15). * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ hc_characterdatasubstringexceedsvalue: function(test) { var success; var doc; var elementList; var nameNode; var child; var substring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(9,10); test.equal(substring, "Martin", 'characterdataSubStringExceedsValueAssert'); test.done(); }, /** * The "substringData(offset,count)" method returns the specified string. Retrieve the character data from the second child of the first employee and access part of the data by using the substringData(offset,count) method. The method should return the specified substring starting at position "offset" and extract "count" characters. The method should return the string "Margaret". * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-6531BCCF */ hc_characterdatasubstringvalue: function(test) { var success; var doc; var elementList; var nameNode; var child; var substring; doc = hc_staff.hc_staff(); elementList = doc.getElementsByTagName("strong"); nameNode = elementList.item(0); child = nameNode.firstChild; substring = child.substringData(0,8); test.equal(substring, "Margaret", 'characterdataSubStringValueAssert'); test.done(); }, /** * A comment is all the characters between the starting '' Retrieve the nodes of the DOM document. Search for a comment node and the content is its value. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D095 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-F68D080 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-111237558 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=509 */ hc_commentgetcomment: function(test) { var success; var doc; var elementList; var child; var childName; var childValue; var commentCount = 0; var childType; var attributes; doc = hc_staff.hc_staff(); elementList = doc.childNodes; for(var indexN1005E = 0;indexN1005E < elementList.length; indexN1005E++) { child = elementList.item(indexN1005E); childType = child.nodeType; if( (8 == childType) ) { childName = child.nodeName; test.equal(childName, "#comment", 'nodeName'); childValue = child.nodeValue; test.equal(childValue, " This is comment number 1.", 'nodeValue'); attributes = child.attributes; test.equal(attributes, null, 'attributes'); commentCount += 1; } } test.ok(commentCount < 2, 'atMostOneComment'); test.done(); }, /** * Retrieve the entire DOM document and invoke its "createAttribute(name)" method. It should create a new Attribute node with the given name. The name, value and type of the newly created object are retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1084891198 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=236 * @see http://lists.w3.org/Archives/Public/www-dom-ts/2003Jun/0011.html * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ hc_documentcreateattribute: function(test) { var doc = hc_staff.hc_staff(); var newAttrNode = doc.createAttribute("title"); test.equal(newAttrNode.nodeValue, "", 'value'); test.equal(newAttrNode.nodeName, 'title', 'attribute name'); test.equal(newAttrNode.nodeType, 2, 'type'); test.done(); }, /** * The "createComment(data)" method creates a new Comment node given the specified string. Retrieve the entire DOM document and invoke its "createComment(data)" method. It should create a new Comment node whose "data" is the specified string. The content, name and type are retrieved and output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1334481328 */ hc_documentcreatecomment: function(test) { var success; var doc; var newCommentNode; var newCommentValue; var newCommentName; var newCommentType; doc = hc_staff.hc_staff(); newCommentNode = doc.createComment("This is a new Comment node"); newCommentValue = newCommentNode.nodeValue; test.equal(newCommentValue, "This is a new Comment node", 'value'); newCommentName = newCommentNode.nodeName; test.equal(newCommentName, "#comment", 'strong'); newCommentType = newCommentNode.nodeType; test.equal(newCommentType, 8, 'type'); test.done(); }, /** * The "createDocumentFragment()" method creates an empty DocumentFragment object. Retrieve the entire DOM document and invoke its "createDocumentFragment()" method. The content, name, type and value of the newly created object are output. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-35CB04B5 */ hc_documentcreatedocumentfragment: function(test) { var doc = hc_staff.hc_staff(); var newDocFragment = doc.createDocumentFragment(); test.equal(newDocFragment.childNodes.length, 0, 'length'); test.equal(newDocFragment.nodeName, "#document-fragment", 'strong'); test.equal(newDocFragment.nodeType, 11, 'type'); test.equal(newDocFragment.nodeValue, null, 'value'); test.done(); }, /** * The "createElement(tagName)" method creates an Element of the type specified. Retrieve the entire DOM document and invoke its "createElement(tagName)" method with tagName="acronym". The method should create an instance of an Element node whose tagName is "acronym". The NodeName, NodeType and NodeValue are returned. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 */ hc_documentcreateelement: function(test) { var doc = hc_staff.hc_staff(); var newElement = doc.createElement("acronym"); test.equal(newElement.nodeName, 'ACRONYM', 'element strong'); test.equal(newElement.nodeType, 1, 'type'); test.equal(newElement.nodeValue, null, 'valueInitiallyNull'); test.done(); }, /** * The tagName parameter in the "createElement(tagName)" method is case-sensitive for XML documents. Retrieve the entire DOM document and invoke its "createElement(tagName)" method twice. Once for tagName equal to "acronym" and once for tagName equal to "ACRONYM" Each call should create a distinct Element node. The newly created Elements are then assigned attributes that are retrieved. Modified on 27 June 2003 to avoid setting an invalid style values and checked the node names to see if they matched expectations. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-2141741547 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=243 */ hc_documentcreateelementcasesensitive: function(test) { var doc = hc_staff.hc_staff(); var newElement1 = doc.createElement("ACRONYM"); var newElement2 = doc.createElement("acronym"); newElement1.setAttribute("lang","EN"); newElement2.setAttribute("title","Dallas"); test.equal(newElement1.getAttribute("lang"), "EN", 'attrib1'); test.equal(newElement2.getAttribute("title"), "Dallas", 'attrib2'); test.equal(newElement1.nodeName, 'ACRONYM', 'element nodeName1'); test.equal(newElement2.nodeName, 'ACRONYM', 'element nodeName2'); test.done(); }, /** * The "createTextNode(data)" method creates a Text node given the specfied string. Retrieve the entire DOM document and invoke its "createTextNode(data)" method. It should create a new Text node whose "data" is the specified string. The NodeName and NodeType are also checked. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1975348127 */ hc_documentcreatetextnode: function(test) { var success; var doc; var newTextNode; var newTextName; var newTextValue; var newTextType; doc = hc_staff.hc_staff(); newTextNode = doc.createTextNode("This is a new Text node"); newTextValue = newTextNode.nodeValue; test.equal(newTextValue, "This is a new Text node", 'value'); newTextName = newTextNode.nodeName; test.equal(newTextName, "#text", 'strong'); newTextType = newTextNode.nodeType; test.equal(newTextType, 3, 'type'); test.done(); }, /** * Access Document.doctype for hc_staff, if not text/html should return DocumentType node. HTML implementations may return null. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-B63ED1A31 */ hc_documentgetdoctype: function(test) { var doc = hc_staff.hc_staff(); var docType = doc.doctype; test.equal(docType.name, "html", 'nodeName'); test.equal(docType.nodeValue, null, 'nodeValue'); test.equal(docType.attributes, null, 'attributes'); test.done(); }, /** * The "getElementsByTagName(tagName)" method returns a NodeList of all the Elements with a given tagName. Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "strong". The method should return a NodeList that contains 5 elements. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 */ hc_documentgetelementsbytagnamelength: function(test) { var success; var doc; var nameList; doc = hc_staff.hc_staff(); nameList = doc.getElementsByTagName("strong"); test.equal(nameList.length, 5, 'documentGetElementsByTagNameLengthAssert'); test.done(); }, /** * Retrieve the entire DOM document and invoke its "getElementsByTagName(tagName)" method with tagName equal to "*". The method should return a NodeList that contains all the elements of the document. * @author Curt Arnold * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-A6C9094 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=251 */ hc_documentgetelementsbytagnametotallength: function(test) { var expectedNames = ["HTML", "HEAD", "META", "TITLE", "SCRIPT", "SCRIPT", "SCRIPT", "BODY", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM", "P", "EM", "STRONG", "CODE", "SUP", "VAR", "ACRONYM"]; var actualNames = []; var doc = hc_staff.hc_staff(); var nameList = doc.getElementsByTagName("*"); for(var i=0;i