for (const type of ["dragover", "dragenter"]) {
target.addEventListener(type, event => {
event.dataTransfer.dropEffect = "copy";
event.preventDefault();
});
}
await (async function test_basic() {
const promiseDrop = new Promise(resolve => {
target.addEventListener("drop", event => {
event.preventDefault();
isnot(
document.querySelector("span:hover"),
target, "The target should not have hover state during the drop event propagation"
);
info("Waiting for mouseover event after drop event...");
target.addEventListener("mouseover", () => {
info("Got mouseover event");
resolve();
}, {once: true});
}, { once: true });
});
info("Dragging selection is the source element and drop it to the target...");
getSelection().selectAllChildren(source);
synthesizePlainDragAndDrop({
srcSelection: getSelection(),
destElement: target,
});
await promiseDrop;
await new Promise(resolve =>
requestAnimationFrame(() => requestAnimationFrame(resolve))
);
is(
document.querySelector("span:hover"),
target, "test_basic: The drop target should have hover state"
);
})();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.