Skip to content

Commit 13386cd

Browse files
committed
[Fixes #11]JS Exception on validation in MVC
Added package.json and gulpfile.js to enable minifying
1 parent 20b7833 commit 13386cd

File tree

6 files changed

+31
-7
lines changed

6 files changed

+31
-7
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
bower_components/
1+
bower_components/
2+
node_modules/

bower.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-validation-unobtrusive",
3-
"version": "3.2.3",
3+
"version": "3.2.4",
44
"homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
55
"description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.",
66
"main": [
@@ -10,7 +10,8 @@
1010
"**/.*",
1111
"*.json",
1212
"*.md",
13-
"*.txt"
13+
"*.txt",
14+
"gulpfile.js"
1415
],
1516
"keywords": [
1617
"jquery",

gulpfile.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var gulp = require("gulp"),
2+
uglify = require("gulp-uglify"),
3+
rename = require('gulp-rename');
4+
5+
gulp.task("minifyJS", function () {
6+
gulp.src(["jquery.validate.unobtrusive.js"], { base: "." })
7+
.pipe(uglify())
8+
.pipe(rename({suffix: '.min'}))
9+
.pipe(gulp.dest("."));
10+
});
11+
12+
gulp.task("default", ["minifyJS"]);

jquery.validate.unobtrusive.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@
7070
}
7171

7272
function onSuccess(error) { // 'this' is the form element
73-
var container = error.data("unobtrusiveContainer"),
74-
replaceAttrValue = container.attr("data-valmsg-replace"),
75-
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
73+
var container = error.data("unobtrusiveContainer");
7674

7775
if (container) {
76+
var replaceAttrValue = container.attr("data-valmsg-replace"),
77+
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
78+
7879
container.addClass("field-validation-valid").removeClass("field-validation-error");
7980
error.removeData("unobtrusiveContainer");
8081

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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "ASP.NET",
3+
"version": "0.0.0",
4+
"devDependencies": {
5+
"gulp": "3.8.11",
6+
"gulp-rename": "1.2.2",
7+
"gulp-uglify": "1.2.0"
8+
}
9+
}

0 commit comments

Comments
 (0)