Skip to content

Commit

Permalink
[build] 1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
niceue committed Nov 18, 2016
1 parent f4fd1fb commit 6ae3cc5
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 42 deletions.
75 changes: 36 additions & 39 deletions dist/jquery.validator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! nice-validator 1.0.7
/*! nice-validator 1.0.8
* (c) 2012-2016 Jony Zhang <[email protected]>, MIT Licensed
* https://github.com/niceue/nice-validator
*/
Expand Down Expand Up @@ -226,23 +226,22 @@
return hasCallback ? this : ret;
};

$.extend($.expr.pseudos || $.expr[':'], {
// A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
verifiable: function(elem) {
var name = elem.nodeName.toLowerCase();

// A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
$.expr.pseudos.verifiable = function(elem) {
var name = elem.nodeName.toLowerCase();

return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
name === 'select' ||
name === 'textarea' ||
elem.contentEditable === 'true'
) && !elem.disabled;
};

// any value, but not only whitespace
$.expr.pseudos.filled = function(elem) {
return !!trim($(elem).val());
};

return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
name === 'select' ||
name === 'textarea' ||
elem.contentEditable === 'true'
) && !elem.disabled;
},
// any value, but not only whitespace
filled: function(elem) {
return !!trim($(elem).val());
}
});

/**
* Creates a new Validator
Expand All @@ -258,25 +257,25 @@
return new Validator(element, options);
}

me.$el = $(element);

if (me.$el.length) {
if (Validator.pending) {
$(window).on('validatorready', init);
} else {
init();
if (Validator.pending) {
$(window).on('validatorready', init);
}
}
else if ( isString(element) ) {
preinitialized[element] = options;
}

function init() {
me._init(me.$el[0], options, !!arguments[0]);
me.$el = $(element);
if (me.$el.length) {
me._init(me.$el[0], options);
}
else if (isString(element)) {
preinitialized[element] = options;
}
}
}

Validator.prototype = {
_init: function(element, options, hasInit) {
_init: function(element, options) {
var me = this,
opt, themeOpt, dataOpt;

Expand All @@ -292,17 +291,15 @@
themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);

if (!hasInit) {
me.rules = new Rules(opt.rules, true);
me.messages = new Messages(opt.messages, true);
me.Field = _createFieldFactory(me);
me.elements = me.elements || {};
me.deferred = {};
me.errors = {};
me.fields = {};
// Initialization fields
me._initFields(opt.fields);
}
me.rules = new Rules(opt.rules, true);
me.messages = new Messages(opt.messages, true);
me.Field = _createFieldFactory(me);
me.elements = me.elements || {};
me.deferred = {};
me.errors = {};
me.fields = {};
// Initialization fields
me._initFields(opt.fields);

// Initialization events and make a cache
if ( !me.$el.data(NS) ) {
Expand Down
Loading

0 comments on commit 6ae3cc5

Please sign in to comment.