When I set an data attribute 'data-dropify' with something truthy on my element and call element.data() the library do not instantiate the object Dropify correctly as the if results in false.
<input data-dropify="true">My input</input>
var input = $('[data-dropify="true"]');
var data = input.data();
input.dropify({});
$.fn[pluginName] = function(options) {
this.each(function() {
// as the data-attribute data-dropify is something truthy and not
// the Dropify instance it will not create it but will not work too.
if (!$.data(this, pluginName)) {
$.data(this, pluginName, new Dropify(this, options));
}
});
return this;
};
So naming data-dropify data attribute is not a good pratice, but it would be better to the library to not depend on this, making a validation that the result of this call is the Dropify object and not something truthy only.
Hello
When I set an data attribute 'data-dropify' with something truthy on my element and call
element.data()
the library do not instantiate the object Dropify correctly as theif
results in false.So naming data-dropify data attribute is not a good pratice, but it would be better to the library to not depend on this, making a validation that the result of this call is the
Dropify
object and not something truthy only.