Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / resources / attr-case-sensitivity.js
blob0196c84af84117981eaf8a3c13dacd6141a680bb
1 function addCell(row, contents) {
2 var cell = document.createElementNS("http://www.w3.org/1999/xhtml","td");
3 row.appendChild(cell);
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);
13 addCell(newRow, id);
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) {
34 var first;
35 var second;
37 if (typeof(namespace) == 'undefined') {
38 first = element.getAttribute(attrName);
39 second = element.getAttribute(attrName.toUpperCase());
40 } else {
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');
52 } else {
53 element.setAttributeNS(namespace, attrName, 'first');
54 element.setAttributeNS(namespace, attrName.toUpperCase(), 'second');
58 function createElementForCheck(number, name, namespace) {
59 var newElement;
60 if (typeof(namespace) == 'undefined')
61 newElement = document.createElement(name);
62 else
63 newElement = document.createElementNS(namespace, name);
65 newElement.id = "test" + number;
66 document.getElementById("javascriptTests").appendChild(newElement);
67 return newElement;
70 function createAndCheckAttributes(element, attrName, namespace) {
71 createAttributesForCheck(element, attrName, namespace);
72 checkAttribute(element, attrName, namespace);