I have used both protoype and jquery.
Sometimes I have to build some custom functions,for exmaple,I want to make a common Search class,in prototype I may write it this way:
var Searcher=Class.create();
Searcher.prototype={
initilize:function(xxx){},
search:function(url,para){
//here ,I may use some internal method,
this._check(url,para)
}
_check:function(url,para){}
}
In the above code,in the method of "search",I need "_check" method which maybe used repeated. So I extra the codes to the function "_check".
However when I want to do the samething in jquery,I do not know how to do :
(function($){
$.search=function(xxxx){
//how about if I want to extra some common codes to a method,where to place it?
//here?
function _check(xxxx){}
}
//or here?
$._check=function(xxxx) {}
})(JQuery)
It seems that the prototype should be preferred when build custom util class,but I really like the dom operation manner such as the "chain operation",the "css",the ....
How do you guys do?