BestPractices
BestPractices

Reputation: 12876

How to find where prototype is being used?

We have 600 jsp files and I need to find out where we are using prototype.

Is searching for "$(" the best way to do this?

Will it catch all instances of searching for where prototype is being used? (If not, please provide what you would search for)

Upvotes: 2

Views: 397

Answers (1)

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114377

$ is a good start, but depending on the programmer's style, they may be doing things like:

Element.hide('someDiv')

...which is another format to do the same thing. Finding $ will only help you find DOM manipulation functions, but there are plenty of other things Prototype.js can do, such as Ajax:

new Ajax.Request(....

Now if I do something like this, there are parts of it that are based on Prototype but simply looking for $ is not the answer:

var myDiv = $('someDiv') <-- obvious
myDiv.down('active').show()  <-- not obvious

or how about:

this.select('.someClass')

...all of these use Prototype. So in a nutshell, you need to know what the code is doing, as well as what parts of the code use Prototype.

Upvotes: 6

Related Questions