Skip to content

Commit

Permalink
Update knockout.validation 1.0.2 to the NuGet package version
Browse files Browse the repository at this point in the history
The GitHub v1.0.2 tag is a lot older, and didn't work for some of my scenarios
  • Loading branch information
bdukes committed Apr 16, 2014
1 parent 5e79b70 commit 0774d8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Binary file modified InstallPackages/knockout.validation_1.0.2.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

if (typeof (ko) === undefined) { throw 'Knockout is required, please ensure it is loaded before loading this validation plug-in'; }

if (typeof define === "function" && define["amd"]) {
exports = ko.validation = {};
}
// create our namespace object
var validation = exports;
ko.validation = validation;

var defaults = {
registerExtenders: true,
Expand Down Expand Up @@ -146,7 +146,7 @@
//#endregion

//#region Public API
var validation = (function () {
var api = (function () {

var isInitialized = 0;

Expand Down Expand Up @@ -453,7 +453,10 @@
contexts = null;
}
};
} ());
}());

// expose api publicly
ko.utils.extend(validation, api);
//#endregion

//#region Core Validation Rules
Expand Down Expand Up @@ -532,7 +535,7 @@

validation.rules['pattern'] = {
validator: function (val, regex) {
return utils.isEmptyVal(val) || val.match(regex) != null;
return utils.isEmptyVal(val) || val.toString().match(regex) != null;
},
message: 'Please check this value.'
};
Expand Down Expand Up @@ -739,7 +742,7 @@

//toggle visibility on validation messages when validation hasn't been evaluated, or when the object isValid
var visiblityAccessor = function () {
return isModified ? !isValid : false;
return (!config.messagesOnModified || isModified) ? !isValid : false;
};

ko.bindingHandlers.text.update(element, errorMsgAccessor);
Expand Down Expand Up @@ -1072,8 +1075,4 @@
};

//#endregion

/// apply our public api to the public object
ko.utils.extend(exports, validation);

}));

0 comments on commit 0774d8e

Please sign in to comment.