[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/03: hydra: status: Make getElementsByName non-recursive.
From: |
Danny Milosavljevic |
Subject: |
03/03: hydra: status: Make getElementsByName non-recursive. |
Date: |
Sat, 5 May 2018 08:54:41 -0400 (EDT) |
dannym pushed a commit to branch master
in repository maintenance.
commit dd45860d80588693ef90b5a926826a3c7c439ae7
Author: Danny Milosavljevic <address@hidden>
Date: Sat May 5 14:52:10 2018 +0200
hydra: status: Make getElementsByName non-recursive.
* hydra/nginx/html/status/index.html (getElementsByName): Make lookup
non-recursive.
(ensurePackagegroupExists): Return the correct element (the tr).
---
hydra/nginx/html/status/index.html | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/hydra/nginx/html/status/index.html
b/hydra/nginx/html/status/index.html
index e263ca0..1c3e60a 100644
--- a/hydra/nginx/html/status/index.html
+++ b/hydra/nginx/html/status/index.html
@@ -166,12 +166,14 @@ function updateLatestbuildtime(td) {
}
function getElementsByName(root, name) {
- let childelements = root.getElementsByTagName("*"); // also returns
itself, sigh...
let result = [];
- Array.prototype.forEach.call(childelements, function(e) {
- if (root != e && e.name == name)
- result.push(e);
- });
+ let childNodes = root.childNodes;
+ let i = 0;
+ for (i = 0; i < childNodes.length; ++i) {
+ let childNode = childNodes[i];
+ if (childNode.nodeType == Node.ELEMENT_NODE && childNode.name
== name)
+ result.push(childNode);
+ }
return result;
}
@@ -256,7 +258,7 @@ function ensurePackagegroupExists(table, packagegroupid) {
tr.appendChild(buildtimes);
rootbody.appendChild(tr);
- packagegroups = [rootbody];
+ packagegroups = [tr];
}
return packagegroups[0];
}