//**************************************************************************
//
//
// National Institute Of Standards and Technology
// DTS Version 1.0
//
// Document Interface
//**************************************************************************
var i = 2;
function Document()
{
var tests = new Array(core0001D(), core0002D(), core0003D(), core0004D(),
core0005D(), core0006D(), core0007D(), core0008D(),
core0009D(), core0010D(), core0011D(), core0012D(),
core0013D(), core0014D(), core0015D(),
core0019D(), core0020D(),
core0021D(), core0022D(), core0023D(), core0024D(),
core0025D());
return tests;
}
//------------------------ test case core-0001T ------------------------
//
// Testing feature - The doctype attribute contains the Document Type
// Declaration associated with this Document.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// doctype attribute. It should return the Document
// type of this document. Its document Type name
// should be equal to "staff".
//
// Semantic Requirements: 1
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0001D()
{
var computedValue = "";
var expectedValue = "staff";
var testNode = "";
results = new testResults("Core0001D");
results.description = "The doctype attribute contains the Document Type "+
"Declaration associated with this object.";
//
// Retrieve the targeted data and access its "doctype" attribute.
//
testNode = getDOMDocument();
dtype = testNode.docType;
computedValue = dtype;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0001D --------------------------
//
//-------------------------- test case core-0002D ----------------------------
//
// Testing feature - The doctype attribute returns null for HTML documents.
//
// Testing approach - Retrieve the an HTML DOM document and invoke its
// doctype attribute. It should return null.
//
// Semantic Requirements: 2
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0002D()
{
var testName = "core-0002D";
var computedValue = "";
var expectedValue = null;
var testNode = "";
results = new testResults("Core0002D");
results.description = "The doctype attribute returns null for HTML "+
"documents";
//
// Retrieve the targeted data and access its "doctype" attribute.
//
testNode = getDOMHTMLDocument();
computedValue = testNode.doctype;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0002D --------------------------
//
//-------------------------- test case core-0003D ----------------------------
//
// Testing feature - The doctype attribute returns null for XML documents
// without a document type declaration.
//
// Testing approach - Retrieve an XML DOM document without a Document
// Type Declaration and invoke its doctype attribute.
// It should return null.
//
// Semantic Requirements: 2
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0003D()
{
var computedValue = "";
var expectedValue = null;
var testNode = "";
results = new testResults("Core0003D");
results.description = "The doctype attribute returns null for XML "+
" documents without a Document Type Declaration.";
//
// Retrieve the targeted data and access its "doctype" attribute.
//
testNode = getnoDTDXMLDocument();
computedValue = testNode.doctype;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0003D --------------------------
//
//-------------------------- test case core-0004D ----------------------------
//
// Testing feature - The implementation attribute contains the
// DOMImplementation object that handles this document.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "implementation" attribute. It should return a
// DOMImplementation object whose "hasFeature("XML,"1.0")
// method is invoke and a true value expected.
//
// Semantic Requirements: 3
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0004D()
{
var computedValue = "";
var expectedValue = true;
var domImp = "";
var testNode = "";
results = new testResults("Core0004D");
results.description = "The implementation attribute contains the "+
"DOMImplementation object that handles this"+
"this document.";
//
// Retrieve the targeted data and access its "implementation" attribute.
//
testNode = getDOMDocument();
domImp = testNode.implementation;
//
// The "hasFeature" method should return true.
//
computedValue = domImp.hasFeature("XML","1.0");
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0004D --------------------------
//
//-------------------------- test case core-0005D ----------------------------
//
// Testing feature - The documentElement attribute provides direct access
// to the child node that is the root element of the
// document.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "documentElement" attribute. It should return an
// Element node whose "tagName" attribute is "staff".
//
// Semantic Requirements: 4
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0005D()
{
var computedValue = "";
var expectedValue = "staff";
var rootNode = "";
var testNode = "";
results = new testResults("Core0005D");
results.description = "The documentElement attribute provides direct "+
"to the root node of the document.";
//
// Retrieve the targeted data and access its "documentElement" attribute.
//
testNode = getDOMDocument();
rootNode = testNode.documentElement;
//
// Its tagName should be set to "staff".
//
computedValue = rootNode.tagName;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0005D --------------------------
//
//-------------------------- test case core-0006D ----------------------------
//
// Testing feature - For HTML documents, the documentElement attribute returns
// the Element with the HTML tag.
//
// Testing approach - Retrieve an HTML DOM document and invoke its
// "documentElement" attribute. It should return the
// Element whose "tagName" is "HTML".
//
// Semantic Requirements: 5
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0006D()
{
var computedValue = "";
var expectedValue = "HTML";
var rootNode = "";
var testNode = "";
results = new testResults("Core0006D");
results.description = "For HTML documents, the documentElement attribute "+
"returns the element with the HTML tag.";
//
// Retrieve the targeted data and access its "documentElement" attribute.
//
testNode = getDOMHTMLDocument();
rootNode = testNode.documentElement;
//
// Its tagName should be set to "HTML".
//
computedValue = rootNode.tagName;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
return results;
}
//------------------------ End test case core-0006D --------------------------
//
//-------------------------- test case core-0007D ----------------------------
//
// Testing feature - The "createElement(tagName)" method creates an Element of
// the type specified.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createElement(tagName)" method with tagName="address".
// The method should create an instance of an Element
// node whose tagName is "address". The type, value and
// are further checked.
//
// Semantic Requirements: 6
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0007D()
{
var computedValue = "";
var expectedValue = "address 1 null";
var newElement = "";
var testNode = "";
results = new testResults("Core0007D");
results.description = "The \"createElement(tagName)\" method creates an "+
"Element of the specified type.";
//
// Retrieve the targeted data and invoke its "createElement" attribute.
//
testNode = getDOMDocument();
newElement = testNode.createElement("address");
//
// Retrieve the characteristics of this new object.
//
computedValue = newElement.tagName+" ";
computedValue += newElement.nodeType+" ";
computedValue += newElement.nodeValue;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0007D --------------------------
//
//-------------------------- test case core-0008D ----------------------------
//
// Testing feature - The tagName parameter in the "createElement(tagName)"
// method is case-sensitive for XML documents.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createElement(tagName)" method twice for tagName
// equal "address" and "ADDRESS". Each call should
// create two distinct Element nodes. Each Element
// is in turn assigned an attribute and then that
// attribute is retrieved.
//
// Semantic Requirements: 7
//
// Last modification date - April, 26 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0008D()
{
var computedValue = "";
var expectedValue = "Fort Worth Dallas";
var newElement1 = "";
var newElement2 = "";
var testNode = "";
results = new testResults("Core0008D");
results.description = "The tagName parameter in the \"createElement( "+
"tagName)\" method is case-sensitive for XML "+
"documents.";
//
// Retrieve the targeted data and invoke its "createElement" method.
//
testNode = getDOMDocument();
newElement1 = testNode.createElement("ADDRESS");
newElement2 = testNode.createElement("address");
//
// Assign attributes for each one of the created Elements.
//
newElement1.setAttribute("district","Fort Worth");
newElement2.setAttribute("county","Dallas");
//
// Now retrieve the values of each Element's attribute.
//
computedValue += newElement1.getAttribute("district")+" ";
computedValue += newElement2.getAttribute("county");
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0008D --------------------------
//
//-------------------------- test case core-0009D ----------------------------
//
// Testing feature - The "createDocumentFragment()" method creates an
// empty DocumentFragment object.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// createDocumentFragment() method. The content, name,
// type and value of the newly created object are
// further retrieved and checked.
//
// Semantic Requirements: 8
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0009D()
{
var computedValue = "";
var expectedValue = "0 #document-fragment 11 null";
var newDocFragment = "";
var testNode = "";
results = new testResults("Core0009D");
results.description = "The \"createDocumentFragment()\" method creates "+
"an empty DocumentFragment object.";
//
// Retrieve the targeted data and invoke its "createDocumentFragment()"
// method.
//
testNode = getDOMDocument();
newDocFragment = testNode.createDocumentFragment();
//
// Retrieve the characterstics of the newly created object.
//
computedValue += newDocFragment.childNodes.length+" ";
computedValue += newDocFragment.nodeName+" ";
computedValue += newDocFragment.nodeType+" ";
computedValue += newDocFragment.nodeValue;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0009D --------------------------
//
//-------------------------- test case core-0010D ----------------------------
//
// Testing feature - The "createTextNode(data)" method creates a Text node
// given by the specified string.
//
// Testing approach - 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
// name and type of the newly created object are further
// retrieved and checked.
//
// Semantic Requirements: 9
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0010D()
{
var computedValue = "";
var expectedValue = "This is a new Text node #text 3";
var newTextNode = "";
var testNode = "";
results = new testResults("Core0010D");
results.description = "The \"createTextNode(data)\" method creates "+
"a Text node given by the specified string.";
//
// Retrieve the targeted data and invoke its "createTextNode(data)" method.
//
testNode = getDOMDocument();
newTextNode = testNode.createTextNode("This is a new Text node");
//
// Retrieve the characteristics of the newly created object.
//
computedValue += newTextNode.data+" ";
computedValue += newTextNode.nodeName+" ";
computedValue += newTextNode.nodeType;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0010D --------------------------
//
//-------------------------- test case core-0011D ----------------------------
//
// Testing feature - The "createComment(data)" method creates a new Comment
// node given the specified string.
//
// Testing approach - 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 of the newly created
// object are further retrieved and examined.
//
// Semantic Requirements: 10
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0011D()
{
var computedValue = "";
var expectedValue = "This is a new Comment node #comment 8";
var newCommentNode = "";
var testNode = "";
results = new testResults("Core0011D");
results.description = "The \"createComment(data)\" method creates "+
"a new comment node given by the specified string.";
//
// Retrieve the targeted data and invoke its "createComment(data)" method.
//
testNode = getDOMDocument();
newCommentNode = testNode.createComment("This is a new Comment node");
//
// Retrieve the characteristics of the new object.
//
computedValue += newCommentNode.data+" ";
computedValue += newCommentNode.nodeName+" ";
computedValue += newCommentNode.nodeType;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0011D --------------------------
//
//-------------------------- test case core-0012D ----------------------------
//
// Testing feature - The "createCDATASection(data)" method creates a new
// CDATASection node whose value is the specified string.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createCDATASection(data)" method. It should create a
// new CDATASection node whose data is the specified string.
// The content, name and type of the newly created
// object are further retrieved and examined.
//
// Semantic Requirements: 11
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0012D()
{
var computedValue = "";
var expectedValue = "This is a new CDATASection node #cdata-section 4";
var newCDATASectionNode = "";
var testNode = "";
results = new testResults("Core0012D");
results.description = "The \"createCDATASection(data)\" method creates "+
"a new CDATASection node whose value is the "+
"specified string.";
//
// Retrieve the targeted data and invoke its "createCDATASection(data)"
// method.
//
testNode = getDOMDocument();
newCDATASectionNode = testNode.createCDATASection("This is a new CDATASection node");
//
// Retrieve the characteristics of the new object.
//
computedValue += newCDATASectionNode.data+" ";
computedValue += newCDATASectionNode.nodeName+" ";
computedValue += newCDATASectionNode.nodeType;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0012D --------------------------
//
//-------------------------- test case core-0013D ----------------------------
//
// Testing feature - The "createProcessingInstruction(target,data)" method
// creates a new ProcessingInstruction node with the
// specified name and data strings.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createProcessingInstruction(target,data)" method. It
// should create a new PI node with the specified target
// and data. The target, data and type of the newly created
// object are further retrieved and examined.
//
// Semantic Requirements: 12
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0013D()
{
var computedValue = "";
var expectedValue = "XML This is a new PI node 7";
var newPINode = "";
var testNode = "";
results = new testResults("Core0013D");
results.description = "The \"createProcessingInstruction(target,data)\" "+
"method creates a new processingInstruction node";
//
// Retrieve the targeted data and invoke its
// "createProcessingInstruction(target,data)" method.
//
testNode = getDOMDocument();
newPINode = testNode.createProcessingInstruction("XML","This is a new PI node");
//
// Retrieve the characteristics of the new object.
//
computedValue += newPINode.target+" ";
computedValue += newPINode.data+" ";
computedValue += newPINode.nodeType;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0013D --------------------------
//
//-------------------------- test case core-0014D ----------------------------
//
// Testing feature - The "createAttribute(name)" method creates an Attr
// node of the given name.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createAttribute(name)" method. It should create a
// new Attr node with the given name. The name, value
// and type of the newly created object are further
// retrieved and examined.
//
// Semantic Requirements: 13
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0014D()
{
var computedValue = "";
var expectedValue = "district 2";
var newAttrNode = "";
var testNode = "";
results = new testResults("Core0014D");
results.description = "The \"createAttribute(name)\" method creates "+
"a new Attr node of the given name.";
//
// Retrieve the targeted data and invoke its "createAttribute(name)"
// method.
//
testNode = getDOMDocument();
newAttrNode = testNode.createAttribute("district");
//
// Retrieve the characteristics of the new object.
//
computedValue += newAttrNode.name+" ";
computedValue += newAttrNode.value;
computedValue += newAttrNode.nodeType;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0014D --------------------------
//
//-------------------------- test case core-0015D ----------------------------
//
// Testing feature - The "createEntityReference(name)" method creates an
// EntityReference node.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createEntityReference(name)" method. It should
// create a new EntityReference node for the Entity
// with the given name. The name, value and type of
// the newly created object are further retrieved
// and examined.
//
// Semantic Requirements: 14
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0015D()
{
var computedValue = "";
var expectedValue = "ent1 null 5";
var newEntRefNode = "";
var testNode = "";
results = new testResults("Core0015D");
results.description = "The \"createEntityReference(name)\" method creates "+
"a new EntityReference node.";
//
// Retrieve the targeted data and invoke its "createEntityReference(name)"
// method.
//
testNode = getDOMDocument();
newEntRefNode = testNode.createEntityReference("ent1");
//
// Retrieve the characteristics of the new object.
//
computedValue += newEntRefNode.nodeName+" ";
computedValue += newEntRefNode.nodeValue+" ";
computedValue += newEntRefNode.nodeType;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0015D --------------------------
//
//-------------------------- test case core-0016D ----------------------------
//
// Testing feature - The "getElementsByTagName(tagName)" method returns a
// NodeList of all the Elements with a given tagName.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "getElementsByTagName(tagName)" method with tagName
// equal to "name". The method should return a NodeList
// that contains 5 elements.
//
// Semantic Requirements: 15
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0016D()
{
var computedValue = 0;
var expectedValue = 5;
var testNode = "";
results = new testResults("Core0016D");
results.description = "The \"getElementsByTagName(tagName)\" method "+
"returns a NodeList of all the Elements with a "+
"given tag name.";
//
// Retrieve the targeted data and invoke its "getElementsByTagName(tagName)"
// method.
//
testNode = getDOMDocument();
elementList = testNode.getElementsByTagName("name");
//
// Retrieve the length of the list.
//
computedValue = elementList.length;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0016D --------------------------
//
//-------------------------- test case core-0017D ----------------------------
//
// Testing feature - The "getElementsByTagName(tagName)" method returns a
// NodeList of all the Elements with a given tagName in
// a pre-order traversal of the tree.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "getElementsByTagName(tagName)" method with tagName
// equal to "name". The method should return a NodeList
// that contains 5 elements. Further the fourth item in
// the list is retrieved and checked.
//
// Semantic Requirements: 16
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0017D()
{
var computedValue = 0;
var expectedValue = "Jeny Oconnor";
var testNode = "";
results = new testResults("Core0017D");
results.description = "The \"getElementsByTagName(tagName)\" method "+
"returns a NodeList of all the Elements with a "+
"given tag name in a preorder traversal of the tree."
//
// Retrieve the targeted data and invoke its "getElementsByTagName(tagName)"
// method.
//
testNode = getDOMDocument();
elementList = testNode.getElementsByTagName("name");
//
// Retrieve the fourth item and its data.
//
computedValue = elementList(FOURTH).firstChild.data;
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0017D --------------------------
//
//-------------------------- test case core-0018D ----------------------------
//
// Testing feature - The "getElementsByTagName(tagName)" method returns a
// NodeList of all the Elements in the tree when the
// tagName is equal to "*".
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "getElementsByTagName(tagName)" method with tagName
// equal to "*". The method should return a NodeList
// that contains 41 elements, which is the total number
// of Elements in the document.
//
// Semantic Requirements: 17
//
// Last modification date - April, 27 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0018D()
{
var computedValue = 0;
var expectedValue = 37;
var testNode = "";
results = new testResults("Core0018D");
results.description = "The \"getElementsByTagName(tagName)\" method "+
"returns a NodeList of all the Elements in the "+
"tree when the tag name is equal to \"*\".";
//
// Retrieve the targeted data and invoke its "getElementsByTagName(tagName)"
// method.
//
testNode = getDOMDocument();
elementList = testNode.getElementsByTagName("*");
//
// Retrieve the length of the list.
//
computedValue = elementList.length;
//
// Write out results.
//
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0018D --------------------------
//
//------------------------- test case core-0019D -----------------------------
//
// Testing feature - The "createElement(tagName)" method raises an
// INVALID_CHARACTER_ERR DOMException if the
// specified name contains an invalid character.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createElement(tagName)" method with the tagName
// equals to the string "invalid^Name" which contains
// an invalid character ("^") in it. The desired
// exception should be raised.
//
// Semantic Requirements: 18
//
// Last modification date - April 28, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0019D()
{
var computedValue = "";
var testNode = "";
var invalidElement = "";
var expectedValue = INVALID_CHARACTER_ERR;
results = new testResults("Core0019D");
results.description = "The \"createElement(tagName)\" method raises an "+
"INVALID_CHARACTER_ERR DOMException if the "+
"specified name contains an invalid character.";
//
// Retrieve the targeted data.
//
testNode = getDOMDocument();
//
// Attempt to create an Element with an invalid tagName should raise
// an exception.
//
try {
invalidElement = testNode.createElement("invalid^Name");
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0019D -------------------------
//
//------------------------- test case core-0020D -----------------------------
//
// Testing feature - The "createAttribute(name)" method raises an
// INVALID_CHARACTER_ERR DOMException if the
// specified name contains an invalid character.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createAttribute(name)" method with the name
// equals to the string "invalid^Name" which contains
// an invalid character ("^") in it. The desired
// exception should be raised.
//
// Semantic Requirements: 19
//
// Last modification date - April 28, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0020D()
{
var computedValue = "";
var expectedValue = INVALID_CHARACTER_ERR;
var testNode = "";
var invalidAttr = "";
results = new testResults("Core0020D");
results.description = "The \"createAttribute(name)\" method raises an "+
"INVALID_CHARACTER_ERR DOMException if the "+
"specified name contains an invalid character.";
//
// Retrieve the targeted data.
//
testNode = getDOMDocument();
//
// Attempt to create an Attr node with an invalid name should raise
// an exception.
//
try {
invalidAttr = testNode.createAttribute("invalid^Name");
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0020D -------------------------
//
//------------------------- test case core-0021D -----------------------------
//
// Testing feature - The "createEntityReference(name)" method raises an
// INVALID_CHARACTER_ERR DOMException if the
// specified name contains an invalid character.
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createEntityReference(name)" method with the name
// equals to the string "invalid^Name" which contains
// an invalid character ("^") in it. The desired
// exception should be raised.
//
// Semantic Requirements: 20
//
// Last modification date - April 28, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0021D()
{
var computedValue = "";
var expectedValue = INVALID_CHARACTER_ERR;
var testNode = "";
var invalidEntRef = "";
results = new testResults("Core0021D");
results.description = "The \"createEntityReference(name)\" method raises "+
"an INVALID_CHARACTER_ERR DOMException if the "+
"specified name contains an invalid character.";
//
// Retrieve the targeted data.
//
testNode = getDOMDocument();
//
// Attempt to create an EntityReference node with an invalid name should
// raise an exception.
//
try {
invalidEntRef = testNode.createEntityReference("invalid^Name");
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0021D -------------------------
//
//------------------------- test case core-0022D ----------------------------
//
// Testing feature - The "createProcessingInstruction(target,data)" method
// raises an INVALID_CHARACTER_ERR DOMException if an
// invalid character was specified. (test for invalid
// target)
//
// Testing approach - Retrieve the entire DOM document and invoke its
// "createProcessingInstruction(target,data)" method with
// the target equals to the string "invalid^target" which
// contains an invalid character ("^") in it. The desired
// exception should be raised.
//
// Semantic Requirements: 21
//
// Last modification date - April 28, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0022D()
{
var computedValue = "";
var expectedValue = INVALID_CHARACTER_ERR;
var testNode = "";
var invalidPI = "";
results = new testResults("Core0022D");
results.description = "The \"createProcessingInstruction(target,data)\" "+
"method raises an INVALID_CHARACTER_ERR "+
"DOMException if an invalid character was specified "+ "(invalid target).";
//
// Retrieve the targeted data.
//
testNode = getDOMDocument();
//
// Attempt to create a ProcessingInstruction node with an invalid
// target name should raise an exception.
//
try {
invalidPI = testNode.createProcessingInstruction("invalid^target","data");
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0022D -------------------------
//
//------------------------- test case core-0023D ----------------------------
//
// Testing feature - The "createCDATASection(data)" method raises a
// NOT_SUPPORTED_ERR DOMException if this is an
// HTML document.
//
// Testing approach - Retrieve an HTML based DOM document and invoke its
// "createCDATASection(data)" method. Since this DOM
// document was based on an HTML document, the desired
// exception should be raised.
//
// Semantic Requirements: 22
//
// Last modification date - April 28, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0023D()
{
var computedValue = "";
var expectedValue = NOT_SUPPORTED_ERR;
var testNode = "";
var invalidCData = "";
results = new testResults("Core0023D");
results.description = "The \"createCDATASection(data)\" method raises "+
"a NOT_SUPPORTED_ERR DOMException if this is "+
"an HTML document.";
//
// Retrieve the targeted data.
//
testNode = getDOMHTMLDocument();
//
// Attempt to create a CDATASection node for an HTML based DOM Document
// should raise an exception.
//
try {
invalidCData = testNode.createCDATASection("This is a new CDATA Section");
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0023D -------------------------
//
//------------------------- test case core-0024D ----------------------------
//
// Testing feature - The "createProcessingInstruction(target,data)" method
// raises a NOT_SUPPORTED_ERR DOMException if this is an
// HTML document.
//
// Testing approach - Retrieve an HTML based DOM document and invoke its
// "createProcessingInstruction(target,data)" method.
// Since this DOM document was based on an HTML document,
// the desired exception should be raised.
//
// Semantic Requirements: 23
//
// Last modification date - April 28, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0024D()
{
var computedValue = "";
var expectedValue = NOT_SUPPORTED_ERR;
var testNode = "";
var invalidPI = "";
results = new testResults("Core0024D");
results.description = "The \"createProcessingInstruction(target,data)\" "+
"method raises a NOT_SUPPORTED_ERR DOMException "+
"if this is an HTML document.";
//
// Retrieve the targeted data.
//
testNode = getDOMHTMLDocument();
//
// Attempt to create a ProcessingInstruction node for an HTML based DOM
// Document should raise an exception.
//
try {
invalidPI = testNode.createProcessingInstruction("XML","This is a new PI node");
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0024D -------------------------
//
//------------------------- test case core-0025D ----------------------------
//
// Testing feature - The "createEntityReference(data)" method raises
// a NOT_SUPPORTED_ERR DOMException if this is an
// HTML document.
//
// Testing approach - Retrieve an HTML based DOM document and invoke its
// "createEntityReference(name)" method. Since this DOM
// document was based on an HTML document, the desired
// exception should be raised.
//
// Semantic Requirements: 24
//
// Last modification date - April 28, 1999
//
// Written by: Carmelo Montanez
//----------------------------------------------------------------------------
function core0025D()
{
var computedValue = "";
var expectedValue = NOT_SUPPORTED_ERR;
var testNode = "";
var invalidEntRef = "";
results = new testResults("Core0025D");
results.description = "The \"createEntityReference(name)\" method raises "+
"a NOT_SUPPORTED_ERR DOMException if this is an "+
"HTML document.";
//
// Retrieve the targeted data.
//
testNode = getDOMHTMLDocument();
//
// Attempt to create an EntityReference node for an HTML based DOM
// Document should raise an exception.
//
try {
invalidEntRef = testNode.createEntityReference("ent1");
}
catch(DOMException) {
computedValue = DOMException.description;
}
//
// Write out results.
//
results.expected = expectedValue;
results.actual = computedValue;
resetData();
return results;
}
//------------------------ End test case core-0025D -------------------------