Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions types/jquery.validation/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ declare namespace JQueryValidation {
* default: false
*/
debug?: boolean | undefined;
/**
* Use this to register additional elements to be validatable. Main use case is for validating web components.
* By default, only the following elements are supported: "input", "select", "textarea", "[contenteditable]"
*
* default: []
*/
customElements?: string[] | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly this is present in the source code, but not in the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, true. I just opened a PR to fix this in the documentation as well jquery-validation/validation-content#59. I'll wait for an approval there and will merge this PR once the documentation PR is merged. Thanks for your review! ❤️

/**
* Use this class to create error labels, to look for existing error labels and to add it to invalid elements.
*
Expand Down
3 changes: 3 additions & 0 deletions types/jquery.validation/jquery.validation-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ function test_validate() {
onkeyup: () => {},
onclick: elt => 2,
});
$(".selector").validate({
customElements: ["my-custom-element"]
});
}

function test_methods() {
Expand Down
2 changes: 1 addition & 1 deletion types/jquery.validation/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/jquery.validation",
"version": "1.16.9999",
"version": "1.17.9999",
"nonNpm": true,
"nonNpmDescription": "jquery.validation",
"projects": [
Expand Down