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

Commit

Permalink
sync to upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
alexalouit committed Nov 27, 2015
1 parent 1e2425b commit bc5c2f8
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 53 deletions.
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
Changelog
=========

### 0.9.0
* Adding new `feedback` option to override the classes used for feedback icons (#97)
* Exposing selector used to determine which inputs to validate as `Validator.INPUT_SELECTOR`
* Removing inline styles on submit button no longer needed in Bootstrap v3.3.5 (#166)
* Add `jquery >= 1.8.3` to bower.json (#160)

###### Docs Changes
* Upgrade to Bootstrap v3.3.5
* Added a form-feedback example to the docs
* Added a custom validator server example to the docs

### 0.8.1
* No longer running validators on button elements. Fixes #93.
* No longer running validators on invisible input elements. Fixes #65.
* Adding support for button[form="myForm"]. Fixes #74.
* Adding support for `button[form="myForm"]`. Fixes #74.

### 0.8.0
* Adding custom validators option.
* Only adding .has-success class if there is a .form-control-feedback present.
* Only adding .has-success class if there is a `.form-control-feedback` present.

### 0.7.3
* No longer validating `input[type="hidden"]` fields. Fixes #84.
Expand Down
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ baseurl: /
encoding: UTF-8

repo: https://github.com/1000hz/bootstrap-validator
cdn_bootstrap_css: //netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css
cdn_bootstrap_js: //netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js
cdn_bootstrap_css: //netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css
cdn_bootstrap_js: //netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js
7 changes: 5 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-validator",
"version": "0.8.1",
"version": "0.9.0",
"homepage": "https://github.com/1000hz/bootstrap-validator",
"authors": [
"Cina Saffary <[email protected]>"
Expand All @@ -26,5 +26,8 @@
"Gruntfile.js",
"package.json",
"*.html"
]
],
"dependencies": {
"jquery": ">= 1.8.3"
}
}
30 changes: 19 additions & 11 deletions dist/validator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Validator v0.8.1 for Bootstrap 3, by @1000hz
* Validator v0.9.0 for Bootstrap 3, by @1000hz
* Copyright 2015 Cina Saffary
* Licensed under http://opensource.org/licenses/MIT
*
Expand All @@ -9,7 +9,6 @@
+function ($) {
'use strict';

var inputSelector = ':input:not([type="submit"], button):enabled:visible'
// VALIDATOR CLASS DEFINITION
// ==========================

Expand Down Expand Up @@ -41,6 +40,8 @@
})
}

Validator.INPUT_SELECTOR = ':input:not([type="submit"], button):enabled:visible'

Validator.DEFAULTS = {
delay: 500,
html: false,
Expand All @@ -52,20 +53,20 @@
},
feedback: {
success: 'glyphicon-ok',
error: 'glyphicon-warning-sign'
error: 'glyphicon-remove'
}
}

Validator.VALIDATORS = {
native: function ($el) {
'native': function ($el) {
var el = $el[0]
return el.checkValidity ? el.checkValidity() : true
},
match: function ($el) {
'match': function ($el) {
var target = $el.data('match')
return !$el.val() || $el.val() === $(target).val()
},
minlength: function ($el) {
'minlength': function ($el) {
var minlength = $el.data('minlength')
return !$el.val() || $el.val().length >= minlength
}
Expand Down Expand Up @@ -143,7 +144,7 @@
var delay = this.options.delay

this.options.delay = 0
this.$element.find(inputSelector).trigger('input.bs.validator')
this.$element.find(Validator.INPUT_SELECTOR).trigger('input.bs.validator')
this.options.delay = delay

return this
Expand Down Expand Up @@ -194,7 +195,7 @@
return !!($(this).data('bs.validator.errors') || []).length
}

return !!this.$element.find(inputSelector).filter(fieldErrors).length
return !!this.$element.find(Validator.INPUT_SELECTOR).filter(fieldErrors).length
}

Validator.prototype.isIncomplete = function () {
Expand All @@ -204,7 +205,7 @@
$.trim(this.value) === ''
}

return !!this.$element.find(inputSelector).filter('[required]').filter(fieldIncomplete).length
return !!this.$element.find(Validator.INPUT_SELECTOR).filter('[required]').filter(fieldIncomplete).length
}

Validator.prototype.onSubmit = function (e) {
Expand All @@ -214,11 +215,18 @@

Validator.prototype.toggleSubmit = function () {
if(!this.options.disable) return
<<<<<<< HEAD
var $btn = $('button[type="submit"], [data-validator="submit"], input[type="submit"]')
.filter('[form="' + this.$element.attr('id') + '"]')
.add(this.$element.find('input[type="submit"], button[type="submit"], [data-validator="submit"]'))
=======
var $btn = $('button[type="submit"], input[type="submit"]')
.filter('[form="' + this.$element.attr('id') + '"]')
.add(this.$element.find('input[type="submit"], button[type="submit"]'))
>>>>>>> 1000hz/master
$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
.css({'pointer-events': 'all', 'cursor': 'pointer'})
}
Validator.prototype.defer = function ($el, callback) {
Expand All @@ -234,7 +242,7 @@
.removeData('bs.validator')
.off('.bs.validator')

this.$element.find(inputSelector)
this.$element.find(Validator.INPUT_SELECTOR)
.off('.bs.validator')
.removeData(['bs.validator.errors', 'bs.validator.deferred'])
.each(function () {
Expand Down
8 changes: 6 additions & 2 deletions dist/validator.min.js

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions docs/dist/validator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Validator v0.8.1 for Bootstrap 3, by @1000hz
* Validator v0.9.0 for Bootstrap 3, by @1000hz
* Copyright 2015 Cina Saffary
* Licensed under http://opensource.org/licenses/MIT
*
Expand All @@ -9,7 +9,6 @@
+function ($) {
'use strict';

var inputSelector = ':input:not([type="submit"], button):enabled:visible'
// VALIDATOR CLASS DEFINITION
// ==========================

Expand Down Expand Up @@ -41,6 +40,8 @@
})
}

Validator.INPUT_SELECTOR = ':input:not([type="submit"], button):enabled:visible'

Validator.DEFAULTS = {
delay: 500,
html: false,
Expand All @@ -52,20 +53,20 @@
},
feedback: {
success: 'glyphicon-ok',
error: 'glyphicon-warning-sign'
error: 'glyphicon-remove'
}
}

Validator.VALIDATORS = {
native: function ($el) {
'native': function ($el) {
var el = $el[0]
return el.checkValidity ? el.checkValidity() : true
},
match: function ($el) {
'match': function ($el) {
var target = $el.data('match')
return !$el.val() || $el.val() === $(target).val()
},
minlength: function ($el) {
'minlength': function ($el) {
var minlength = $el.data('minlength')
return !$el.val() || $el.val().length >= minlength
}
Expand Down Expand Up @@ -143,7 +144,7 @@
var delay = this.options.delay

this.options.delay = 0
this.$element.find(inputSelector).trigger('input.bs.validator')
this.$element.find(Validator.INPUT_SELECTOR).trigger('input.bs.validator')
this.options.delay = delay

return this
Expand Down Expand Up @@ -194,7 +195,7 @@
return !!($(this).data('bs.validator.errors') || []).length
}

return !!this.$element.find(inputSelector).filter(fieldErrors).length
return !!this.$element.find(Validator.INPUT_SELECTOR).filter(fieldErrors).length
}

Validator.prototype.isIncomplete = function () {
Expand All @@ -204,7 +205,7 @@
$.trim(this.value) === ''
}

return !!this.$element.find(inputSelector).filter('[required]').filter(fieldIncomplete).length
return !!this.$element.find(Validator.INPUT_SELECTOR).filter('[required]').filter(fieldIncomplete).length
}

Validator.prototype.onSubmit = function (e) {
Expand All @@ -214,11 +215,12 @@

Validator.prototype.toggleSubmit = function () {
if(!this.options.disable) return

var $btn = $('button[type="submit"], input[type="submit"]')
.filter('[form="' + this.$element.attr('id') + '"]')
.add(this.$element.find('input[type="submit"], button[type="submit"]'))

$btn.toggleClass('disabled', this.isIncomplete() || this.hasErrors())
.css({'pointer-events': 'all', 'cursor': 'pointer'})
}

Validator.prototype.defer = function ($el, callback) {
Expand All @@ -234,7 +236,7 @@
.removeData('bs.validator')
.off('.bs.validator')

this.$element.find(inputSelector)
this.$element.find(Validator.INPUT_SELECTOR)
.off('.bs.validator')
.removeData(['bs.validator.errors', 'bs.validator.deferred'])
.each(function () {
Expand Down
4 changes: 2 additions & 2 deletions docs/dist/validator.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bc5c2f8

Please sign in to comment.