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:
Wayne Loopy 2017-07-11 15:44:08 +09:00 committed by GitHub
parent 0a1b5a0d7e
commit bc0f3b1bf8

View file

@ -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>
```