File: 011-manual.html

package info (click to toggle)
firefox 145.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,653,528 kB
  • sloc: cpp: 7,594,999; javascript: 6,459,658; ansic: 3,752,909; python: 1,403,455; xml: 629,809; asm: 438,679; java: 186,421; sh: 67,287; makefile: 19,169; objc: 13,086; perl: 12,982; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (63 lines) | stat: -rw-r--r-- 2,112 bytes parent folder | download | duplicates (33)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!doctype html>
<html>
  <head>
    <title>allowTargetOrigin should only block dragenter, dragover, dragleave and drop events</title>
    <style type="text/css">
div { height: 100px; width: 100px; background: orange; margin: 0; padding: 0; float: left; }
div + div { background: blue; }
    </style>
    <script type="text/javascript">
window.onload = function () {
  var orange = document.getElementsByTagName('div')[0], evtdone = {}, fails = [];
  orange.ondragstart = function (e) {
    evtdone[e.type] = true;
    e.dataTransfer.effectAllowed = 'copy';
    e.dataTransfer.setData('text','dummy text');
    try {
      e.dataTransfer.allowTargetOrigin('http://example.com');
    } catch(e) {
      fails[fails.length] = 'allowTargetOrigin threw an error: '+e;
    }
  };
  orange.ondragenter = orange.ondragover = orange.ondrop = function (e) {
    e.preventDefault();
    evtdone[e.type] = true;
  };
  orange.ondrag = orange.ondragleave = function (e) {
    evtdone[e.type] = true;
  };
  orange.ondragend = function (e) {
    evtdone[e.type] = true;
    if( !evtdone.dragstart ) {
      fails[fails.length] = 'dragstart did not fire - how did that happen?';
    }
    if( !evtdone.drag ) {
      fails[fails.length] = 'drag did not fire';
    }
    if( !evtdone.dragend ) {
      fails[fails.length] = 'dragend did not fire - OK, who broke the testcase?';
    }
    if( evtdone.dragenter ) {
      fails[fails.length] = 'dragenter fired';
    }
    if( evtdone.dragover ) {
      fails[fails.length] = 'dragover fired';
    }
    if( evtdone.dragleave ) {
      fails[fails.length] = 'dragleave fired';
    }
    if( evtdone.drop ) {
      fails[fails.length] = 'drop fired';
    }
    document.getElementsByTagName('p')[0].innerHTML = fails.length ? ( 'FAIL:<br>' + fails.join('<br>') ) : 'PASS';
  };
};
    </script>
  </head>
  <body>
    <p>Drag the orange square over the blue square then back to the orange square, then release it. Fail if this text does not change.</p>
    <div draggable="true"></div>
    <div></div>
    <noscript><p>Enable JavaScript and reload</p></noscript>
  </body>
</html>