Skip to content

Commit

Permalink
start cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCARPi committed Dec 4, 2023
1 parent cb616b9 commit b3fd5c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 75 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dropzone",
"version": "6.0.0-beta.2",
"version": "7.0.0",
"description": "Handles drag and drop of files for you.",
"keywords": [
"dragndrop",
Expand Down
77 changes: 3 additions & 74 deletions src/dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ export default class Dropzone extends Emitter {
this.element = document.querySelector(this.element);
}

// Not checking if instance of HTMLElement or Element since IE9 is extremely weird.
if (!this.element || this.element.nodeType == null) {
throw new Error("Invalid dropzone element.");
// make sure we actually have an HTML Element
if (!this.element instanceof HTMLElement) {
throw new Error("Invalid dropzone element: not an instance of HTMLElement.");
}

if (this.element.dropzone) {
Expand Down Expand Up @@ -122,18 +122,6 @@ export default class Dropzone extends Emitter {
throw new Error("You cannot set both: binaryBody and uploadMultiple.");
}

// Backwards compatibility
if (this.options.acceptedMimeTypes) {
this.options.acceptedFiles = this.options.acceptedMimeTypes;
delete this.options.acceptedMimeTypes;
}

// Backwards compatibility
if (this.options.renameFilename != null) {
this.options.renameFile = (file) =>
this.options.renameFilename.call(this, file.name, file);
}

if (typeof this.options.method === "string") {
this.options.method = this.options.method.toUpperCase();
}
Expand Down Expand Up @@ -2245,65 +2233,6 @@ class ExifRestore {
}
ExifRestore.initClass();

/*
* contentloaded.js
*
* Author: Diego Perini (diego.perini at gmail.com)
* Summary: cross-browser wrapper for DOMContentLoaded
* Updated: 20101020
* License: MIT
* Version: 1.2
*
* URL:
* http://javascript.nwbox.com/ContentLoaded/
* http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
*/

// @win window reference
// @fn function reference
let contentLoaded = function (win, fn) {
let done = false;
let top = true;
let doc = win.document;
let root = doc.documentElement;
let add = doc.addEventListener ? "addEventListener" : "attachEvent";
let rem = doc.addEventListener ? "removeEventListener" : "detachEvent";
let pre = doc.addEventListener ? "" : "on";
var init = function (e) {
if (e.type === "readystatechange" && doc.readyState !== "complete") {
return;
}
(e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
if (!done && (done = true)) {
return fn.call(win, e.type || e);
}
};

var poll = function () {
try {
root.doScroll("left");
} catch (e) {
setTimeout(poll, 50);
return;
}
return init("poll");
};

if (doc.readyState !== "complete") {
if (doc.createEventObject && root.doScroll) {
try {
top = !win.frameElement;
} catch (error) {}
if (top) {
poll();
}
}
doc[add](pre + "DOMContentLoaded", init, false);
doc[add](pre + "readystatechange", init, false);
return win[add](pre + "load", init, false);
}
};

function __guard__(value, transform) {
return typeof value !== "undefined" && value !== null
? transform(value)
Expand Down

0 comments on commit b3fd5c4

Please sign in to comment.