Is there a resource that can help convert a JavaScript prototype to jQuery?

I used Prototype before, and it helped us add significant interactivity to our web applications. However, we are considering using jQuery to standardize what is best supported in Visual Studio.

I understand that we can use jQuery.noConflict to run it with Prototype, but we would like users to not need to download both libraries to use our website.

So, is there a good resource that can help us move old scripts from Prototype to jQuery?

+3
source share
3 answers

I cannot help you much with your question, except to say that I have not heard about such an instrument, and that I would really be surprised if I really existed.

While I think jQuery is a great library, and that you are right to want to use only one library, just remember that the cost that you change across all your scenarios will be many hours of work. The cost of your users downloading additional 30kb scripts will be approximately 0.3 seconds. Perhaps try to gradually disable the prototype and refactor existing pages only when you need to: or b) if you have nothing better to do.

+4
source

Falkayn,

There is no automated process for converting JavaScipt code written against one JS library to another. Moreover, they cannot be. Different libraries implement different programming models, and they also organize their APIs in different ways.

So, before you find a solution to your problem, ask yourself the question: am I going to convert jQuery code when another โ€œcoolerโ€ JavaScript library โ€œX-typeโ€ becomes available? If your answer is no, take your time and do not manually convert the code for how long it will take. If you answer yes, do not convert the code at all.

The way it is.

+1
source

Thank you guys for your input. I was looking for more syntactic comparison than anything automatic, but nickf makes a good conclusion that the real value should not be too big. We used Prototype on only a few pages that really needed a high level of interactivity, so given Ps and Qs, jQuery should not be damaged everywhere.

-1
source

Source: https://habr.com/ru/post/916551/


All Articles