isDragDropSupported.js 474 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. function isDragDropSupported() {
  3. const div = document.body;
  4. if (!('draggable' in div) || !('ondragstart' in div && 'ondrop' in div)) {
  5. return false;
  6. }
  7. if (!('FormData' in window)) {
  8. return false;
  9. }
  10. if (!('FileReader' in window)) {
  11. return false;
  12. }
  13. return true;
  14. }
  15. /**
  16. * Checks if the browser supports Drag & Drop (not supported on mobile devices, for example).
  17. *
  18. * @returns {boolean}
  19. */
  20. module.exports = isDragDropSupported;