Author: justi9
Date: 2009-06-17 09:43:53 -0400 (Wed, 17 Jun 2009)
New Revision: 3453
Modified:
mgmt/trunk/wooly/resources/wooly.js
Log:
Clean up whitespace; handle no-content updates
Modified: mgmt/trunk/wooly/resources/wooly.js
===================================================================
--- mgmt/trunk/wooly/resources/wooly.js 2009-06-16 20:20:52 UTC (rev 3452)
+++ mgmt/trunk/wooly/resources/wooly.js 2009-06-17 13:43:53 UTC (rev 3453)
@@ -231,7 +231,7 @@
child = child.nextSibling;
}
return null;
- }
+ }
function copyNode(node) {
switch (node.nodeType) {
@@ -325,17 +325,24 @@
if (oldElem) {
var newElem = child.firstChild;
- if (newElem.nodeType != 1) {
+ while (newElem && newElem.nodeType != 1) {
newElem = newElem.nextSibling;
}
- var updateId = newElem.getAttribute("update");
- // only update a sub-block of html
- if (updateId) {
- oldElem = document.getElementById(updateId);
- newElem = xmlGetElementById(newElem, updateId);
+ if (newElem) {
+ // only update a sub-block of html
+
+ var updateId = newElem.getAttribute("update");
+
+ if (updateId) {
+ oldElem = document.getElementById(updateId);
+ newElem = xmlGetElementById(newElem, updateId);
+ }
+
+ replaceNode(newElem, oldElem);
+ } else {
+ oldElem.parentNode.removeChild(oldElem);
}
- replaceNode(newElem, oldElem);
} else {
wooly.log("Element '" + id + "' not
found");
}
@@ -406,7 +413,7 @@
this.intervalUpdateInfo.interval = interval;
this.intervalUpdateInfo.passback = passback;
}
-
+
function update() {
try {
if (req.readyState == 4 && req.status == 200) {
@@ -441,7 +448,7 @@
this.restartIntervalUpdate = function (url) {
this.cancelIntervalUpdate();
- this.setIntervalUpdate(url, this.intervalUpdateInfo.callback,
+ this.setIntervalUpdate(url, this.intervalUpdateInfo.callback,
this.intervalUpdateInfo.interval,
this.intervalUpdateInfo.passback);
}
@@ -451,16 +458,16 @@
}
this.resumeIntervalUpdate = function () {
- wooly.setIntervalUpdate(wooly.intervalUpdateInfo.url,
- wooly.intervalUpdateInfo.callback,
+ wooly.setIntervalUpdate(wooly.intervalUpdateInfo.url,
+ wooly.intervalUpdateInfo.callback,
wooly.intervalUpdateInfo.interval,
wooly.intervalUpdateInfo.passback);
}
this.doubleIntervalUpdate = function () {
wooly.cancelIntervalUpdate();
wooly.intervalUpdateInfo.interval *= 2;
- wooly.setIntervalUpdate(wooly.intervalUpdateInfo.url,
- wooly.intervalUpdateInfo.callback,
+ wooly.setIntervalUpdate(wooly.intervalUpdateInfo.url,
+ wooly.intervalUpdateInfo.callback,
wooly.intervalUpdateInfo.interval,
wooly.intervalUpdateInfo.passback);
}
Show replies by date