Yes, that is exactly that. All calls to "UJS" helpers feed a buffer and the
code doesn't appear directly in the page. But the page includes a JavaScript
file, in which the buffered code is written. Therefore, all code included in
a "UJS" call is separated from the content, even if, for the developer, it
appears inside the template code.

Francois

-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la
part de John Resig
Envoyé : vendredi 2 mars 2007 09:17
À : jQuery Discussion.
Objet : Re: [jQuery] Announce: Unobtrusive JavaScript with jQuery andsymfony

David -

I think the "catch" was the very last item that was mentioned on the
page: Grouping all "inline" JS snippets into a single file. That's what
makes the plugin all worth it.

--John

On 3/2/07, David Duymelinck <[EMAIL PROTECTED]> wrote:
> François Zaninotto schreef:
> > I'm not sure I get you... All the helpers described in the blog post 
> > are bundled with the plugin. Or do you mean something else?
> >
> >
> Why would you need to have a function that writes inline javascript 
> code if the whole idea of the plugin is to generate unobtrusive
javascript.
> I'm talking about the
>
> UJS_write function to be exact.
>
> http://www.symfony-project.com/trac/wiki/sfUJSPlugin#Addingsomecontent
> unobtrusively
>
> It is this example that confused me.
>
> <?php UJS_write('<a href="#" onclick="$(\'#foobar\').toggle();return 
> false;">click me</a>') ?>
>
> Isn't it better to write it as
>
> <?php
> UJS_write('<a href="#" class="toggle">click me</a>'); 
> UJS_add_behaviour('a.toggle', 'click', "$('#foobar').toggle();return 
> false;"); ?>
>
> If you go unobtrusive go unobtrusive all the way :)
>
> Once i get around to learning how to use symfony i will definitively 
> give your helper a try. I bet this will amaze my more code challenged 
> colleagues :)
>
> --
> David Duymelinck
> ________________
> [EMAIL PROTECTED]
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to