Calling a DOM method from jQuery

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

Calling a DOM method from jQuery

John Toohey
Hi,
To set the focus to the first field in a jQuery Dialog, I call onOpen:
((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
complains that focus() is not a function. Am I doing something wrong
here?

Thanks.

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

Re: Calling a DOM method from jQuery

Lukas Renggli
> To set the focus to the first field in a jQuery Dialog, I call onOpen:
> ((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
> complains that focus() is not a function. Am I doing something wrong
> here?

The argument to #call: is a method name, not a method call itself. If
you have a look at the generated code with FireBug you can see that
this produces $('#username').focus()(). The methods #call:,
#call:with:, #call:with:with:, etc. are the Javascript counterpart to
#perform:, #perform:with:, #perform:with:with: in Smalltalk.

Another issue -- but that is from my side -- is that #focus is
missing. I will shortly commit a version of JQuery-Core that includes
these event triggers as native methods, so you don't need to use
#call: anymore.

Lukas

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

Re: Calling a DOM method from jQuery

Lukas Renggli
Name: JQuery-Core-lr.58
Author: lr
Time: 24 April 2009, 8:49:46 pm
UUID: 8123a342-53a1-4be6-84b6-101687e42b01
Ancestors: JQuery-Core-lr.57

- added missing events and all triggers

This adds #triggerFocus, and many other things missing from the
event-protocol (http://docs.jquery.com/Events).

Lukas

On Fri, Apr 24, 2009 at 8:27 PM, Lukas Renggli <[hidden email]> wrote:

>> To set the focus to the first field in a jQuery Dialog, I call onOpen:
>> ((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
>> complains that focus() is not a function. Am I doing something wrong
>> here?
>
> The argument to #call: is a method name, not a method call itself. If
> you have a look at the generated code with FireBug you can see that
> this produces $('#username').focus()(). The methods #call:,
> #call:with:, #call:with:with:, etc. are the Javascript counterpart to
> #perform:, #perform:with:, #perform:with:with: in Smalltalk.
>
> Another issue -- but that is from my side -- is that #focus is
> missing. I will shortly commit a version of JQuery-Core that includes
> these event triggers as native methods, so you don't need to use
> #call: anymore.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>



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

Re: Calling a DOM method from jQuery

John Toohey-2
Excellent work, thanks Lukas.

BTW, Do you know what is causing the problems in the Comet examples in
the latest Comet code?

On Fri, Apr 24, 2009 at 14:56, Lukas Renggli <[hidden email]> wrote:

> Name: JQuery-Core-lr.58
> Author: lr
> Time: 24 April 2009, 8:49:46 pm
> UUID: 8123a342-53a1-4be6-84b6-101687e42b01
> Ancestors: JQuery-Core-lr.57
>
> - added missing events and all triggers
>
> This adds #triggerFocus, and many other things missing from the
> event-protocol (http://docs.jquery.com/Events).
>
> Lukas
>
> On Fri, Apr 24, 2009 at 8:27 PM, Lukas Renggli <[hidden email]> wrote:
>>> To set the focus to the first field in a jQuery Dialog, I call onOpen:
>>> ((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
>>> complains that focus() is not a function. Am I doing something wrong
>>> here?
>>
>> The argument to #call: is a method name, not a method call itself. If
>> you have a look at the generated code with FireBug you can see that
>> this produces $('#username').focus()(). The methods #call:,
>> #call:with:, #call:with:with:, etc. are the Javascript counterpart to
>> #perform:, #perform:with:, #perform:with:with: in Smalltalk.
>>
>> Another issue -- but that is from my side -- is that #focus is
>> missing. I will shortly commit a version of JQuery-Core that includes
>> these event triggers as native methods, so you don't need to use
>> #call: anymore.
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>>
>
>
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



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

Re: Calling a DOM method from jQuery

Lukas Renggli
As I said, I cannot reproduce the Comet problems. It works for me. Are
there any complaints by FireBug?

Lukas

On Fri, Apr 24, 2009 at 9:11 PM, John Toohey <[hidden email]> wrote:

> Excellent work, thanks Lukas.
>
> BTW, Do you know what is causing the problems in the Comet examples in
> the latest Comet code?
>
> On Fri, Apr 24, 2009 at 14:56, Lukas Renggli <[hidden email]> wrote:
>> Name: JQuery-Core-lr.58
>> Author: lr
>> Time: 24 April 2009, 8:49:46 pm
>> UUID: 8123a342-53a1-4be6-84b6-101687e42b01
>> Ancestors: JQuery-Core-lr.57
>>
>> - added missing events and all triggers
>>
>> This adds #triggerFocus, and many other things missing from the
>> event-protocol (http://docs.jquery.com/Events).
>>
>> Lukas
>>
>> On Fri, Apr 24, 2009 at 8:27 PM, Lukas Renggli <[hidden email]> wrote:
>>>> To set the focus to the first field in a jQuery Dialog, I call onOpen:
>>>> ((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
>>>> complains that focus() is not a function. Am I doing something wrong
>>>> here?
>>>
>>> The argument to #call: is a method name, not a method call itself. If
>>> you have a look at the generated code with FireBug you can see that
>>> this produces $('#username').focus()(). The methods #call:,
>>> #call:with:, #call:with:with:, etc. are the Javascript counterpart to
>>> #perform:, #perform:with:, #perform:with:with: in Smalltalk.
>>>
>>> Another issue -- but that is from my side -- is that #focus is
>>> missing. I will shortly commit a version of JQuery-Core that includes
>>> these event triggers as native methods, so you don't need to use
>>> #call: anymore.
>>>
>>> Lukas
>>>
>>> --
>>> Lukas Renggli
>>> http://www.lukas-renggli.ch
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
>
> --
> -JT
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



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

Re: Calling a DOM method from jQuery

John Toohey-2
No errors that I can see. I did this again :-

- Clean image with SeaSide 2.9-a3
- Installed latest Comet and Comet examples.
- Run the Counter example, and the counters only update when I
manually refresh the page.

- Deleted Comet classes from image
- Loaded Comet-Core 31
- Re run Counter app, and all counter update automatically.

I will be working on this again tomorrow, and will let you know what I find.



On Fri, Apr 24, 2009 at 16:16, Lukas Renggli <[hidden email]> wrote:

> As I said, I cannot reproduce the Comet problems. It works for me. Are
> there any complaints by FireBug?
>
> Lukas
>
> On Fri, Apr 24, 2009 at 9:11 PM, John Toohey <[hidden email]> wrote:
>> Excellent work, thanks Lukas.
>>
>> BTW, Do you know what is causing the problems in the Comet examples in
>> the latest Comet code?
>>
>> On Fri, Apr 24, 2009 at 14:56, Lukas Renggli <[hidden email]> wrote:
>>> Name: JQuery-Core-lr.58
>>> Author: lr
>>> Time: 24 April 2009, 8:49:46 pm
>>> UUID: 8123a342-53a1-4be6-84b6-101687e42b01
>>> Ancestors: JQuery-Core-lr.57
>>>
>>> - added missing events and all triggers
>>>
>>> This adds #triggerFocus, and many other things missing from the
>>> event-protocol (http://docs.jquery.com/Events).
>>>
>>> Lukas
>>>
>>> On Fri, Apr 24, 2009 at 8:27 PM, Lukas Renggli <[hidden email]> wrote:
>>>>> To set the focus to the first field in a jQuery Dialog, I call onOpen:
>>>>> ((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
>>>>> complains that focus() is not a function. Am I doing something wrong
>>>>> here?
>>>>
>>>> The argument to #call: is a method name, not a method call itself. If
>>>> you have a look at the generated code with FireBug you can see that
>>>> this produces $('#username').focus()(). The methods #call:,
>>>> #call:with:, #call:with:with:, etc. are the Javascript counterpart to
>>>> #perform:, #perform:with:, #perform:with:with: in Smalltalk.
>>>>
>>>> Another issue -- but that is from my side -- is that #focus is
>>>> missing. I will shortly commit a version of JQuery-Core that includes
>>>> these event triggers as native methods, so you don't need to use
>>>> #call: anymore.
>>>>
>>>> Lukas
>>>>
>>>> --
>>>> Lukas Renggli
>>>> http://www.lukas-renggli.ch
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> http://www.lukas-renggli.ch
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>>
>>
>> --
>> -JT
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



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

Re: Calling a DOM method from jQuery

Lukas Renggli
> - Clean image with SeaSide 2.9-a3
> - Installed latest Comet and Comet examples.
> - Run the Counter example, and the counters only update when I
> manually refresh the page.

I cannot reproduce. I followed the steps and loaded Seaside 2.9-a3
into a fresh Pharo image and then updated to the latest code. It works
for me. Are you sure that you are using the WAListener? Comet requires
a streaming server and does not work with Swazoo or the normal Kom
adaptor. Unfortunately it does not show an error message, as earlier
versions did.

Lukas

>
> - Deleted Comet classes from image
> - Loaded Comet-Core 31
> - Re run Counter app, and all counter update automatically.
>
> I will be working on this again tomorrow, and will let you know what I find.
>
>
>
> On Fri, Apr 24, 2009 at 16:16, Lukas Renggli <[hidden email]> wrote:
>> As I said, I cannot reproduce the Comet problems. It works for me. Are
>> there any complaints by FireBug?
>>
>> Lukas
>>
>> On Fri, Apr 24, 2009 at 9:11 PM, John Toohey <[hidden email]> wrote:
>>> Excellent work, thanks Lukas.
>>>
>>> BTW, Do you know what is causing the problems in the Comet examples in
>>> the latest Comet code?
>>>
>>> On Fri, Apr 24, 2009 at 14:56, Lukas Renggli <[hidden email]> wrote:
>>>> Name: JQuery-Core-lr.58
>>>> Author: lr
>>>> Time: 24 April 2009, 8:49:46 pm
>>>> UUID: 8123a342-53a1-4be6-84b6-101687e42b01
>>>> Ancestors: JQuery-Core-lr.57
>>>>
>>>> - added missing events and all triggers
>>>>
>>>> This adds #triggerFocus, and many other things missing from the
>>>> event-protocol (http://docs.jquery.com/Events).
>>>>
>>>> Lukas
>>>>
>>>> On Fri, Apr 24, 2009 at 8:27 PM, Lukas Renggli <[hidden email]> wrote:
>>>>>> To set the focus to the first field in a jQuery Dialog, I call onOpen:
>>>>>> ((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
>>>>>> complains that focus() is not a function. Am I doing something wrong
>>>>>> here?
>>>>>
>>>>> The argument to #call: is a method name, not a method call itself. If
>>>>> you have a look at the generated code with FireBug you can see that
>>>>> this produces $('#username').focus()(). The methods #call:,
>>>>> #call:with:, #call:with:with:, etc. are the Javascript counterpart to
>>>>> #perform:, #perform:with:, #perform:with:with: in Smalltalk.
>>>>>
>>>>> Another issue -- but that is from my side -- is that #focus is
>>>>> missing. I will shortly commit a version of JQuery-Core that includes
>>>>> these event triggers as native methods, so you don't need to use
>>>>> #call: anymore.
>>>>>
>>>>> Lukas
>>>>>
>>>>> --
>>>>> Lukas Renggli
>>>>> http://www.lukas-renggli.ch
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Lukas Renggli
>>>> http://www.lukas-renggli.ch
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>
>>>
>>>
>>>
>>> --
>>> -JT
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
>
> --
> -JT
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



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

Re: Calling a DOM method from jQuery

John Toohey-2
Hey,
Spent most of the day downloading various Pharo images and trying to
install SS2.9A3, without success. Then I found the pre-builit image
that you uploaded to builder.seaside.st. Downloaded that and did the
following :-

- ScriptLoader loadTools to get the latest package browser. The one in
the image did not work.
- Via MC downloaded the latest Comet-Core, Comet-Examples,
Comet-Squeak, and Comet-Tests
- Start the Counter app
- No data is delivered in the response.

- Ran the Comet-tests and testForkCometProcessDo failed with this :-
'25 April 2009 3:43:37 pm

VM: Mac OS - a SmalltalkImage
Image: Pharo0.1 [Latest update: #10250]

SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir /Users/jpt/Dev/repos/Dev-Images/Juliet-SS-a3
Trusted Dir /foobar/tooBar/forSqueak/bogus
Untrusted Dir /Users/jpt/Library/Preferences/Squeak/Internet/My Squeak

WAPlatformTest(Object)>>doesNotUnderstand: #platform
        Receiver: WAPlatformTest>>#testForkCometProcessDo
        Arguments and temporary variables:
                aMessage: platform
                exception: MessageNotUnderstood: WAPlatformTest>>platform
                resumeValue: nil
        Receiver''s instance variables:
                testSelector: #testForkCometProcessDo


On Sat, Apr 25, 2009 at 05:24, Lukas Renggli <[hidden email]> wrote:

>> - Clean image with SeaSide 2.9-a3
>> - Installed latest Comet and Comet examples.
>> - Run the Counter example, and the counters only update when I
>> manually refresh the page.
>
> I cannot reproduce. I followed the steps and loaded Seaside 2.9-a3
> into a fresh Pharo image and then updated to the latest code. It works
> for me. Are you sure that you are using the WAListener? Comet requires
> a streaming server and does not work with Swazoo or the normal Kom
> adaptor. Unfortunately it does not show an error message, as earlier
> versions did.
>
> Lukas
>
>>
>> - Deleted Comet classes from image
>> - Loaded Comet-Core 31
>> - Re run Counter app, and all counter update automatically.
>>
>> I will be working on this again tomorrow, and will let you know what I find.
>>
>>
>>
>> On Fri, Apr 24, 2009 at 16:16, Lukas Renggli <[hidden email]> wrote:
>>> As I said, I cannot reproduce the Comet problems. It works for me. Are
>>> there any complaints by FireBug?
>>>
>>> Lukas
>>>
>>> On Fri, Apr 24, 2009 at 9:11 PM, John Toohey <[hidden email]> wrote:
>>>> Excellent work, thanks Lukas.
>>>>
>>>> BTW, Do you know what is causing the problems in the Comet examples in
>>>> the latest Comet code?
>>>>
>>>> On Fri, Apr 24, 2009 at 14:56, Lukas Renggli <[hidden email]> wrote:
>>>>> Name: JQuery-Core-lr.58
>>>>> Author: lr
>>>>> Time: 24 April 2009, 8:49:46 pm
>>>>> UUID: 8123a342-53a1-4be6-84b6-101687e42b01
>>>>> Ancestors: JQuery-Core-lr.57
>>>>>
>>>>> - added missing events and all triggers
>>>>>
>>>>> This adds #triggerFocus, and many other things missing from the
>>>>> event-protocol (http://docs.jquery.com/Events).
>>>>>
>>>>> Lukas
>>>>>
>>>>> On Fri, Apr 24, 2009 at 8:27 PM, Lukas Renggli <[hidden email]> wrote:
>>>>>>> To set the focus to the first field in a jQuery Dialog, I call onOpen:
>>>>>>> ((html jQuery id: #username)  call: 'focus()'); Its works fine, but FF
>>>>>>> complains that focus() is not a function. Am I doing something wrong
>>>>>>> here?
>>>>>>
>>>>>> The argument to #call: is a method name, not a method call itself. If
>>>>>> you have a look at the generated code with FireBug you can see that
>>>>>> this produces $('#username').focus()(). The methods #call:,
>>>>>> #call:with:, #call:with:with:, etc. are the Javascript counterpart to
>>>>>> #perform:, #perform:with:, #perform:with:with: in Smalltalk.
>>>>>>
>>>>>> Another issue -- but that is from my side -- is that #focus is
>>>>>> missing. I will shortly commit a version of JQuery-Core that includes
>>>>>> these event triggers as native methods, so you don't need to use
>>>>>> #call: anymore.
>>>>>>
>>>>>> Lukas
>>>>>>
>>>>>> --
>>>>>> Lukas Renggli
>>>>>> http://www.lukas-renggli.ch
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Lukas Renggli
>>>>> http://www.lukas-renggli.ch
>>>>> _______________________________________________
>>>>> seaside mailing list
>>>>> [hidden email]
>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -JT
>>>> _______________________________________________
>>>> seaside mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>>
>>>
>>>
>>>
>>> --
>>> Lukas Renggli
>>> http://www.lukas-renggli.ch
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>>
>>
>> --
>> -JT
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



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