1 function addCell(row
, contents
) {
2 var cell
= document
.createElementNS("http://www.w3.org/1999/xhtml","td");
4 cell
.innerHTML
= contents
;
7 function reportResult(tagName
, tagNamespace
, id
, attrName
, attrNamespace
, sensitive
, firstValue
, secondValue
) {
8 var newRow
= document
.createElementNS("http://www.w3.org/1999/xhtml", 'tr');
9 document
.getElementById("results").appendChild(newRow
);
10 addCell(newRow
, sensitive
);
11 addCell(newRow
, tagName
);
12 addCell(newRow
, tagNamespace
);
14 addCell(newRow
, attrName
);
15 addCell(newRow
, attrNamespace
);
16 addCell(newRow
, firstValue
);
17 addCell(newRow
, secondValue
);
20 function resultLog(string
) {
21 var resultLine
= document
.createElementNS("http://www.w3.org/1999/xhtml","tr");
22 document
.getElementById("results").appendChild(resultLine
);
23 var resultText
= document
.createElementNS("http://www.w3.org/1999/xhtml","td");
24 resultLine
.appendChild(resultText
);
25 resultText
.setAttribute("colspan", '6');
26 resultText
.innerHTML
= string
;
29 function getTestElement(number
) {
30 return document
.getElementById("test" + number
);
33 function checkAttribute(element
, attrName
, namespace) {
37 if (typeof(namespace) == 'undefined') {
38 first
= element
.getAttribute(attrName
);
39 second
= element
.getAttribute(attrName
.toUpperCase());
41 first
= element
.getAttributeNS(namespace, attrName
);
42 second
= element
.getAttributeNS(namespace, attrName
.toUpperCase());
45 reportResult(element
.localName
, element
.namespaceURI
, element
.id
, attrName
, namespace, (first
!= second
), first
, second
);
48 function createAttributesForCheck(element
, attrName
, namespace) {
49 if (typeof(namespace) == 'undefined') {
50 element
.setAttribute(attrName
, 'first');
51 element
.setAttribute(attrName
.toUpperCase(), 'second');
53 element
.setAttributeNS(namespace, attrName
, 'first');
54 element
.setAttributeNS(namespace, attrName
.toUpperCase(), 'second');
58 function createElementForCheck(number
, name
, namespace) {
60 if (typeof(namespace) == 'undefined')
61 newElement
= document
.createElement(name
);
63 newElement
= document
.createElementNS(namespace, name
);
65 newElement
.id
= "test" + number
;
66 document
.getElementById("javascriptTests").appendChild(newElement
);
70 function createAndCheckAttributes(element
, attrName
, namespace) {
71 createAttributesForCheck(element
, attrName
, namespace);
72 checkAttribute(element
, attrName
, namespace);