summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/events/032.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/events/032.html')
-rw-r--r--testing/web-platform/tests/html/editing/dnd/events/032.html81
1 files changed, 81 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/events/032.html b/testing/web-platform/tests/html/editing/dnd/events/032.html
new file mode 100644
index 0000000000..a928a3c425
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/events/032.html
@@ -0,0 +1,81 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Drag and drop passing over body without cancelling dragenter</title>
+ <style type="text/css">
+div:first-child {
+ height: 100px;
+ width: 100px;
+ background: orange;
+ display: inline-block;
+}
+div:first-child + div {
+ height: 100px;
+ width: 100px;
+ margin-left: 200px;
+ background: blue;
+ display: inline-block;
+}
+ </style>
+ <script type="text/javascript">
+//this test enforces the following spec statement:
+//"if this immediate user selection is not the same as the current target element"
+window.onload = function () {
+ var drag = document.getElementsByTagName('div')[0], sequence = [];
+ drag.ondragstart = function (e) {
+ e.dataTransfer.setData('text','hello');
+ e.dataTransfer.effectAllowed = 'copy';
+ };
+ drag.ondragenter = function (e) {
+ sequence[sequence.length] = 'drag.dragenter';
+ };
+ drag.ondragover = function (e) {
+ if( sequence[sequence.length-1] != 'drag.dragover' ) {
+ sequence[sequence.length] = 'drag.dragover';
+ }
+ };
+ var drop = document.getElementsByTagName('div')[1];
+ drop.ondragenter = function (e) {
+ e.preventDefault();
+ sequence[sequence.length] = 'drop.dragenter';
+ };
+ drop.ondragover = function (e) {
+ e.preventDefault();
+ if( sequence[sequence.length-1] != 'drop.dragover' ) {
+ sequence[sequence.length] = 'drop.dragover';
+ }
+ };
+ drop.ondrop = function (e) {
+ e.preventDefault();
+ sequence[sequence.length] = 'drop.ondrop';
+ };
+ document.body.ondragenter = function (e) {
+ sequence[sequence.length] = ( e.target == this ) ? 'body.dragenter' : 'bubble.dragenter';
+ };
+ document.body.ondragover = function (e) {
+ if( e.target != this ) { return; }
+ if( sequence[sequence.length-1] != 'body.dragover' ) {
+ sequence[sequence.length] = 'body.dragover';
+ }
+ };
+ drag.ondragend = function (e) {
+ sequence = sequence.join('=&gt;')
+ var desiredsequence = (['drag.dragenter','bubble.dragenter','body.dragenter','body.dragover','drop.dragenter','bubble.dragenter','drop.dragover','drop.ondrop']).join('=&gt;')
+ if( sequence == desiredsequence ) {
+ document.getElementsByTagName('div')[2].innerHTML = 'PASS';
+ } else {
+ document.getElementsByTagName('div')[2].innerHTML = 'FAIL, got:<br>'+sequence+'<br>instead of:<br>'+desiredsequence;
+ }
+ };
+};
+ </script>
+ </head>
+ <body>
+
+ <div draggable="true"></div><div></div>
+ <div>&nbsp;</div>
+ <p>Drag the orange square onto the blue square and release it.</p>
+ <noscript><p>Enable JavaScript and reload</p></noscript>
+
+ </body>
+</html>