Someone explain please the following syntax that appear as illustration of jQuery

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Someone explain please the following syntax that appear as illustration of jQuery

mozillanerd
<snip>
"From ..javascript/jquery/ajaxanddommanipulation "
JQAjaxFunctionalTest>>renderContentOn: html
   html code id: #logger; with: DateAndTime now.
   html paragraph: [
      html submitButton
         onClick: (html jQuery ajax
            script: [ :s | s << (s jQuery: #logger) html: DateAndTime now ]);
         with: 'Replace'.
      html submitButton
         onClick: (html jQuery ajax
            script: [ :s | s << (s jQuery: #logger) prepend: DateAndTime now ]);
         with: 'Prepend'.
      html submitButton
         onClick: (html jQuery ajax
            script: [ :s | s << (s jQuery: #logger) append: DateAndTime now ]);
         with: 'Append' ]
"Source"

<code id="logger">2010-12-21T18:56:27-08:00</code>
<p>
  <input id="id17" value="Replace" type="submit" class="submit"/>
  <input id="id19" value="Prepend" type="submit" class="submit"/>
  <input id="id21" value="Append" type="submit" class="submit"/>
</p>
</snip>

I have consulted various documentation text about the use of the '<<' command/
What is it?
Is there documentation for how jQuery for Seaside was architected?
Thanks

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

tfleig
Using Tools/Message Names, I found Script defined << like this:

<< anObject
        ^ self add: anObject

I was confused by this too. I think its simply a synonym for Script>>#add:.

TF

On Tue, Dec 21, 2010 at 7:08 PM, Fritz Schenk <[hidden email]> wrote:

> <snip>
> "From ..javascript/jquery/ajaxanddommanipulation "
> JQAjaxFunctionalTest>>renderContentOn: html
>   html code id: #logger; with: DateAndTime now.
>   html paragraph: [
>      html submitButton
>         onClick: (html jQuery ajax
>            script: [ :s | s << (s jQuery: #logger) html: DateAndTime now ]);
>         with: 'Replace'.
>      html submitButton
>         onClick: (html jQuery ajax
>            script: [ :s | s << (s jQuery: #logger) prepend: DateAndTime now ]);
>         with: 'Prepend'.
>      html submitButton
>         onClick: (html jQuery ajax
>            script: [ :s | s << (s jQuery: #logger) append: DateAndTime now ]);
>         with: 'Append' ]
> "Source"
>
> <code id="logger">2010-12-21T18:56:27-08:00</code>
> <p>
>  <input id="id17" value="Replace" type="submit" class="submit"/>
>  <input id="id19" value="Prepend" type="submit" class="submit"/>
>  <input id="id21" value="Append" type="submit" class="submit"/>
> </p>
> </snip>
>
> I have consulted various documentation text about the use of the '<<' command/
> What is it?
> Is there documentation for how jQuery for Seaside was architected?
> Thanks
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

mozillanerd
Most helpful Tony
Ah!.
Thanks for the use of 'Tools/Message Names. I was searching for the method and
could not find it.

So are they returning 's' from the ajax callback with the its contents carrying
the new contents?

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

tfleig
Yes, I think that the argument to the block is an empty Script object
that you can append to and that is then the result of the block's
execution.

I think, but I am not certain, that you can even append raw Javascript
like this:

   [ :s | s << 'alert("Hello World");' ]

but you should test it because I'm not sure of this.

What wasn't obvious to me (although maybe it should have been) was
that this requires an ajax call to the server even if the Javascript
is static and doesn't really require any information from the server
(like my alert example above.)

To avoid the ajax callback to the server I think you use syntax like:

   onClick: ( 'alert("Hello World");')

Again, I'm new to this also and you should test everything I say
before  accepting it. Maybe someone more knowledgable can point out
any flaws in my reasoning for us newbies.

The sections on this in the Seaside book are essentially unfinished
now, leaving us to speculate how it might work from whatever examples
we can find or by reading the code -- which in most cases is
comment-free.

Regards,
TF


Regards,
TF


On Tue, Dec 21, 2010 at 8:03 PM, Fritz Schenk <[hidden email]> wrote:

> Most helpful Tony
> Ah!.
> Thanks for the use of 'Tools/Message Names. I was searching for the method and
> could not find it.
>
> So are they returning 's' from the ajax callback with the its contents carrying
> the new contents?
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

Ramon Leon-5
In reply to this post by tfleig
On 12/21/2010 08:14 PM, Tony Fleig wrote:
> Using Tools/Message Names, I found Script defined<<  like this:
>
> <<  anObject
> ^ self add: anObject
>
> I was confused by this too. I think its simply a synonym for Script>>#add:.
>
> TF

Since you already know the message name, you can just highlight << and
hit the implementors button in the browser or the hot-keys alt+m to get
to that much faster than launching a new tool; for anyone who doesn't
know this.  Message names is more useful for searching for unknown
selectors that kinda look like something, but is a rather indirect
method of viewing the implementation of a known selector.

--
Ramon Leon
http://onsmalltalk.com
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

tfleig
Ah. Nice.  Thanks for this.

TF

On Dec 21, 2010, at 10:20 PM, Ramon Leon <[hidden email]> wrote:

> On 12/21/2010 08:14 PM, Tony Fleig wrote:
>> Using Tools/Message Names, I found Script defined<<  like this:
>>
>> <<  anObject
>>    ^ self add: anObject
>>
>> I was confused by this too. I think its simply a synonym for Script>>#add:.
>>
>> TF
>
> Since you already know the message name, you can just highlight << and hit the implementors button in the browser or the hot-keys alt+m to get to that much faster than launching a new tool; for anyone who doesn't know this.  Message names is more useful for searching for unknown selectors that kinda look like something, but is a rather indirect method of viewing the implementation of a known selector.
>
> --
> Ramon Leon
> http://onsmalltalk.com
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

Intrader Intrader
In reply to this post by Ramon Leon-5
Thanks Ramon, this is quite useful. The delima in reading this code is that the
other implementations of << are seemingly unrelated.

P.S. As I post my email address ([hidden email]) is found not to be valid for
some unknown reason, so I am using my alternate address

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

Intrader Intrader
In reply to this post by tfleig
Thanks, I have verified your recommendations.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Someone explain please the following syntax that appear as illustration of jQuery

cedreek
In reply to this post by Ramon Leon-5


On 12/21/2010 08:14 PM, Tony Fleig wrote:
Using Tools/Message Names, I found Script defined<<  like this:

<<  anObject
^ self add: anObject

I was confused by this too. I think its simply a synonym for Script>>#add:.

TF

Since you already know the message name, you can just highlight << and hit the implementors button in the browser or the hot-keys alt+m to get to that much faster than launching a new tool; for anyone who doesn't know this.  Message names is more useful for searching for unknown selectors that kinda look like something,


ALT+shift+w  is the very useful shortcut for this one (searching message containing what's selected).

Cheers,


but is a rather indirect method of viewing the implementation of a known selector.

--
Ramon Leon
http://onsmalltalk.com
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside