Hi Tom. While I feel what you're saying, at the same time I think sometimes we "seasoned" folks forget how we got here. For some people just entering this arena, who may not yet be aware of the golden separation of concerns/semanticially correct models, it may just be that they need to hear it in order to move through that natural progression... and if we stop actively ranting about it then we're just leaving it to chance for them to stumble upon an article on the subject (not that there is any shortage of those)... whereas we can keep up the good fight and help out the noobs by pointing out these methods, even though that may come across as being pedantic at times... just some thoughts from the flip side I guess.

On 9/14/06, Tom Gregory <[EMAIL PROTECTED]> wrote:

Ya know, I see comments like this fairly regularly on the list, and
it's starting to grate a bit.

There is nothing wrong with doing it the way he did.  It's faster to
code when coding by hand.  It will respond to events as soon as it's
displayed rather than after the entire page has loaded. Etc., etc.

Yes, you are correct that current practice is to separate behavior
from semantic meaning and meta-data.  Yes, coding in a consistent
style through multiple projects makes code easier to revisit. Yes,
all of the (blee/lead)ding edge standards go so far as to suggest all
js be in a separate file. In all of this, we forget that the "old
ways" still work. You see, you took 5 lines to accomplish what he did
with an inline handler.

Sometimes quick and dirty is just fine (especially with an older
DOCTYPE). Let's not be too zealous about it.


TAG

On Sep 14, 2006, at 9:58 AM, Christophe Porteneuve aka TDD wrote:

>
> Hey again,
>
> [EMAIL PROTECTED] a écrit :
>> <a href="" return
>> false;">Toggle appear</a>
>
> BTW, this code is, well...  'could be better, I guess, is a nice
> way to
> qualify it.  First, the "return false" thing is dead.  Dead, dead,
> dead.
>  Second, you shouldn't put JS events in your HTML like that; you
> should
> use unobstrusive JS.
>
> For instance, you should assign this link an ID, then observe it
> from an
> external script file, with something such as:
>
>
>     function toggleLink(e) {
>         Event.stop(e);
>         Effect.toggle('d3', 'appear', { duration: 0.5 });
>     } // toggleLink
>
>     Event.observe('yourLinkId', 'click', toggleLink);
>
> If you wish to reuse the toggleLink function on multiple links, for
> multiple DIVs, you can:
>
>     function toggleLink(e, containerId) {
>         Event.stop(e);
>         Effect.toggle(containerId, 'appear', { duration: 0.5 });
>     }
>
>     Event.observe('yourLinkId', 'click',
>         toggleLink.bindAsEventListener ('d3');
>     ...
>
> --
> Christophe Porteneuve aka TDD
> [EMAIL PROTECTED]
>
> >


Athena Group, Inc.
Inquire: 1-888-919-8700 x2903
Blog: http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" 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/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to