Skip to content

Commit 0663499

Browse files
Add UMD support
1 parent 22c2e96 commit 0663499

File tree

5 files changed

+62
-48
lines changed

5 files changed

+62
-48
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
3131
},
3232
"dependencies": {
33-
"jquery-validation": ">=1.8",
33+
"jquery-validation": ">=1.16",
3434
"jquery": ">=1.8"
3535
}
3636
}

dist/jquery.validate.unobtrusive.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
(function (factory) {
99
if (typeof define === 'function' && define.amd) {
1010
// AMD. Register as an anonymous module.
11-
define(['jquery', 'jquery.validate'], factory);
11+
define("jquery.validate.unobtrusive", ['jquery.validate'], factory);
1212
} else if (typeof module === 'object' && module.exports) {
13-
// CommonJS-like environments that support module.exports
14-
module.exports = factory(require('jquery'), require('jquery.validate'));
13+
// CommonJS-like environments that support module.exports
14+
module.exports = factory(require('jquery-validation'));
1515
} else {
1616
// Browser global
17-
var unobtrusive = factory(jQuery);
18-
jQuery(function(){
19-
unobtrusive.parse(document);
20-
});
17+
jQuery.validator.unobtrusive = factory(jQuery);
2118
}
2219
}(function ($) {
2320
var $jQval = $.validator,
@@ -422,6 +419,10 @@
422419
setValidationValues(options, "regex", options.params.regex);
423420
}
424421
});
425-
422+
423+
$(function () {
424+
$jQval.unobtrusive.parse(document);
425+
});
426+
426427
return $jQval.unobtrusive;
427428
}));

dist/jquery.validate.unobtrusive.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
{
2-
"name": "jquery-validation-unobtrusive",
3-
"version": "3.2.6",
4-
"homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
5-
"description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
6-
"main": "dist/jquery.validate.unobtrusive.js",
7-
"repository": {
8-
"type": "git",
9-
"url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
10-
},
11-
"keywords": [
12-
"jquery",
13-
"asp.net",
14-
"mvc",
15-
"validation",
16-
"unobtrusive"
17-
],
18-
"author": {
19-
"name": "Microsoft"
20-
},
21-
"license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
22-
"readme": "The jQuery Unobtrusive Validation library complements jQuery Validation by adding support for specifying validation options as HTML5 data-* elements",
23-
"files": [
24-
"jquery.validate.unobtrusive.js",
25-
"jquery.validate.unobtrusive.min.js"
26-
],
27-
"dependencies": {
28-
"jquery": ">=1.8",
29-
"jquery-validation": ">=1.8"
30-
},
31-
"devDependencies": {
32-
"gulp": "3.9.1",
33-
"gulp-rename": "1.2.2",
34-
"gulp-uglify": "2.0.0",
35-
"gulp-replace": "0.5.4",
36-
"gulp-line-ending-corrector": "1.0.1"
37-
}
2+
"name": "jquery-validation-unobtrusive",
3+
"version": "3.2.6",
4+
"homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
5+
"description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
6+
"main": "dist/jquery.validate.unobtrusive.js",
7+
"repository": {
8+
"type": "git",
9+
"url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
10+
},
11+
"keywords": [
12+
"jquery",
13+
"asp.net",
14+
"mvc",
15+
"validation",
16+
"unobtrusive"
17+
],
18+
"author": {
19+
"name": "Microsoft"
20+
},
21+
"license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
22+
"readme": "The jQuery Unobtrusive Validation library complements jQuery Validation by adding support for specifying validation options as HTML5 data-* elements",
23+
"files": [
24+
"dist/jquery.validate.unobtrusive.js",
25+
"dist/jquery.validate.unobtrusive.min.js"
26+
],
27+
"dependencies": {
28+
"jquery": ">=1.8",
29+
"jquery-validation": ">=1.16"
30+
},
31+
"devDependencies": {
32+
"gulp": "3.9.1",
33+
"gulp-rename": "1.2.2",
34+
"gulp-uglify": "2.0.0",
35+
"gulp-replace": "0.5.4",
36+
"gulp-line-ending-corrector": "1.0.1"
37+
}
3838
}

src/jquery.validate.unobtrusive.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,18 @@
55
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
66
/*global document: false, jQuery: false */
77

8-
(function ($) {
8+
(function (factory) {
9+
if (typeof define === 'function' && define.amd) {
10+
// AMD. Register as an anonymous module.
11+
define("jquery.validate.unobtrusive", ['jquery.validate'], factory);
12+
} else if (typeof module === 'object' && module.exports) {
13+
// CommonJS-like environments that support module.exports
14+
module.exports = factory(require('jquery-validation'));
15+
} else {
16+
// Browser global
17+
jQuery.validator.unobtrusive = factory(jQuery);
18+
}
19+
}(function ($) {
920
var $jQval = $.validator,
1021
adapters,
1122
data_validation = "unobtrusiveValidation";
@@ -412,4 +423,6 @@
412423
$(function () {
413424
$jQval.unobtrusive.parse(document);
414425
});
415-
}(jQuery));
426+
427+
return $jQval.unobtrusive;
428+
}));

0 commit comments

Comments
 (0)