-
Notifications
You must be signed in to change notification settings - Fork 1
/
jquery.validate.unobtrusive.dynamic.min.js
1 lines (1 loc) · 1.23 KB
/
jquery.validate.unobtrusive.dynamic.min.js
1
!function(e){function t(e,t){var o=t[0];o._mvcct_form_expando_||(o._mvcct_form_expando_=!0,n.push(t),1==n.length&&setTimeout(function(){for(;n.length;){var e=n.pop();e[0]._mvcct_form_expando_=!1,a(e),e.removeData("unobtrusiveValidation")}}))}function a(t){var a=t.data("unobtrusiveValidation");if(a){var n=t.validate(),o=t[0].elements;e.each(a.options.rules,function(t,i){if(void 0==n.settings.rules[t]){var r={};e.extend(r,i),r.messages=a.options.messages[t],e(o.namedItem(t)).rules("add",r)}else e.each(i,function(i,r){if(void 0==n.settings.rules[t][i]){var s={};s[i]=r,s.messages=a.options.messages[t][i],e(o.namedItem(t)).rules("add",s)}})})}}var n=[];e.validator.unobtrusive.parseDynamic=function(a){var n=e(a).first().closest("form");(n.length||e(a).find("form").length)&&(e.validator.unobtrusive.parse(a),n.length&&t(a,n))},e.validator.unobtrusive.parseElementDynamic=function(a){var n=e(a).first().closest("form");0!=n.length&&(e.validator.unobtrusive.parseElement(a,!0),t(a,n))};var o=window.mvcct||{},i=o.enhancer;i&&i.register(function(t,a){a?(e.validator.unobtrusive.parse(document),e("form").removeData("unobtrusiveValidation")):e.validator.unobtrusive.parseDynamic(t)},!0,null,"unobtrusive validation",void 0,"unobtrusive-validation")}(jQuery);