[Zope3-checkins]
SVN: Zope3/branches/benji-testbrowser-with-real-browsers-take-2/src/zope/testbrowser/real/__resources__/commands.js
clean up code a bit
Benji York
benji at zope.com
Sat Aug 19 18:24:52 EDT 2006
Log message for revision 69698:
clean up code a bit
Changed:
U Zope3/branches/benji-testbrowser-with-real-browsers-take-2/src/zope/testbrowser/real/__resources__/commands.js
-=-
Modified: Zope3/branches/benji-testbrowser-with-real-browsers-take-2/src/zope/testbrowser/real/__resources__/commands.js
===================================================================
--- Zope3/branches/benji-testbrowser-with-real-browsers-take-2/src/zope/testbrowser/real/__resources__/commands.js 2006-08-19 22:13:47 UTC (rev 69697)
+++ Zope3/branches/benji-testbrowser-with-real-browsers-take-2/src/zope/testbrowser/real/__resources__/commands.js 2006-08-19 22:24:52 UTC (rev 69698)
@@ -38,59 +38,37 @@
}
function _tb_rememberLinkN(info) {
- function getElementsByTagNames(tagNames,obj) {
- if (!obj) var obj = document;
- var resultArray = new Array();
- for (var i=0;i<tagNames.length;i++) {
- var tags = obj.getElementsByTagName(tagNames[i]);
- for (var j=0;j<tags.length;j++) {
- resultArray.push(tags[j]);
+ function getElementsByTagNames(names, obj) {
+ var results = [];
+ if (obj == undefined) {
+ var obj = document;
+ }
+
+ for (var i=0; i<names.length; i++) {
+ var elements = obj.getElementsByTagName(names[i]);
+ for (var j=0; j<elements.length; j++) {
+ results.push(elements[j]);
}
}
- var testNode = resultArray[0];
+
+ var testNode = results[0];
if (!testNode) return [];
if (testNode.sourceIndex) {
- resultArray.sort(function (a,b) {
+ results.sort(function (a,b) {
return a.sourceIndex - b.sourceIndex;
});
}
else if (testNode.compareDocumentPosition) {
- resultArray.sort(function (a,b) {
+ results.sort(function (a,b) {
return 3 - (a.compareDocumentPosition(b) & 6);
});
}
- return resultArray;
+ return results;
}
-// function getElementsByTagNames(names, node) {
-// var results = [];
-// for (var i in names) {
-// var tags = node.getElementsByTagName(names[i]);
-// for (var j in tags) {
-// results.push(tags[j]);
-// }
-// }
-// var example = results[0];
-// if (!example) return [];
-
-// if (example.sourceIndex) {
-// results.sort(function (a,b) {return a.sourceIndex - b.sourceIndex;});
-// }
-// else if (example.compareDocumentPosition) {
-// results.sort(function (a,b) {
-// return 3 - (a.compareDocumentPosition(b) & 6);
-// });
-// }
-// return results;
-// }
-
- log(info);
var links = getElementsByTagNames(['a', 'area'], top.frames[0].document);
var id = _tb_remembered_links.length;
_tb_remembered_links[id] = links[info[0]];
- log(links.length);
- log(id);
- log(_tb_remembered_links[id]);
return id;
}
More information about the Zope3-Checkins
mailing list