I think the title is pretty much self explanatory, isn't it ? I had to use it for a project (company policy), and i was very disappointed by it. I reach a point where i really was asking myself why it is the most popular javascript framework ? I just see two reasons for it:
1. Event listener:
It's a matter of fact that all the modern browser implement the DOM Level 2 Event Model. As you can read, there is 5 events types : HTML, key, mouse, mutation, UI.
When i check the Jquery event page: They are barely supporting key, mouse and HTML event types.
At the same time the prototype.js page says that it support them all ! I know for a designer or a beginner .click(callback) looks better than .observer('click',callback), but the result is that to a certain level you cannot use Jquery for event listening. As a result, don't us Jquery to do Event-driven programming unless you just do click event.
2. DOM scripting
That was the cherry on the cake of my deception. To create a new node, you have to call the jquery object and include the element string in it like $('<a href="test.html">test</a>'). To be honest i laugh when i rod it. I mean, first the Element class in prototype.js make the code look really legitimate and help the developer to get used to the upcoming JS syntax (like the Image object). Second, it is confusing and those fake function like attr and css as well, they are getter and setter at the same time ! i mean i would love to discuss with the architect to know what motivated this decision. Then you have to insert it in the document now ! I was disappointed by the fact that you have a set of method to interact with the document if the content you want to insert is an object (append, insertBefore etc..) and a string (text(), html()) instead of the simple prototype.js one like update and insert. Same critics about the jquery object, i understand the point to use CSS selector but by doing that, you lost all abilities to make dynamic feature (for a dynamic language that is a problem). For example i cannot have a function like "function foo(bar){return $(bar);}" that accept id string and DOM object because in one case, the syntax would be "$('#'+bar)" and in the other case, it would be "$(bar)". You what i mean ?
3. AJAX
There is nothing much to say, look at the Jquery feature list and the prototype.js one. And for the record i hate the fact that Jquery eval javascript code when it's the result of an ajax call.
4.OOP
It simply inexistant in jquery. Where in prototype.js you have access to all of this features.
I would also add the fact that i hate the fact that the template engine in jquery is a separated module, it should be included by default like in prototype.js or the effect module don't have event listener such as when the animation start or finish neither the possibility to parallelize several effect like what you can do with scriptaculous.
I would just concluded that if Jquery is popular it might be because of it syntactic sugar effect (.click(), .animate()) and, i have to admit, efficient on simple project, but if you move toward more advanced project you will end up writing most of the code in pure javascript increasing the chance of cross browsing issue.
- They had a better communication than the other ones.
- Same "easy to use out of the box" tutorial as Ruby on Rail at the time; You can make a blog in 30min but you can't make a CRM or hight availability application (cf. the quick migration of twitter from ruby to scala/java).
- Event listener
- DOM scripting or DHTML (for the 0ld5k00l3r ;))
- Ajax
- Object Oriented Programming (creating class)
1. Event listener:
It's a matter of fact that all the modern browser implement the DOM Level 2 Event Model. As you can read, there is 5 events types : HTML, key, mouse, mutation, UI.
When i check the Jquery event page: They are barely supporting key, mouse and HTML event types.
At the same time the prototype.js page says that it support them all ! I know for a designer or a beginner .click(callback) looks better than .observer('click',callback), but the result is that to a certain level you cannot use Jquery for event listening. As a result, don't us Jquery to do Event-driven programming unless you just do click event.
2. DOM scripting
That was the cherry on the cake of my deception. To create a new node, you have to call the jquery object and include the element string in it like $('<a href="test.html">test</a>'). To be honest i laugh when i rod it. I mean, first the Element class in prototype.js make the code look really legitimate and help the developer to get used to the upcoming JS syntax (like the Image object). Second, it is confusing and those fake function like attr and css as well, they are getter and setter at the same time ! i mean i would love to discuss with the architect to know what motivated this decision. Then you have to insert it in the document now ! I was disappointed by the fact that you have a set of method to interact with the document if the content you want to insert is an object (append, insertBefore etc..) and a string (text(), html()) instead of the simple prototype.js one like update and insert. Same critics about the jquery object, i understand the point to use CSS selector but by doing that, you lost all abilities to make dynamic feature (for a dynamic language that is a problem). For example i cannot have a function like "function foo(bar){return $(bar);}" that accept id string and DOM object because in one case, the syntax would be "$('#'+bar)" and in the other case, it would be "$(bar)". You what i mean ?
3. AJAX
There is nothing much to say, look at the Jquery feature list and the prototype.js one. And for the record i hate the fact that Jquery eval javascript code when it's the result of an ajax call.
4.OOP
It simply inexistant in jquery. Where in prototype.js you have access to all of this features.
I would also add the fact that i hate the fact that the template engine in jquery is a separated module, it should be included by default like in prototype.js or the effect module don't have event listener such as when the animation start or finish neither the possibility to parallelize several effect like what you can do with scriptaculous.
I would just concluded that if Jquery is popular it might be because of it syntactic sugar effect (.click(), .animate()) and, i have to admit, efficient on simple project, but if you move toward more advanced project you will end up writing most of the code in pure javascript increasing the chance of cross browsing issue.
No comments:
Post a Comment