Skip to content

Instantly share code, notes, and snippets.

@druska
druska / native_js_drag_and_drop_helper.js
Created Aug 26, 2015
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
View native_js_drag_and_drop_helper.js
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)