| 77 | } |
| 78 | |
| 79 | function compareHTML(a, b) { |
| 80 | // TODO - check CSS |
| 81 | // TODO - check head |
| 82 | |
| 83 | if (a.children.length !== b.children.length) { |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | for (let i = 0; i < a.children.length; i++) { |
| 88 | // first check that the tag name is similar |
| 89 | if (a.children[i].tagName !== b.children[i].tagName) { |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | // check attributes - TODO |
| 94 | if (a.children[i].attributes.length !== b.children[i].attributes.length) { |
| 95 | return false; |
| 96 | } |
| 97 | |
| 98 | for (let j = 0; j < a.children[i].attributes.length; j++) { |
| 99 | let attribute = a.children[i].attributes[j].name; |
| 100 | if (a.children[i].attributes[attribute].value !== b.children[i].attributes[attribute].value) { |
| 101 | return false; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | if (a.children[i].children.length === 0) { |
| 106 | if (a.children[i].innerHTML !== b.children[i].innerHTML) { |
| 107 | return false; |
| 108 | } |
| 109 | } else { |
| 110 | if (!compareHTML(a.children[i], b.children[i])) { |
| 111 | return false; |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | return true; |
| 117 | } |
| 118 | |
| 119 | function execute() { |
| 120 | maximizeDock(); |