aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/dd/html5drop.htm
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/dd/html5drop.htm
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz
vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/dd/html5drop.htm')
-rw-r--r--uitest/src/com/vaadin/tests/dd/html5drop.htm51
1 files changed, 51 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/dd/html5drop.htm b/uitest/src/com/vaadin/tests/dd/html5drop.htm
new file mode 100644
index 0000000000..ed05fcedea
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/dd/html5drop.htm
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+<script type="text/javascript">
+ if (window.addEventListener) {
+ window.addEventListener('load', init, false); //W3C
+ } else {
+ window.attachEvent('onload', init); //IE
+ }
+
+ function init(event) {
+ var el = document.getElementById("drop");
+ if (el.addEventListener) {
+ el.addEventListener("dragover", dragover, false);
+ el.addEventListener("dragenter", dragenter, false);
+ el.addEventListener("drop", drop, false);
+ } else if (el.attachEvent) {
+ el.attachEvent('ondragover', dragover);
+ el.attachEvent('ondragenter', dragenter);
+ el.attachEvent('ondrop', drop);
+ }
+ }
+
+ function dragover(event) {
+ event.dataTransfer.dropEffect = 'copy';
+ return cancel(event);
+ }
+
+ function drop(event) {
+ document.getElementById("drop").innerHTML = event.dataTransfer.getData('Text');
+ return cancel(event);
+ }
+
+ function dragenter(event) {
+ return cancel(event);
+ }
+
+ function cancel(event) {
+ if (event.preventDefault) {
+ event.preventDefault();
+ }
+ return false;
+ }
+</script>
+</head>
+<body>
+ <div id="drop">or over here</div>
+</body>
+</html> \ No newline at end of file