Skip to content

Truly independent web browser

1.0 KB
Raw Blame
<!doctype html>
<style>body{margin:0}#target{width:100px;height:100px}</style>
<div id="target"></div>
<script src="../include.js"></script>
<script>
asyncTest(async done => {
    let target = document.getElementById("target");
    for (const type of ["touchstart", "touchmove", "touchend"])
        target.addEventListener(type, event => {
            println(`${type}: target=${event.target.id}, connected=${event.target.isConnected}, touches=${event.touches.length}`);
            if (type === "touchstart") {
                event.preventDefault();
                event.target.remove();
                target = null;
            }
        }, {passive:false});
    const send = actions => internals.performActions(JSON.stringify({actions:[{type:"pointer",id:"contact",parameters:{pointerType:"touch"},actions}]}));
    await send([{type:"pointerMove",x:20,y:20},{type:"pointerDown",button:0}]);
    internals.gc();
    await send([{type:"pointerMove",x:30,y:30},{type:"pointerUp",button:0}]);
    done();
});
</script>