-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api(dispatchEvent): page, frame and handle versions added (#1932)
- Loading branch information
1 parent
671cfa0
commit c1c0237
Showing
10 changed files
with
332 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html lang=en> | ||
<title>Examples of DataTransfer's setData(), getData() and clearData()</title> | ||
<meta content="width=device-width"> | ||
<style> | ||
div:not(.mouse-helper) { | ||
margin: 0em; | ||
padding: 2em; | ||
} | ||
#source { | ||
color: blue; | ||
border: 1px solid black; | ||
} | ||
#target { | ||
border: 1px solid black; | ||
} | ||
div:not(.mouse-helper) { | ||
margin: 0em; | ||
padding: 2em; | ||
} | ||
#source { | ||
color: blue; | ||
border: 1px solid black; | ||
} | ||
#target { | ||
border: 1px solid black; | ||
} | ||
</style> | ||
|
||
<script> | ||
|
||
function dragstart_handler(ev) { | ||
console.log("dragStart"); | ||
// Change the source element's background color to signify drag has started | ||
ev.currentTarget.style.border = "dashed"; | ||
// Set the drag's format and data. Use the event target's id for the data | ||
ev.dataTransfer.setData("text/plain", ev.target.id); | ||
ev.currentTarget.style.border = "dashed"; | ||
ev.dataTransfer.setData("text/plain", ev.target.id); | ||
} | ||
|
||
function dragover_handler(ev) { | ||
console.log("dragOver"); | ||
ev.preventDefault(); | ||
ev.preventDefault(); | ||
} | ||
|
||
function drop_handler(ev) { | ||
console.log("Drop"); | ||
ev.preventDefault(); | ||
// Get the data, which is the id of the drop target | ||
var data = ev.dataTransfer.getData("text"); | ||
ev.target.appendChild(document.getElementById(data)); | ||
// Clear the drag data cache (for all formats/types) | ||
ev.dataTransfer.clearData(); | ||
console.log("Drop"); | ||
ev.preventDefault(); | ||
var data = ev.dataTransfer.getData("text"); | ||
ev.target.appendChild(document.getElementById(data)); | ||
ev.dataTransfer.clearData(); | ||
} | ||
</script> | ||
|
||
<body> | ||
<script src="input/mouse-helper.js"></script> | ||
<h1>Examples of <code>DataTransfer</code>: <code>setData()</code>, <code>getData()</code>, <code>clearData()</code></h1> | ||
<div> | ||
<p id="source" ondragstart="dragstart_handler(event);" draggable="true"> | ||
Select this element, drag it to the Drop Zone and then release the selection to move the element.</p> | ||
</div> | ||
<div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">Drop Zone</div> | ||
<div> | ||
<p id="source" ondragstart="dragstart_handler(event);" draggable="true"> | ||
Select this element, drag it to the Drop Zone and then release the selection to move the element.</p> | ||
</div> | ||
<div id="target" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">Drop Zone</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.