Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/editing/dnd/reload/004.html - WPT Dashboard Interop Dashboard
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Reload during text input selection drag and drop roundtrip</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/dnd.html#drag-and-drop-processing-model">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="support/drag-reload-test.js"></script>
<style>
body { margin: 20px; }
input { width: 8ch; }
</style>
<script>
function sourceDragStart(event) {
location.reload();
}
function targetDrop(event) {
event.preventDefault();
const data = event.dataTransfer.getData('text/plain');
event.currentTarget.value = data === 'Drag me' ? 'PASS' : 'FAIL';
}
</script>
</head>
<body>
<input id="source" value="Drag me"
ondragstart="sourceDragStart(event)" ondragenter="event.preventDefault()"
ondragover="event.preventDefault()" ondrop="targetDrop(event)">
<script>
window.addEventListener('load', () => {
const source = document.getElementById('source');
source.focus();
source.select();
});
testDragAcrossReload({
dataType: 'text/plain',
getExpectedData: source => source.value,
verifyDrop: target => {
assert_equals(target.value, 'PASS', 'The input receives the selection');
},
});
</script>
</body>
</html>