for (var i = 0; i < diff.removed.length; i++)
this._removeError(diff.removed[i].assert.name);
for (i = 0; i < diff.added.length; i++)
this._addError(diff.added[i].assert.name, {message: diff.added[i].errorMessage, assert: diff.added[i].assert});
for (i = 0; i < diff.kept.length; i++)
this._updateError(diff.kept[i].assert.name, {message: diff.kept[i].errorMessage, assert: diff.kept[i].assert});
},
_addError: function (name, {message, assert}) {
this._insertErrorWrapper();
this._ui.$errorsWrapper
.addClass('filled')
.append(
$(this.options.errorTemplate)
.addClass('parsley-' + name)
.html(message || this._getErrorMessage(assert))
);
},
_updateError: function (name, {message, assert}) {
this._ui.$errorsWrapper
.addClass('filled')
.find('.parsley-' + name)
.html(message || this._getErrorMessage(assert));
},
_removeError: function (name) {
this._ui.$errorsWrapper
.removeClass('filled')
.find('.parsley-' + name)
.remove();
},
_getErrorMessage: function (constraint) {
var customConstraintErrorMessage = constraint.name + 'Message';
if ('undefined' !== typeof this.options[customConstraintErrorMessage])
return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements);
return window.Parsley.getErrorMessage(constraint);
},
_buildUI: function () {