Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit d22b879

Browse files
committed
v0.11.5 🌹
1 parent fda991c commit d22b879

File tree

7 files changed

+80
-65
lines changed

7 files changed

+80
-65
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Changelog
22
=========
3+
### 0.11.5
4+
* Fixed an event binding order issue when the form is reset. ([#375](https://github.com/1000hz/bootstrap-validator/pull/375))
5+
36
### 0.11.3
47
* Fixed `.has-success` not being cleared if a field `.has-feedback` and has it's value cleared. Shoutout to [@net](https://github.com/1000hz/bootstrap-validator/pull/375) for bringing the bugs fixed in 0.11.1 - 0.11.3 to my attention.
58

dist/validator.js

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Validator v0.11.3 for Bootstrap 3, by @1000hz
2+
* Validator v0.11.5 for Bootstrap 3, by @1000hz
33
* Copyright 2016 Cina Saffary
44
* Licensed under http://opensource.org/licenses/MIT
55
*
@@ -30,7 +30,7 @@
3030

3131
this.$element.on('input.bs.validator change.bs.validator focusout.bs.validator', $.proxy(this.onInput, this))
3232
this.$element.on('submit.bs.validator', $.proxy(this.onSubmit, this))
33-
this.$element.on('reset.bs.validator', $.proxy(this.onReset, this))
33+
this.$element.on('reset.bs.validator', $.proxy(this.reset, this))
3434

3535
this.$element.find('[data-match]').each(function () {
3636
var $this = $(this)
@@ -47,7 +47,7 @@
4747
this.toggleSubmit()
4848
}
4949

50-
Validator.VERSION = '0.11.3'
50+
Validator.VERSION = '0.11.5'
5151

5252
Validator.INPUT_SELECTOR = ':input:not([type="hidden"], [type="submit"], [type="reset"], button)'
5353

@@ -285,56 +285,62 @@
285285
this.$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
286286
}
287287

288-
Validator.prototype.onReset = function (e) {
289-
var self = this
290-
var options = this.options
291-
292-
window.setTimeout(function () {
293-
self.destroy()
294-
Plugin.call(self.$element, options)
295-
}, 0)
296-
}
297-
298288
Validator.prototype.defer = function ($el, callback) {
299289
callback = $.proxy(callback, this, $el)
300290
if (!this.options.delay) return callback()
301291
window.clearTimeout($el.data('bs.validator.timeout'))
302292
$el.data('bs.validator.timeout', window.setTimeout(callback, this.options.delay))
303293
}
304294

305-
Validator.prototype.destroy = function () {
306-
this.$element
307-
.removeAttr('novalidate')
308-
.removeData('bs.validator')
309-
.off('.bs.validator')
310-
.find('.form-control-feedback')
311-
.removeClass([this.options.feedback.error, this.options.feedback.success].join(' '))
295+
Validator.prototype.reset = function () {
296+
this.$element.find('.form-control-feedback')
297+
.removeClass(this.options.feedback.error)
298+
.removeClass(this.options.feedback.success)
312299

313300
this.$inputs
314-
.off('.bs.validator')
315301
.removeData(['bs.validator.errors', 'bs.validator.deferred'])
316302
.each(function () {
317303
var $this = $(this)
318304
var timeout = $this.data('bs.validator.timeout')
319305
window.clearTimeout(timeout) && $this.removeData('bs.validator.timeout')
320306
})
321307

322-
this.$element.find('.help-block.with-errors').each(function () {
323-
var $this = $(this)
324-
var originalContent = $this.data('bs.validator.originalContent')
308+
this.$element.find('.help-block.with-errors')
309+
.each(function () {
310+
var $this = $(this)
311+
var originalContent = $this.data('bs.validator.originalContent')
325312

326-
$this
327-
.removeData('bs.validator.originalContent')
328-
.html(originalContent)
329-
})
313+
$this
314+
.removeData('bs.validator.originalContent')
315+
.html(originalContent)
316+
})
330317

331-
this.$element.find('input[type="submit"], button[type="submit"]').removeClass('disabled')
318+
this.$btn.removeClass('disabled')
332319

333320
this.$element.find('.has-error, .has-danger, .has-success').removeClass('has-error has-danger has-success')
334321

335322
return this
336323
}
337324

325+
Validator.prototype.destroy = function () {
326+
this.reset()
327+
328+
this.$element
329+
.removeAttr('novalidate')
330+
.removeData('bs.validator')
331+
.off('.bs.validator')
332+
333+
this.$inputs
334+
.off('.bs.validator')
335+
336+
this.options = null
337+
this.validators = null
338+
this.$element = null
339+
this.$btn = null
340+
341+
return this
342+
}
343+
338344
// VALIDATOR PLUGIN DEFINITION
339345
// ===========================
340346

dist/validator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)