使用Gulp时无法识别函数



我刚刚从codekit(一个最小化/concats/渲染sass和js文件的程序)切换到Gulp构建系统。我已经创建了一个gulpfile,似乎一切都是连接和丑陋只是好,但当我尝试使用一个函数,如"validate()"为例,它不起作用。但是,该函数是在缩小文档的顶部明确定义的,并在文档的最后调用。你知道为什么文件顶部的所有函数都不起作用吗?Headroom(), equalHeights(), validate(),这些都不起作用

我gulpfile.js

    var gulp = require('gulp');
var order = require("gulp-order");
var sass = require('gulp-sass');
var refresh = require('gulp-livereload');
var lr = require('tiny-lr');
var server = lr();
var jshint = require('gulp-jshint');
var minifyCSS = require('gulp-minify-css');
var embedlr = require('gulp-embedlr');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
gulp.task('scripts', function() {
        gulp.src([
          "public/assets/js/frameworks/*.js",
          "public/assets/js/partials/*.js"
        ])
        .pipe(order([
          "public/assets/js/frameworks/jquery.js",
          "public/assets/js/frameworks/modernizr.min.js",
          "public/assets/js/frameworks/bootstrap.js",
          "public/assets/js/frameworks/equalheights.js",
          "public/assets/js/frameworks/headroom.js",
          "public/assets/js/frameworks/jquery.headroom.js",
          "public/assets/js/frameworks/jquery.maskedinput.min.js",
          "public/assets/js/frameworks/jquery.validate.js",
          "public/assets/js/frameworks/plupload.full.min.js",
          "public/assets/js/frameworks/wow.js",
          "public/assets/js/partials/*.js"
        ], { base: './' }))
        .pipe(jshint.reporter('default'))
        .pipe(concat('app.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./public/assets/dist'))
        .pipe(refresh(server))
})
gulp.task('styles', function() {
    gulp.src(['public/assets/scss/**/*.scss'])
        .pipe(sass())
        .pipe(minifyCSS())
        .pipe(concat('app.css'))
        .pipe(gulp.dest('public/assets/dist'))
        .pipe(refresh(server))
})
gulp.task('lr-server', function() {
    server.listen(35729, function(err) {
        if(err) return console.log(err);
    });
})

gulp.task('default', function() {
    gulp.run('lr-server', 'scripts', 'styles');
    gulp.watch('public/assets/js/**/*.js', function(event) {
        gulp.run('scripts');
    })
    gulp.watch('public/assets/scss/**/*.scss', function(event) {
        gulp.run('styles');
    })
})

我的缩小文件太长,不能发布,但是validate()函数定义如下,它位于文件的顶部:

{validate:function(t){if(!this.length)return void(t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var n=e.data(this[0],"validator");return n?n:(this.attr("novalidate","novalidate"),n=new e.validator(t,this[0]),e.data(this[0],"validator",n),n.settings.onsubmit&&(this.on("click.validate",":submit",function(t){n.settings.submitHandler&&(n.submitButton=t.target),e(this).hasClass("cancel")&&(n.cancelSubmit=!0),void 0!==e(this).attr("formnovalidate")&&(n.cancelSubmit=!0)}),this.on("submit.validate",function(t){function i(){var i,r;return!n.settings.submitHandler||(n.submitButton&&(i=e("<input type='hidden'/>").attr("name",n.submitButton.name).val(e(n.submitButton).val()).appendTo(n.currentForm)),r=n.settings.submitHandler.call(n,n.currentForm,t),n.submitButton&&i.remove(),void 0!==r&&r)}return n.settings.debug&&t.preventDefault(),n.cancelSubmit?(n.cancelSubmit=!1,i()):n.form()?n.pendingRequest?(n.formSubmitted=!0,!1):i():(n.focusInvalid(),!1)})),n)},valid:function(){var t,n,i;return e(this[0]).is("form")?t=this.validate().form():(i=[],t=!0,n=e(this[0].form).validate(),this.each(function(){t=n.element(this)&&t,t||(i=i.concat(n.errorList))}),n.errorList=i),t},rules:function(t,n){if(this.length){var i,r,o,s,a,l,u=this[0];if(t)switch(i=e.data(u.form,"validator").settings,r=i.rules,o=e.validator.staticRules(u),t){case"add":e.extend(o,e.validator.normalizeRule(n)),delete o.messages,r[u.name]=o,n.messages&&(i.messages[u.name]=e.extend(i.messages[u.name],n.messages));break;case"remove":return n?(l={},e.each(n.split(/s/),function(t,n){l[n]=o[n],delete o[n],"required"===n&&e(u).removeAttr("aria-required")}),l):(delete r[u.name],o)}return s=e.validator.normalizeRules(e.extend({},e.validator.classRules(u),e.validator.attributeRules(u),e.validator.dataRules(u),e.validator.staticRules(u)),u),s.required&&(a=s.required,delete s.required,s=e.extend({required:a},s),e(u).attr("aria-required","true")),s.remote&&(a=s.remote,delete s.remote,s=e.extend(s,{remote:a})),s}}}),e.extend(e.expr[":"],{blank:function(t){return!e.trim(""+e(t).val())},filled:function(t){var n=e(t).val();return null!==n&&!!e.trim(""+n)},unchecked:function(t){return!e(t).prop("checked")}}),e.validator=function(t,n){this.settings=e.extend(!0,{},e.validator.defaults,t),this.currentForm=n,this.init()},e.validator.format=function(t,n){return 1===arguments.length?function(){var n=e.makeArray(arguments);return n.unshift(t),e.validator.format.apply(this,n)}:void 0===n?t:(arguments.length>2&&n.constructor!==Array&&(n=e.makeArray(arguments).slice(1)),n.constructor!==Array&&(n=[n]),e.each(n,function(e,n){t=t.replace(new RegExp("\{"+e+"\}","g"),function(){return n})}),t)},e.extend(e.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:e([]),errorLabelContainer:e([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e){this.lastActive=e,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(e)))},onfocusout:function(e){this.checkable(e)||!(e.name in this.submitted)&&this.optional(e)||this.element(e)},onkeyup:function(t,n){var i=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===n.which&&""===this.elementValue(t)||e.inArray(n.keyCode,i)!==-1||(t.name in this.submitted||t.name in this.invalid)&&this.element(t)},onclick:function(e){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(t,n,i){"radio"===t.type?this.findByName(t.name).addClass(n).removeClass(i):e(t).addClass(n).removeClass(i)},unhighlight:function(t,n,i){"radio"===t.type?this.findByName(t.name).removeClass(n).addClass(i):e(t).removeClass(n).addClass(i)}},setDefaults:function(t){e.extend(e.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:e.validator.format("Please enter no more than {0} characters."),minlength:e.validator.format("Please enter at least {0} characters."),rangelength:e.validator.format("Please enter a value between {0} and {1} characters long."),range:e.validator.format("Please enter a value between {0} and {1}."),max:e.validator.format("Please enter a value less than or equal to {0}."),min:e.validator.format("Please enter a value greater than or equal to {0}."),step:e.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function t(t){var n=e.data(this.form,"validator"),i="on"+t.type.replace(/^validate/,""),r=n.settings;r[i]&&!e(this).is(r.ignore)&&r[i].call(n,this,t)}this.labelContainer=e(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||e(this.currentForm),this.containers=e(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var n,i=this.groups={};e.each(this.settings.groups,function(t,n){"string"==typeof n&&(n=n.split(/s/)),e.each(n,function(e,n){i[n]=t})}),n=this.settings.rules,e.each(n,function(t,i){n[t]=e.validator.normalizeRule(i)}),e(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable]",t).on("click.validate","select, option, [type='radio'], [type='checkbox']",t),this.settings.invalidHandler&&e(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler),e(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),e.extend(this.submitted,this.errorMap),this.invalid=e.extend({},this.errorMap),this.valid()||e(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(t){var n,i,r=this.clean(t),o=this.validationTargetFor(r),s=this,a=!0;return void 0===o?delete this.invalid[r.name]:(this.prepareElement(o),this.currentElements=e(o),i=this.groups[o.name],i&&e.each(this.groups,function(e,t){t===i&&e!==o.name&&(r=s.validationTargetFor(s.clean(s.findByName(e))),r&&r.name in s.invalid&&(s.currentElements.push(r),a=a&&s.check(r)))}),n=this.check(o)!==!1,a=a&&n,n?this.invalid[o.name]=!1:this.invalid[o.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e(t).attr("aria-invalid",!n)),a},showErrors:function(t){if(t){var n=this;e.extend(this.errorMap,t),this.errorList=e.map(this.errorMap,function(e,t){return{message:e,element:n.findByName(t)[0]}}),this.successList=e.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){e.fn.resetForm&&e(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var t=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(t)},resetElements:function(e){var t;if(this.settings.unhighlight)for(t=0;e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,""),this.findByName(e[t].name).removeClass(this.settings.validClass);else e.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t,n=0;for(t in e)e[t]&&n++;return n},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(e){e.not(this.containers).text(""),this.addWrapper(e).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{e(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var t=this.lastActive;return t&&1===e.grep(this.errorList,function(e){return e.element.name===t.name}).length&&t},elements:function(){var t=this,n={};return e(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var i=this.name||e(this).attr("name");return!i&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=e(this).closest("form")[0]),!(i in n||!t.objectLength(e(this).rules()))&&(n[i]=!0,!0)})},clean:function(t){return e(t)[0]},errors:function(){var t=this.settings.errorClass.split(" ").join(".");return e(this.settings.errorElement+"."+t,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=e([]),this.toHide=e([])},reset:function(){this.resetInternals(),this.currentElements=e([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){
this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(t){var n,i,r=e(t),o=t.type;return"radio"===o||"checkbox"===o?this.findByName(t.name).filter(":checked").val():"number"===o&&"undefined"!=typeof t.validity?t.validity.badInput?"NaN":r.val():(n=t.hasAttribute("contenteditable")?r.text():r.val(),"file"===o?"C:\fakepath\"===n.substr(0,12)?n.substr(12):(i=n.lastIndexOf("/"),i>=0?n.substr(i+1):(i=n.lastIndexOf("\"),i>=0?n.substr(i+1):n)):"string"==typeof n?n.replace(/r/g,""):n)},check:function(t){t=this.validationTargetFor(this.clean(t));var n,i,r,o=e(t).rules(),s=e.map(o,function(e,t){return t}).length,a=!1,l=this.elementValue(t);if("function"==typeof o.normalizer){if(l=o.normalizer.call(t,l),"string"!=typeof l)throw new TypeError("The normalizer should return a string value.");delete o.normalizer}for(i in o){r={method:i,parameters:o[i]};try{if(n=e.validator.methods[i].call(this,l,t,r.parameters),"dependency-mismatch"===n&&1===s){a=!0;continue}if(a=!1,"pending"===n)return void(this.toHide=this.toHide.not(this.errorsFor(t)));if(!n)return this.formatAndAdd(t,r),!1}catch(e){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+t.id+", check the '"+r.method+"' method.",e),e instanceof TypeError&&(e.message+=".  Exception occurred when checking element "+t.id+", check the '"+r.method+"' method."),e}}if(!a)return this.objectLength(o)&&this.successList.push(t),!0},customDataMessage:function(t,n){return e(t).data("msg"+n.charAt(0).toUpperCase()+n.substring(1).toLowerCase())||e(t).data("msg")},customMessage:function(e,t){var n=this.settings.messages[e];return n&&(n.constructor===String?n:n[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]},defaultMessage:function(t,n){var i=this.findDefined(this.customMessage(t.name,n.method),this.customDataMessage(t,n.method),!this.settings.ignoreTitle&&t.title||void 0,e.validator.messages[n.method],"<strong>Warning: No message defined for "+t.name+"</strong>"),r=/$?{(d+)}/g;return"function"==typeof i?i=i.call(this,n.parameters,t):r.test(i)&&(i=e.validator.format(i.replace(r,"{$1}"),n.parameters)),i},formatAndAdd:function(e,t){var n=this.defaultMessage(e,t);this.errorList.push({message:n,element:e,method:t.method}),this.errorMap[e.name]=n,this.submitted[e.name]=n},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t,n;for(e=0;this.errorList[e];e++)n=this.errorList[e],this.settings.highlight&&this.settings.highlight.call(this,n.element,this.settings.errorClass,this.settings.validClass),this.showLabel(n.element,n.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return e(this.errorList).map(function(){return this.element})},showLabel:function(t,n){var i,r,o,s,a=this.errorsFor(t),l=this.idOrName(t),u=e(t).attr("aria-describedby");a.length?(a.removeClass(this.settings.validClass).addClass(this.settings.errorClass),a.html(n)):(a=e("<"+this.settings.errorElement+">").attr("id",l+"-error").addClass(this.settings.errorClass).html(n||""),i=a,this.settings.wrapper&&(i=a.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(i):this.settings.errorPlacement?this.settings.errorPlacement(i,e(t)):i.insertAfter(t),a.is("label")?a.attr("for",l):0===a.parents("label[for='"+this.escapeCssMeta(l)+"']").length&&(o=a.attr("id"),u?u.match(new RegExp("\b"+this.escapeCssMeta(o)+"\b"))||(u+=" "+o):u=o,e(t).attr("aria-describedby",u),r=this.groups[t.name],r&&(s=this,e.each(s.groups,function(t,n){n===r&&e("[name='"+s.escapeCssMeta(t)+"']",s.currentForm).attr("aria-describedby",a.attr("id"))})))),!n&&this.settings.success&&(a.text(""),"string"==typeof this.settings.success?a.addClass(this.settings.success):this.settings.success(a,t)),this.toShow=this.toShow.add(a)},errorsFor:function(t){var n=this.escapeCssMeta(this.idOrName(t)),i=e(t).attr("aria-describedby"),r="label[for='"+n+"'], label[for='"+n+"'] *";return i&&(r=r+", #"+this.escapeCssMeta(i).replace(/s+/g,", #")),this.errors().filter(r)},escapeCssMeta:function(e){return e.replace(/([\!"#$%&'()*+,./:;<=>?@[]^`{|}~])/g,"\$1")},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name)),e(t).not(this.settings.ignore)[0]},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(t){return e(this.currentForm).find("[name='"+this.escapeCssMeta(t)+"']")},getLength:function(t,n){switch(n.nodeName.toLowerCase()){case"select":return e("option:selected",n).length;case"input":if(this.checkable(n))return this.findByName(n.name).filter(":checked").length}return t.length},depend:function(e,t){return!this.dependTypes[typeof e]||this.dependTypes[typeof e](e,t)},dependTypes:{boolean:function(e){return e},string:function(t,n){return!!e(t,n.form).length},function:function(e,t){return e(t)}},optional:function(t){var n=this.elementValue(t);return!e.validator.methods.required.call(this,n,t)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,e(t).addClass(this.settings.pendingClass),this.pending[t.name]=!0)},stopRequest:function(t,n){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[t.name],e(t).removeClass(this.settings.pendingClass),n&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(e(this.currentForm).submit(),this.formSubmitted=!1):!n&&0===this.pendingRequest&&this.formSubmitted&&(e(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t,n){return e.data(t,"previousValue")||e.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,{method:n})})},destroy:function(){this.resetForm(),e(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,n){t.constructor===String?this.classRuleSettings[t]=n:e.extend(this.classRuleSettings,t)},classRules:function(t){var n={},i=e(t).attr("class");return i&&e.each(i.split(" "),function(){this in e.validator.classRuleSettings&&e.extend(n,e.validator.classRuleSettings[this])}),n},normalizeAttributeRule:function(e,t,n,i){/min|max|step/.test(n)&&(null===t||/number|range|text/.test(t))&&(i=Number(i),isNaN(i)&&(i=void 0)),i||0===i?e[n]=i:t===n&&"range"!==t&&(e[n]=!0)},attributeRules:function(t){var n,i,r={},o=e(t),s=t.getAttribute("type");for(n in e.validator.methods)"required"===n?(i=t.getAttribute(n),""===i&&(i=!0),i=!!i):i=o.attr(n),this.normalizeAttributeRule(r,s,n,i);return r.maxlength&&/-1|2147483647|524288/.test(r.maxlength)&&delete r.maxlength,r},dataRules:function(t){var n,i,r={},o=e(t),s=t.getAttribute("type");for(n in e.validator.methods)i=o.data("rule"+n.charAt(0).toUpperCase()+n.substring(1).toLowerCase()),this.normalizeAttributeRule(r,s,n,i);return r},staticRules:function(t){var n={},i=e.data(t.form,"validator");return i.settings.rules&&(n=e.validator.normalizeRule(i.settings.rules[t.name])||{}),n},normalizeRules:function(t,n){return e.each(t,function(i,r){if(r===!1)return void delete t[i];if(r.param||r.depends){var o=!0;switch(typeof r.depends){case"string":o=!!e(r.depends,n.form).length;break;case"function":o=r.depends.call(n,n)}o?t[i]=void 0===r.param||r.param:(e.data(n.form,"validator").resetElements(e(n)),delete t[i])}}),e.each(t,function(i,r){t[i]=e.isFunction(r)&&"normalizer"!==i?r(n):r}),e.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),e.each(["rangelength","range"],function(){var n;t[this]&&(e.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:"string"==typeof t[this]&&(n=t[this].replace(/[[]]/g,"").split(/[s,]+/),t[this]=[Number(n[0]),Number(n[1])]))}),e.validator.autoCreateRanges&&(null!=t.min&&null!=t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),null!=t.minlength&&null!=t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if("string"==typeof t){var n={};e.each(t.split(/s/),function(){n[this]=!0}),t=n}return t},addMethod:function(t,n,i){e.validator.methods[t]=n,e.validator.messages[t]=void 0!==i?i:e.validator.messages[t],n.length<3&&e.validator.addClassRules(t,e.validator.normalizeRule(t))},methods:{required:function(t,n,i){if(!this.depend(i,n))return"dependency-mismatch";if("select"===n.nodeName.toLowerCase()){var r=e(n).val();return r&&r.length>0}return this.checkable(n)?this.getLength(t,n)>0:t.length>0},email:function(e,t){return this.optional(t)||/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e)},url:function(e,t){return this.optional(t)||/^(?:(?:(?:https?|ftp):)?//)(?:S+(?::S*)?@)?(?:(?!(?:10|127)(?:.d{1,3}){3})(?!(?:169.254|192.168)(?:.d{1,3}){2})(?!172.(?:1[6-9]|2d|3[0-1])(?:.d{1,3}){2})(?:[1-9]d?|1dd|2[01]d|22[0-3])(?:.(?:1?d{1,2}|2[0-4]d|25[0-5])){2}(?:.(?:[1-9]d?|1dd|2[0-4]d|25[0-4]))|(?:(?:[a-zu00a1-uffff0-9]-*)*[a-zu00a1-uffff0-9]+)(?:.(?:[a-zu00a1-uffff0-9]-*)*[a-zu00a1-uffff0-9]+)*(?:.(?:[a-zu00a1-uffff]{2,})).?)(?::d{2,5})?(?:[/?#]S*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test(new Date(e).toString())},dateISO:function(e,t){return this.optional(t)||/^d{4}[/-](0?[1-9]|1[012])[/-](0?[1-9]|[12][0-9]|3[01])$/.test(e)},number:function(e,t){return this.optional(t)||/^(?:-?d+|-?d{1,3}(?:,d{3})+)?(?:.d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^d+$/.test(e)},minlength:function(t,n,i){var r=e.isArray(t)?t.length:this.getLength(t,n);return this.optional(n)||r>=i},maxlength:function(t,n,i){var r=e.isArray(t)?t.length:this.getLength(t,n);return this.optional(n)||r<=i},rangelength:function(t,n,i){var r=e.isArray(t)?t.length:this.getLength(t,n);return this.optional(n)||r>=i[0]&&r<=i[1]},min:function(e,t,n){return this.optional(t)||e>=n},max:function(e,t,n){return this.optional(t)||e<=n},range:function(e,t,n){return this.optional(t)||e>=n[0]&&e<=n[1]},step:function(t,n,i){var r=e(n).attr("type"),o="Step attribute on input type "+r+" is not supported.",s=["text","number","range"],a=new RegExp("\b"+r+"\b"),l=r&&!a.test(s.join());if(l)throw new Error(o);return this.optional(n)||t%i===0},equalTo:function(t,n,i){var r=e(i);return this.settings.onfocusout&&r.not(".validate-equalTo-blur").length&&r.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){e(n).valid()}),t===r.val()},remote:function(t,n,i,r){if(this.optional(n))return"dependency-mismatch";r="string"==typeof r&&r||"remote";var o,s,a,l=this.previousValue(n,r);return this.settings.messages[n.name]||(this.settings.messages[n.name]={}),l.originalMessage=l.originalMessage||this.settings.messages[n.name][r],this.settings.messages[n.name][r]=l.message,i="string"==typeof i&&{url:i}||i,a=e.param(e.extend({data:t},i.data)),l.old===a?l.valid:(l.old=a,o=this,this.startRequest(n),s={},s[n.name]=t,e.ajax(e.extend(!0,{mode:"abort",port:"validate"+n.name,dataType:"json",data:s,context:o.currentForm,success:function(e){var i,s,a,u=e===!0||"true"===e;o.settings.messages[n.name][r]=l.originalMessage,u?(a=o.formSubmitted,o.resetInternals(),o.toHide=o.errorsFor(n),o.formSubmitted=a,o.successList.push(n),o.invalid[n.name]=!1,o.showErrors()):(i={},s=e||o.defaultMessage(n,{method:r,parameters:t}),i[n.name]=l.message=s,o.invalid[n.name]=!0,o.showErrors(i)),l.valid=u,o.stopRequest(n,u)}},i)),"pending")}}});var t,n={};e.ajaxPrefilter?e.ajaxPrefilter(function(e,t,i){var r=e.port;"abort"===e.mode&&(n[r]&&n[r].abort(),n[r]=i)}):(t=e.ajax,e.ajax=function(i){var r=("mode"in i?i:e.ajaxSettings).mode,o=("port"in i?i:e.ajaxSettings).port;return"abort"===r?

我使用validate()的函数:

/*
|--------------------------------------------------------------------------
| Validate the first registration form
|--------------------------------------------------------------------------
*/
$("#register-step-one").validate({
    errorClass:'error',
    validClass:'success',
    errorElement:'span',
  onkeyup: false,
  rules: {
    first_name: { required: true },
    last_name: { required: true },
    email: { required: true, email: true },
    phone: { required: true },
    company: { required: true },
  },
  submitHandler: function(form) {
      form.submit();
  },
});

只是一个很长的尝试,但尝试删除行后不必要的逗号:

company: { required: true },

submitHandler: function(form) {
  form.submit();
},

相关内容

  • 没有找到相关文章

最新更新