def iterChildren(elem):
    JS("""
    var parent = @{{elem}};
    var child = @{{elem}}['firstChild'];
    var lastChild = null;
    return {
        'next': function() {
            if (child == null) {
                throw @{{StopIteration}};
            }
            lastChild = child;
            child = @{{getNextSibling}}(child);
            return lastChild;
        },
        'remove': function() {
            parent['removeChild'](lastChild);
        },
        __iter__: function() {
            return this;
        }
    };
    """)
Returns an iterator over all the children of the given
dataset/ETHPy150Open pyjs/pyjs/pyjswidgets/pyjamas/DOM.browser.py/iterChildren