.selenide-core.7.3.3.source-code.drag_and_drop_script.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenide-core Show documentation
Show all versions of selenide-core Show documentation
Selenide = concise API for Selenium WebDriver
(function() {
function createEvent(typeOfEvent) {
var event = document.createEvent("CustomEvent");
event.initCustomEvent(typeOfEvent, true, true, null);
event.dataTransfer = {
data: {},
setData: function(key, value) {
this.data[key] = value;
},
getData: function(key) {
return this.data[key];
}
};
return event;
}
function dispatchEvent(element, event, transferData) {
if (transferData !== undefined) {
event.dataTransfer = transferData;
}
if (element.dispatchEvent) {
element.dispatchEvent(event);
} else if (element.fireEvent) {
element.fireEvent("on" + event.type, event);
}
}
function dragAndDrop(element, target) {
var dragStartEvent = createEvent('dragstart');
dispatchEvent(element, dragStartEvent);
var dropEvent = createEvent('drop');
dispatchEvent(target, dropEvent, dragStartEvent.dataTransfer);
var dragEndEvent = createEvent('dragend');
dispatchEvent(element, dragEndEvent, dropEvent.dataTransfer);
}
return dragAndDrop(arguments[0], arguments[1]);
})(...arguments)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy