On Oct 29, 4:36 pm, JoJo <tokyot...@gmail.com> wrote:
> 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?

Yep. I came to the very same conclusion recently —
http://stackoverflow.com/questions/1567496/jquery-anti-pattern-building-selectors-with-string-manipulation/1567743#1567743

--
kangax
--~--~---------~--~----~------------~-------~--~----~
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to