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

Commit bc9fd40

Browse files
committed
v0.11.1 still 🔛 🔝
1 parent 618f0e9 commit bc9fd40

File tree

7 files changed

+39
-13
lines changed

7 files changed

+39
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Changelog
22
=========
3+
### 0.11.1
4+
* Added a `reset` event listener on the form to reinitialize the plugin.
5+
* Fixed a missed bit of cleanup in `.validator('destroy')` where it wasn't removing the `.has-success` class.
6+
37
### 0.11.0
48
###### BREAKING CHANGES:
59
* Custom validators are now expected to return an error string if the field is invalid.

dist/validator.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Validator v0.11.0 for Bootstrap 3, by @1000hz
2+
* Validator v0.11.1 for Bootstrap 3, by @1000hz
33
* Copyright 2016 Cina Saffary
44
* Licensed under http://opensource.org/licenses/MIT
55
*
@@ -30,6 +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))
3334

3435
this.$element.find('[data-match]').each(function () {
3536
var $this = $(this)
@@ -46,7 +47,7 @@
4647
this.toggleSubmit()
4748
}
4849

49-
Validator.VERSION = '0.11.0'
50+
Validator.VERSION = '0.11.1'
5051

5152
Validator.INPUT_SELECTOR = ':input:not([type="hidden"], [type="submit"], button)'
5253

@@ -283,6 +284,16 @@
283284
this.$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
284285
}
285286

287+
Validator.prototype.onReset = function (e) {
288+
var self = this
289+
var options = this.options
290+
291+
window.setTimeout(function () {
292+
self.destroy()
293+
Plugin.call(self.$element, options)
294+
}, 0)
295+
}
296+
286297
Validator.prototype.defer = function ($el, callback) {
287298
callback = $.proxy(callback, this, $el)
288299
if (!this.options.delay) return callback()
@@ -318,7 +329,7 @@
318329

319330
this.$element.find('input[type="submit"], button[type="submit"]').removeClass('disabled')
320331

321-
this.$element.find('.has-error, .has-danger').removeClass('has-error has-danger')
332+
this.$element.find('.has-error, .has-danger, .has-success').removeClass('has-error has-danger has-success')
322333

323334
return this
324335
}

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.

docs/dist/validator.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Validator v0.11.0 for Bootstrap 3, by @1000hz
2+
* Validator v0.11.1 for Bootstrap 3, by @1000hz
33
* Copyright 2016 Cina Saffary
44
* Licensed under http://opensource.org/licenses/MIT
55
*
@@ -30,6 +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))
3334

3435
this.$element.find('[data-match]').each(function () {
3536
var $this = $(this)
@@ -46,7 +47,7 @@
4647
this.toggleSubmit()
4748
}
4849

49-
Validator.VERSION = '0.11.0'
50+
Validator.VERSION = '0.11.1'
5051

5152
Validator.INPUT_SELECTOR = ':input:not([type="hidden"], [type="submit"], button)'
5253

@@ -283,6 +284,16 @@
283284
this.$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
284285
}
285286

287+
Validator.prototype.onReset = function (e) {
288+
var self = this
289+
var options = this.options
290+
291+
window.setTimeout(function () {
292+
self.destroy()
293+
Plugin.call(self.$element, options)
294+
}, 0)
295+
}
296+
286297
Validator.prototype.defer = function ($el, callback) {
287298
callback = $.proxy(callback, this, $el)
288299
if (!this.options.delay) return callback()
@@ -318,7 +329,7 @@
318329

319330
this.$element.find('input[type="submit"], button[type="submit"]').removeClass('disabled')
320331

321-
this.$element.find('.has-error, .has-danger').removeClass('has-error has-danger')
332+
this.$element.find('.has-error, .has-danger, .has-success').removeClass('has-error has-danger has-success')
322333

323334
return this
324335
}

0 commit comments

Comments
 (0)