sha256 / Pristine

Vanilla javascript form validation micro-library
https://pristine.js.org/
MIT License
410 stars 81 forks source link

Reset deletes elements #53

Open brennaveen opened 3 years ago

brennaveen commented 3 years ago

The reset function (as well as the destroy function since it calls reset) actually deletes the elements from the dom. I do not believe this should be the intended behavior of a reset. I would expect it to simply remove the error and success statuses and reset the pristine instance to the state it was at before the form was validated. Am I thinking about this incorrectly?

This is the bit of code that removes the elements

Array.from(self.form.querySelectorAll('.' + PRISTINE_ERROR)).map(function (elem) {
    elem.parentNode.removeChild(elem);
});