• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html>
2<html>
3<head>
4<script>
5
6var expectedEvents = ["dragstart", "dragend"];
7var i = 0;
8
9function recordEvent(e) {
10    log(e.type);
11    if (e.type !== expectedEvents[i]) {
12        log("FAIL - expected " + expectedEvents[i] + " but got " + e.type);
13    } else if (i == expectedEvents.length - 1) {
14        log("SUCCESS");
15    } else {
16        i++;
17    }
18}
19
20
21function log(msg) {
22    var tn = document.createTextNode(msg + "\n");
23    document.getElementById("log").appendChild(tn);
24}
25
26function dragStart(e) {
27    recordEvent(e);
28}
29
30document.ondragend = function(e) {
31    recordEvent(e);
32};
33
34document.ondrop = function(e) {
35    log("FAIL - we should not get a " + e.type);
36};
37
38document.ondragenter = document.ondragover = function(e) {
39    e.preventDefault();
40};
41
42
43</script>
44</head>
45<body>
46    <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=26699">https://bugs.webkit.org/show_bug.cgi?id=26699</a></p>
47
48    <p>Instructions: </p>
49
50    <p>Drag the "Drag Me!" link below</p>
51    <p>Press escape</p>
52
53    <a id="test-link" href="http://webkit.org" ondragstart="dragStart(event)">Drag Me!</a>
54
55    <pre id="log"></pre>
56</body>
57</html>
58