 => {
        function onblur() {
            resolve();
            item.removeEventListener("blur", onblur);
        }
        item.addEventListener("blur", onblur);
        t.step_timeout(reject, timeout);
    });
}

test(t => {
    const old_parent = document.querySelector("#old_parent");
    const button = document.querySelector("#button");
    t.add_cleanup(() => old_parent.append(button));
    button.focus();
    assert_equals(document.activeElement, button);
    new_parent.moveBefore(button, null);
