| <!DOCTYPE html> |
| <html> |
| <body onload="test()"> |
| <p> |
| This test checks that a long press gesture on an file input button does not crash on iOS. |
| Press and hold on the file input button below until you see the word "PASS". |
| </p> |
| <p id="result">Test not running</p> |
| <p> |
| <input type="file" id="filecontrol"> |
| </p> |
| <script> |
| var timer; |
| var pass; |
| function setText(s) |
| { |
| document.getElementById("result").innerHTML = s; |
| } |
| |
| function test() { |
| var input = document.getElementById("filecontrol"); |
| input.onclick = function(e) { e.preventDefault(); } |
| input.ontouchstart = function() { |
| setText("Wait..."); |
| passed = false; |
| timer = window.setTimeout(function() { setText("PASS"); passed = true; }, 1000); |
| } |
| input.ontouchend = input.ontouchmove = function() { |
| if (passed) |
| return; |
| setText("Try again"); |
| window.clearTimeout(timer); |
| } |
| } |
| </script> |
| </body> |
| </html> |