How to access methods of the JQuery object in the workspace

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

How to access methods of the JQuery object in the workspace

Andy Burnett
I think this must be an FAQ, but I can't find the answer.

I want to find the version of JQuery. In the dev console I could type

jQuery.fn.jquery;
My problem is that - within the workspace - jQuery just reports that it is a blockclosure - but with no methods.  

Clearly, jQuery is present, and working, but I am doing some basic wrong. Could someone explain how to do this in the workspace?

Also, and this is more annoying. On occasion it does work. For instance jQuery getScript('...'); does work. But, I have not managed to work out exactly what combination of messing around in the dev console, and then in amber, actually causes. this.

Cheers
Andy

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to access methods of the JQuery object in the workspace

Herby Vojčík
(jQuery at: 'fn') jquery

the problem is that 'jQuery foo' looks if 'jQuery.foo' exists, and if it is a function, it calls it (if it is non-function, it just returns it).

jQuery getScript: '...' works because it is a keyword message so it knows it should call it. The heuristics is for unary messages, where call wins over return.

Herby

Andy Burnett wrote:

> I think this must be an FAQ, but I can't find the answer.
>
> I want to find the version of JQuery. In the dev console I could type
>
> jQuery.fn.jquery;
> My problem is that - within the workspace - jQuery just reports that
> it is a blockclosure - but with no methods.
>
> Clearly, jQuery is present, and working, but I am doing some basic
> wrong. Could someone explain how to do this in the workspace?
>
> Also, and this is more annoying. On occasion it does work. For
> instance jQuery getScript('...'); does work. But, I have not managed
> to work out exactly what combination of messing around in the dev
> console,
and then in amber, actually causes. this.

>
> Cheers
> Andy
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: How to access methods of the JQuery object in the workspace

Andy Burnett
Thanks Herby,

However, that doesn't work for me. I get "nil does not understand #jquery"

My exact steps are:
  1. Go to amber-lang.net (Firefox 19)
  2. Open the class browser
  3. Select the workspace
  4. Enter on the first line  "(jQuery at: fn)jquery."
  5. Select the line and click InspectIt
That's when I get the DNU

If you do the same, does it work for you?

Cheers
Andy


On Thu, Mar 7, 2013 at 12:40 PM, Herby Vojčík <[hidden email]> wrote:
(jQuery at: 'fn') jquery

the problem is that 'jQuery foo' looks if 'jQuery.foo' exists, and if it is a function, it calls it (if it is non-function, it just returns it).

jQuery getScript: '...' works because it is a keyword message so it knows it should call it. The heuristics is for unary messages, where call wins over return.

Herby


Andy Burnett wrote:
I think this must be an FAQ, but I can't find the answer.

I want to find the version of JQuery. In the dev console I could type

jQuery.fn.jquery;
My problem is that - within the workspace - jQuery just reports that it is a blockclosure - but with no methods.

Clearly, jQuery is present, and working, but I am doing some basic wrong. Could someone explain how to do this in the workspace?

Also, and this is more annoying. On occasion it does work. For instance jQuery getScript('...'); does work. But, I have not managed to work out exactly what combination of messing around in the dev console,
and then in amber, actually causes. this.

Cheers
Andy

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to access methods of the JQuery object in the workspace

Jacob Wagner
In reply to this post by Andy Burnett
  Maybe you already knew about this, but you can get the 'firebug' plugin for chrome or firefox, and it will show you all the functions and variables in the DOM, which has made it easier to figure out what is a function and not in some external javascript libraries.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
<zenchess@gmail.com>
Reply | Threaded
Open this post in threaded view
|

Re: How to access methods of the JQuery object in the workspace

Nicolas Petton
In reply to this post by Andy Burnett
amber-lang.net uses the stable version of amber (version 0.9.1) which is old. Maybe you could try locally with the latest master?

Nico


On Mar 7, 2013, at 6:49 PM, Andy Burnett <[hidden email]> wrote:

Thanks Herby,

However, that doesn't work for me. I get "nil does not understand #jquery"

My exact steps are:
  1. Go to amber-lang.net (Firefox 19)
  2. Open the class browser
  3. Select the workspace
  4. Enter on the first line  "(jQuery at: fn)jquery."
  5. Select the line and click InspectIt
That's when I get the DNU

If you do the same, does it work for you?

Cheers
Andy


On Thu, Mar 7, 2013 at 12:40 PM, Herby Vojčík <[hidden email]> wrote:
(jQuery at: 'fn') jquery

the problem is that 'jQuery foo' looks if 'jQuery.foo' exists, and if it is a function, it calls it (if it is non-function, it just returns it).

jQuery getScript: '...' works because it is a keyword message so it knows it should call it. The heuristics is for unary messages, where call wins over return.

Herby


Andy Burnett wrote:
I think this must be an FAQ, but I can't find the answer.

I want to find the version of JQuery. In the dev console I could type

jQuery.fn.jquery;
My problem is that - within the workspace - jQuery just reports that it is a blockclosure - but with no methods.

Clearly, jQuery is present, and working, but I am doing some basic wrong. Could someone explain how to do this in the workspace?

Also, and this is more annoying. On occasion it does work. For instance jQuery getScript('...'); does work. But, I have not managed to work out exactly what combination of messing around in the dev console,
and then in amber, actually causes. this.

Cheers
Andy

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to access methods of the JQuery object in the workspace

Andy Burnett
In reply to this post by Jacob Wagner
Thanks, that's a good suggestion.

Just for clarity. Can you access the jQuery object in a workspace ( following the process I outlined?). I need to understand whether there is something strange about my setup, or if I am just doing it wrong. 

My understanding is that all JavaScript global objects should be accessible in the workspace. But, I can't get jQuery to play!

On 7 Mar 2013, at 21:48, Zenchess <[hidden email]> wrote:

  Maybe you already knew about this, but you can get the 'firebug' plugin for chrome or firefox, and it will show you all the functions and variables in the DOM, which has made it easier to figure out what is a function and not in some external javascript libraries.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to access methods of the JQuery object in the workspace

Andy Burnett
And finally, the solution appears. As is so often the case, it is a PICNIC issue (Problem In Chair, Not In Computer!). 

I hadn't put the quotes around fn, and that's why it was returning #nil.

I think I will put my basic questions on Stack Overflow, in future, so that I can go back and mark them as fixed.

Cheers


On Fri, Mar 8, 2013 at 8:25 AM, Andy Burnett <[hidden email]> wrote:
Thanks, that's a good suggestion.

Just for clarity. Can you access the jQuery object in a workspace ( following the process I outlined?). I need to understand whether there is something strange about my setup, or if I am just doing it wrong. 

My understanding is that all JavaScript global objects should be accessible in the workspace. But, I can't get jQuery to play!

On 7 Mar 2013, at 21:48, Zenchess <[hidden email]> wrote:

  Maybe you already knew about this, but you can get the 'firebug' plugin for chrome or firefox, and it will show you all the functions and variables in the DOM, which has made it easier to figure out what is a function and not in some external javascript libraries.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.