/* tests:
*
* 1. click on children of .text should alert their index - PASS
* 2. click on other elements should not - PASS
* 3. if two nodes have the same content, a click on the latter should not return the index of the former - PASS
*/
// how to make it execute after document is loaded?
var content = "
a
e
t
7
1
a
",
textNodes = document.getElementsByClassName("text")[0]; // what if the server returned json, or content was an array.
textNodes.innerHTML = content;
function findIndex(node) { // does js have an api for the index?
var siblings,
sibling,
index;
siblings = node.parentNode.children;
for (index=0; index