diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/editing/dnd/events/033.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/events/033.html')
-rw-r--r-- | testing/web-platform/tests/html/editing/dnd/events/033.html | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/events/033.html b/testing/web-platform/tests/html/editing/dnd/events/033.html new file mode 100644 index 0000000000..d06bee3d8d --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/events/033.html @@ -0,0 +1,79 @@ +<!doctype html> +<html> + <head> + <title>Drag and drop without cancelling dragenter from non-target to non-target</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; + background: blue; + display: inline-block; +} + </style> + <script type="text/javascript"> +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'; + } + }; + drag.ondragleave = function (e) { + sequence[sequence.length] = 'drag.dragleave'; + }; + var drop = document.getElementsByTagName('div')[1]; + drop.ondragenter = function (e) { + sequence[sequence.length] = 'drop.dragenter'; + }; + drop.ondragover = function (e) { + 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('=>') + var desiredsequence = (['drag.dragenter','bubble.dragenter','body.dragenter','body.dragover','drop.dragenter','bubble.dragenter','body.dragover']).join('=>') + 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> </div> + <p>Drag the orange square onto the blue square and release it.</p> + <noscript><p>Enable JavaScript and reload</p></noscript> + + </body> +</html> |