def getChildIndex(parent, toFind):
    JS("""
    var count = 0, child = @{{parent}}['firstChild'];
    while (child) {
        if (child == @{{toFind}})
            return count;
        if (child['nodeType'] == 1)
            ++count;
        child = child['nextSibling'];
    }

    return -1;
    """)
Return the index of the given child in the given parent.
dataset/ETHPy150Open pyjs/pyjs/pyjswidgets/pyjamas/DOM.browser.py/getChildIndex