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

Commit dfa97d6

Browse files
committed
🗣 — 0.11.9 ⁰˙¹¹˙⁹ ˙⁹
1 parent 5d74c22 commit dfa97d6

File tree

7 files changed

+50
-45
lines changed

7 files changed

+50
-45
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Changelog
22
=========
3+
### 0.11.9
4+
* Fixing another issue with `<select multiple/>` elements. (#463)
5+
* No longer skipping a custom validator if its attribute has a falsy value. (#475)
6+
* Fixing stale values being read for data-attributes.
7+
38
### 0.11.8
49
* Properly updating the submit button state when you run `.validator(‘update’)`. (#461)
510
* Clearing errors on fields with `data-validate="false"` upon calling `.validator('update')`. (#387)

dist/validator.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
2-
* Validator v0.11.8 for Bootstrap 3, by @1000hz
3-
* Copyright 2016 Cina Saffary
2+
* Validator v0.11.9 for Bootstrap 3, by @1000hz
3+
* Copyright 2017 Cina Saffary
44
* Licensed under http://opensource.org/licenses/MIT
55
*
66
* https://github.com/1000hz/bootstrap-validator
@@ -15,7 +15,7 @@
1515
function getValue($el) {
1616
return $el.is('[type="checkbox"]') ? $el.prop('checked') :
1717
$el.is('[type="radio"]') ? !!$('[name="' + $el.attr('name') + '"]:checked').length :
18-
$el.is('select[multiple]') ? +$el.val() ? $el.val() : null :
18+
$el.is('select[multiple]') ? ($el.val() || []).length :
1919
$el.val()
2020
}
2121

@@ -35,7 +35,7 @@
3535

3636
this.$element.find('[data-match]').each(function () {
3737
var $this = $(this)
38-
var target = $this.data('match')
38+
var target = $this.attr('data-match')
3939

4040
$(target).on('input.bs.validator', function (e) {
4141
getValue($this) && $this.trigger('input.bs.validator')
@@ -50,7 +50,7 @@
5050
this.$element.attr('novalidate', true) // disable automatic native validation
5151
}
5252

53-
Validator.VERSION = '0.11.8'
53+
Validator.VERSION = '0.11.9'
5454

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

@@ -80,11 +80,11 @@
8080
}
8181
},
8282
'match': function ($el) {
83-
var target = $el.data('match')
83+
var target = $el.attr('data-match')
8484
return $el.val() !== $(target).val() && Validator.DEFAULTS.errors.match
8585
},
8686
'minlength': function ($el) {
87-
var minlength = $el.data('minlength')
87+
var minlength = $el.attr('data-minlength')
8888
return $el.val().length < minlength && Validator.DEFAULTS.errors.minlength
8989
}
9090
}
@@ -157,22 +157,22 @@
157157
$el.data('bs.validator.deferred', deferred)
158158

159159
function getValidatorSpecificError(key) {
160-
return $el.data(key + '-error')
160+
return $el.attr('data-' + key + '-error')
161161
}
162162

163163
function getValidityStateError() {
164164
var validity = $el[0].validity
165-
return validity.typeMismatch ? $el.data('type-error')
166-
: validity.patternMismatch ? $el.data('pattern-error')
167-
: validity.stepMismatch ? $el.data('step-error')
168-
: validity.rangeOverflow ? $el.data('max-error')
169-
: validity.rangeUnderflow ? $el.data('min-error')
170-
: validity.valueMissing ? $el.data('required-error')
165+
return validity.typeMismatch ? $el.attr('data-type-error')
166+
: validity.patternMismatch ? $el.attr('data-pattern-error')
167+
: validity.stepMismatch ? $el.attr('data-step-error')
168+
: validity.rangeOverflow ? $el.attr('data-max-error')
169+
: validity.rangeUnderflow ? $el.attr('data-min-error')
170+
: validity.valueMissing ? $el.attr('data-required-error')
171171
: null
172172
}
173173

174174
function getGenericError() {
175-
return $el.data('error')
175+
return $el.attr('data-error')
176176
}
177177

178178
function getErrorMessage(key) {
@@ -184,18 +184,18 @@
184184
$.each(this.validators, $.proxy(function (key, validator) {
185185
var error = null
186186
if ((getValue($el) || $el.attr('required')) &&
187-
($el.data(key) || key == 'native') &&
187+
($el.attr('data-' + key) !== undefined || key == 'native') &&
188188
(error = validator.call(this, $el))) {
189189
error = getErrorMessage(key) || error
190190
!~errors.indexOf(error) && errors.push(error)
191191
}
192192
}, this))
193193

194-
if (!errors.length && getValue($el) && $el.data('remote')) {
194+
if (!errors.length && getValue($el) && $el.attr('data-remote')) {
195195
this.defer($el, function () {
196196
var data = {}
197197
data[$el.attr('name')] = getValue($el)
198-
$.get($el.data('remote'), data)
198+
$.get($el.attr('data-remote'), data)
199199
.fail(function (jqXHR, textStatus, error) { errors.push(getErrorMessage('remote') || error) })
200200
.always(function () { deferred.resolve(errors)})
201201
})

dist/validator.min.js

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

0 commit comments

Comments
 (0)