Skip to content

Commit

Permalink
Remove autoDiscover
Browse files Browse the repository at this point in the history
  • Loading branch information
enyo committed Oct 25, 2021
1 parent 2dd7a5d commit 6b6aca9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 5,9 @@
- Dropzone is dropping IE support! If you still need to support IE, please use
`5.9.3`. You can download it here:
https://github.com/dropzone/dropzone/releases/download/v5.9.3/dist.zip
- `Dropzone.autoDiscover` has been removed! If you want to auto discover your
elements, invoke `Dropzone.discover()` after your HTML has loaded and it will
do the same.
- The `dropzone-amd-module` files have been removed. There is now a
`dropzone.js` and a `dropzone.mjs` in the dist folder.
- The `min/` folder has been removed. `dropzone.min.js` is now the only
Expand Down
15 changes: 0 additions & 15 deletions src/dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1706,10 1706,6 @@ Dropzone.version = "dev";
//
// Dropzone.options.myDropzoneElementId = { maxFilesize: 1 };
//
// To disable autoDiscover for a specific element, you can set `false` as an option:
//
// Dropzone.options.myDisabledElementId = false;
//
// And in html:
//
// <form action="/upload" id="my-dropzone-element-id" class="dropzone"></form>
Expand Down Expand Up @@ -1741,9 1737,6 @@ Dropzone.forElement = function (element) {
return element.dropzone;
};

// Set to false if you don't want Dropzone to automatically find and attach to .dropzone elements.
Dropzone.autoDiscover = true;

// Looks for all .dropzone elements and creates a dropzone for them
Dropzone.discover = function () {
let dropzones;
Expand Down Expand Up @@ -2274,14 2267,6 @@ let contentLoaded = function (win, fn) {
}
};

// As a single function to be able to write tests.
Dropzone._autoDiscoverFunction = function () {
if (Dropzone.autoDiscover) {
return Dropzone.discover();
}
};
contentLoaded(window, Dropzone._autoDiscoverFunction);

function __guard__(value, transform) {
return typeof value !== "undefined" && value !== null
? transform(value)
Expand Down
21 changes: 0 additions & 21 deletions test/unit_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,27 303,6 @@ describe("Dropzone", function () {
it("should not create dropzones with disabled options", () =>
expect(element2.dropzone).to.not.be.ok);
});

return describe("Dropzone.autoDiscover", function () {
before(function () {
Dropzone.options.testElement3 = { url: "test-url" };
return document.body.appendChild(element3);
});
after(() => document.body.removeChild(element3));

it("should create dropzones even if Dropzone.autoDiscover == false", function () {
// Because the check is in the actual contentLoaded function.
Dropzone.autoDiscover = false;
Dropzone.discover();
return expect(element3.dropzone).to.be.ok;
});

it("should not automatically be called if Dropzone.autoDiscover == false", function () {
Dropzone.autoDiscover = false;
Dropzone.discover = () => expect(false).to.be.ok;
return Dropzone._autoDiscoverFunction();
});
});
});

describe("Dropzone.isValidFile()", function () {
Expand Down

0 comments on commit 6b6aca9

Please sign in to comment.