summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/events/010.xhtml
blob: bbc2254282548174675148ec0d35bf5293e53545 (plain)
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
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Drag and drop of selection from iframe</title>
<style type="text/css">
div
  {width:0;
  height:0;
  border:solid 50px silver;
  border-radius:50px;
  margin-left:auto;}
iframe
  {width:100%;
  height:300px;}
</style>
<script type="application/ecmascript">
var step = 1;
function enterPage(event)
  {event.preventDefault();
  if(step++ > 0)
    {setColor('green silver silver silver');}
  else
    {step = 0;
    setColor('maroon');
    say('Dragenter should fire before dragover and drop');}
  }
function overPage(event)
  {event.preventDefault();
  if(step++ > 1)
    {setColor('green green silver silver');}
  else
    {step = 0;
    setColor('maroon');
    say('Dragover should fire after dragenter');}
  }
function dropIt(event)
  {if(step++ > 1)
    {setColor('green');}
  else
    {step = 0;
    setColor('maroon');
    say('Dragover should fire after dragenter');}
  }
function say(it)
  {document.querySelector('pre').appendChild(document.createTextNode(it + '\n'))}
function setColor(c)
  {document.querySelector('div').setAttribute('style','border-color:' + c)}
</script>
</head>
<body ondragenter="enterPage(event)" ondragover="overPage(event)" ondrop="dropIt(event)">
<iframe src="helper-drag-me-p-with-circle.xhtml">XHTML document</iframe>
<div/>
<pre/>
</body>
</html>