Is it poor practice to use $$?
$$('#grandparent #parent tag.class');
I've been using $$ quite a lot because it has sped up DEVELOPMENT, but
now I have realized that it will slow down MAINTENANCE. Recently, my
boss asked me to move a whole div to another part of the page. Since
I was accessing that div with $$, I was forced to change my JS along
with my HTML. If I had accessed that div with $('elementID'), I would
have only needed to edit my HTML.
For this, I believe that $$ is a violation of the model-view-
controller paradigm. HTML and CSS are the view. JS should be thought
of as the controller. If you think about it, JS processes user input
just like PHP, except on a livelier schedule. To make your website
easier to implement, you should refrain from using $$ to describe the
HTML structure.
What are your thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---