this code is not care a bubbling event
So If you do not care bubbling equally, I think it should change like this.
This commit is contained in:
parent
0a1b5a0d7e
commit
bc0f3b1bf8
1 changed files with 9 additions and 11 deletions
|
@ -15,19 +15,17 @@ Example of getting a real path from a dragged-onto-the-app file:
|
|||
</div>
|
||||
|
||||
<script>
|
||||
const holder = document.getElementById('holder')
|
||||
holder.ondragover = () => {
|
||||
return false;
|
||||
}
|
||||
holder.ondragleave = holder.ondragend = () => {
|
||||
return false;
|
||||
}
|
||||
holder.ondrop = (e) => {
|
||||
e.preventDefault()
|
||||
document.addEventListener('drop', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
for (let f of e.dataTransfer.files) {
|
||||
console.log('File(s) you dragged here: ', f.path)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
document.addEventListener('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue