Notes on learning jQuery
Some guys like jQuery over prototype, I used prototype before and only take a look at jQuery from time to time, today I read documents more carefully and follow the tutorials and wrote a few line test codes.
again, this is leaning notes, correct me if I am wrong.
- "get element by selector" sugars
jQuery provides a super set of get element by selector. "getElementbySelector" is super cool idea, I saw this technic in 2005 when I found "behaviour.js". Unfortunately, the idea of behaviour.js was very cool but the performance is slow in large web pages.
Now prototype.js also support this very well.
The disadvantage is still there -- slow.
- "chains"
Chains make code less and neat. jquery functions always return javascript objects, so it's easier to chain multiple lines into one.
I personally don't like this idea. it's looks nice, but the code will not easy to maintain and the not that easy to read. There are too much implicit information in this "chaining". ofcoz, that's my personal opinions.
$('<p></p>')
.html('Hello World!')
.css('background', 'black')
.appendTo("body");
- plugin
I like this plugin idea in jquery. user can even add customized selector provider through plugin, that's nice.
$.fn.donothing = function(){
return this;
};
- Ajax
ofcoz, every one have ajax part... every one are similar...
jQuery is cool, however I still like prototype, it's not because good or bad, just because the old habit.
Related posts:
- Google Maps / Live Maps switcher bookmarklet
- To "refresh" a SqlDataSource.
- asp:ControlParameter vs asp:FormParameter
- output a line in a batch *without* crlf
- A page which crash Firefox 3.0
- Write code with no getters???
- Dump SQL Server Express' DB Schema
- My suggestions on Web2py's route design
- Good comparing of GAE Data Store .vs. Amazon Simple DB .vs. MS SSDS
- Very good articles on MVC, MVP and more.
Search related in web: