Bootstrap 5 is removing it's dependency on jQuery: https://github.com/twbs/bootstrap/pull/23586
This issue tracks investigating what removing jQuery as a dependency from ASP.NET Core would take.
@ryanbrandenburg can you please investigate and come up with some cost for this work? Thanks!
@danroth27 seems we rely on jQuery for our validation too, it's not just transitive because of Bootstrap dependency.
@mkArtakMSFT Right, the main work item tracked by this issue is investigating what it would take to remove the jQuery dependency from our validation support.
Given that our current validation support is built on jQuery validation, the way I would think about this issue is to take a fresh look at what our client validation support should look like. Is there a different validation library that we should consider using? Etc.
The one option that seems to be most popular (and standards compliant) would be using the built-in HTML5 form validation. The problem there is that it would only work for client-side validation. As far as I can tell HTML5 form validation doesn't solve any server-side validation problems, and even if it did it would require a lot of changes to DataAnnotations. HTML5 also isn't supported on older browsers (IE9 was the example I found).
In my opinion it's not worth the work that would be required to remove our dependencies here in the absence of a more unified vision about what value we can produce from re-working DataAnnotations.
We had the same problem and we actually wrote a vanilla js library for our project needs. It's mostly the same as jquery validate except some javascript api methods, but default asp net core template don't use them anyway.
If some else comes here looking for a solution, you can check out our Wellidate library. I recently made it open source after adding the missing functionality. It's intended to be a drop in replacement in asp net core and other projects using jquery validation. It also supports new bootstrap/customValidity based styling too.
+1 for this - especially since other jQuery-free CSS frameworks like Tailwind are also gaining popularity. For other people stumbling on this issue in the future, I came across this library that appears to be a good replacement in the meantime:
There's also https://github.com/NonFactors/Wellidate. I haven't used it but it's on my list of things to look into when I start removing jquery from my scaffolded identity pages.
Thanks for contacting us.
We're moving this issue to the Next sprint planning
milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Most helpful comment
Given that our current validation support is built on jQuery validation, the way I would think about this issue is to take a fresh look at what our client validation support should look like. Is there a different validation library that we should consider using? Etc.