Files
servo/tests/wpt/web-platform-tests/html/editing/dnd/events/events-non-draggable-001.html

61 lines
1.3 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<meta charset='utf-8'>
<title>drag &amp; drop events should not fire with non-draggable elements 001</title>
<style type="text/css">
div {
height: 200px;
width: 200px;
background-color: orange;
position: absolute;
top: 8px;
left: 8px;
}
div + p {
margin-top: 220px;
}
</style>
<script>
window.onload = function() {
var elem = document.getElementsByTagName('div')[0];
var pass = true;
function fail() {
pass = false;
}
elem.addEventListener('drag',fail,false);
elem.addEventListener('dragend',fail,false);
elem.addEventListener('dragenter',fail,false);
elem.addEventListener('dragleave',fail,false);
elem.addEventListener('dragover',fail,false);
elem.addEventListener('dragstart',fail,false);
elem.addEventListener('drop',fail,false);
elem.ondrag = fail;
elem.ondragend = fail;
elem.ondragenter = fail;
elem.ondragleave = fail;
elem.ondragover = fail;
elem.ondragstart = fail;
elem.ondrop = fail;
elem.onmouseup = function () {
setTimeout(function () {
if (pass == true) {
document.body.innerHTML = 'PASS';
} else {
document.body.innerHTML = 'FAIL';
}
}, 100 );
};
}
</script>
<div></div>
<p>Click once on the orange box above, without moving the mouse while
clicking. The word &quot;PASS&quot; should appear.</p>