I reported an error in error list - it was incorrectly classified as 'ignored'

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

I reported an error in error list - it was incorrectly classified as 'ignored'

Intrader Intrader
http://code.google.com/p/seaside/issues/detail?id=640
The problem remains and does not have to do with the source view as Julian
suggests. The problem occurs because the expression: method String single
quote 'external_links a' was changed to double quotes to "external_links a".
Subsequent handling of the onClick: message encloses the entire construct
in double quotes; hence the error as JavaScript does not accept embedded
unescaped double quotes.
This is a bug that needs to be address and not ignored.
The analysis starts going wrong at Comment 4 and finally nailed in the coffin
by comment 17
This is not a bug in the Halo handling. the Seaside code is as follows:
<code>
renderContentOn: html
        1 to: 5
                do: [:x | html div id: 'external_links';
                               
                                with: [html anchor
                                                callback: [x inspect];
                                                 with: x]].
        1 to: 5
                do: [:x | html div id: '\"external_links\"';
                                 with: 'just some content'].
"the code for html button onClick: is incorrectly translated resulting in
code that does not work"
html button
onClick: ((html jQuery expression: 'external_links a')
onClick: 'return confirm("You are going to visit: "+ this.href)');
                 with: 'Attach Click'
</code>

When the code does not work, the result is that 'inform' is executed without
a prior execution of 'confirm'.

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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

littleSmalltalker
Fritz,
Here's the actual generated code for your expression:

<button onclick="$(&quot;external_links a&quot;).click(function(){return confirm(&quot;You are \&quot;going\&quot; to visit: &quot;+ this.href)})" type="submit" class="submit">Attach Click</button>

This appears only on actual source code, and not any other Firebug-like debuggers which convert HTML entities to their representations.
Cheers,
Avi.
On Sat, Feb 12, 2011 at 9:44 AM, Fritz Schenk <[hidden email]> wrote:
http://code.google.com/p/seaside/issues/detail?id=640
The problem remains and does not have to do with the source view as Julian
suggests. The problem occurs because the expression: method String single
quote 'external_links a' was changed to double quotes to "external_links a".
Subsequent handling of the onClick: message encloses the entire construct
in double quotes; hence the error as JavaScript does not accept embedded
unescaped double quotes.
This is a bug that needs to be address and not ignored.
The analysis starts going wrong at Comment 4 and finally nailed in the coffin
by comment 17
This is not a bug in the Halo handling. the Seaside code is as follows:
<code>
renderContentOn: html
       1 to: 5
               do: [:x | html div id: 'external_links';

                               with: [html anchor
                                               callback: [x inspect];
                                                with: x]].
       1 to: 5
               do: [:x | html div id: '\"external_links\"';
                                with: 'just some content'].
"the code for html button onClick: is incorrectly translated resulting in
code that does not work"
html button
onClick: ((html jQuery expression: 'external_links a')
onClick: 'return confirm("You are going to visit: "+ this.href)');
                with: 'Attach Click'
</code>

When the code does not work, the result is that 'inform' is executed without
a prior execution of 'confirm'.

_______________________________________________
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: I reported an error in error list - it was incorrectly classified as 'ignored'

Bob Arning
In reply to this post by Intrader Intrader
Fritz,

On 2/12/11 2:44 AM, Fritz Schenk wrote:

> "the code for html button onClick: is incorrectly translated resulting in
> code that does not work"
> html button
> onClick: ((html jQuery expression: 'external_links a')
> onClick: 'return confirm("You are going to visit: "+ this.href)');
> with: 'Attach Click'
> </code>
>
> When the code does not work, the result is that 'inform' is executed without
> a prior execution of 'confirm'.
>
The reason your example did not work is the missing # (which indicates
that external_links is an ID and not an element type). If you add it as
below, the code works.

     html button
         onClick: ((html jQuery expression: '#external_links a')
         onClick: 'return confirm("You are going to visit: "+ this.href)');
                  with: 'Attach Click'

See:

expression: aString
     "This function accepts a string containing a CSS selector which is
then used to match a set of elements."

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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

Intrader Intrader
Thank you Bob and Avi,

Indeed an earlier version of the code had the '#' in '#external_links a'. I
messed it up while trying various things.
The code
<code>
renderContentOn: html
        1 to: 5 do: [ :x |
                (html div)
                        id: 'external_links';
                        with: [
                                                (html anchor)
                                                        callback: [ x inspect ];
                                                        with: x ] ].
        1 to: 5 do: [ :x |
                (html div)
                        id: '\"external_links\"';
                        with: 'just some content' ].
        (html button)
                onClick:
                   ((html jQuery expression: '#external_links a') onClick: 'return
confirm("You are going to visit: "+ this.href)');
                with: 'Attach Click'
</code>
does not work on account of something wrong with the handling of quotes. When I
click on one of the link, the Inspector pops up immediately - the confirm
should trigger first.



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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

Intrader Intrader
In reply to this post by Bob Arning
Bob and Avi, I have simplified the code as follows:
<code>
renderContentOn: html
        | x |
        x := 100.
        (html div)
                id: 'external_links';
                with: [
                                        (html anchor)
                                                callback: [ x inspect ];
                                                with: x ].
        (html div)
                id: 'external_links';
                with: 'just some content'.
        (html button)
                onClick:
                ((html jQuery expression: '#external_links a') onClick: 'return
confirm("You are going to visit: "+ this.href)');
                with: 'Attach Click'
</code>
To reproduce, first I click on the button, then I click on the single link
('100'). The inspector for 100 pops up instead of the confirm first.





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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

Lukas Renggli
In reply to this post by Intrader Intrader
One thing is certain in the presented code example: It cannot work
because of duplicated IDs.

Lukas

On 12 February 2011 19:48, Fritz Schenk <[hidden email]> wrote:

> Thank you Bob and Avi,
>
> Indeed an earlier version of the code had the '#' in '#external_links a'. I
> messed it up while trying various things.
> The code
> <code>
> renderContentOn: html
>        1 to: 5 do: [ :x |
>                (html div)
>                        id: 'external_links';
>                        with: [
>                                                (html anchor)
>                                                        callback: [ x inspect ];
>                                                        with: x ] ].
>        1 to: 5 do: [ :x |
>                (html div)
>                        id: '\"external_links\"';
>                        with: 'just some content' ].
>        (html button)
>                onClick:
>                   ((html jQuery expression: '#external_links a') onClick: 'return
> confirm("You are going to visit: "+ this.href)');
>                with: 'Attach Click'
> </code>
> does not work on account of something wrong with the handling of quotes. When I
> click on one of the link, the Inspector pops up immediately - the confirm
> should trigger first.
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
Lukas Renggli
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: I reported an error in error list - it was incorrectly classified as 'ignored'

Intrader Intrader
Lukas, Bob and Avi

I have simplified the test
<code>
renderContentOn: html
        | x |
        x := 100.
        (html div)
                id: 'external_links';
                with: [
                                        (html anchor)
                                                callback: [ x inspect ];
                                                with: x ].
        (html div)
                id: 'external_links';
                with: 'just some content'.
        (html button)
                onClick:
                ((html jQuery expression: '#external_links a') onClick: 'return
confirm("You are going to visit: "+ this.href)');
                with: 'Attach Click'
</code>

Lukas, the duplicated ids are intentional to test the selection <a> from all the
'#external_links'.
Multiple selections of id work just fine in jQuery as well as for JavaScript
getElementsByTagName. You just get an array - jQuery handles this filter
beautifully.
Using the console of your browser you can see that $('#external_links') returns
an array with two elements.

The example code works as expected;
I thank you for your trouble and help.






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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

Bob Arning
Fritz,

One further thing to note: I copied the code you said worked directly from the email into a browser in Squeak and it did NOT work. Since it looked right, I compared it carefully to the previous version that worked for me. The problem was in these two (in the email anyway)
lines:

On 2/12/11 2:36 PM, Fritz Schenk wrote:
		((html jQuery expression: '#external_links a') onClick: 'return 
confirm("You are going to visit: "+ this.href)');

Pasted as-is into Squeak with the line break after 'return', causes a carriage return character to be inserted into the string literal between 'return' and 'confirm'. This fails to run. If I edit the squeak to force the string literal to be all on one line, it does work. Don't know if this may have happened to anyone trying to follow this discussion, but food for thought.

Cheers,
Bob

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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

Intrader Intrader
Bob, you hit it on the nail. If I break the line in the 'Halo' version of the
code, it does not work. The return creates a problem for the browser.


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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

NorbertHartl

On 13.02.2011, at 03:17, Fritz Schenk wrote:

> Bob, you hit it on the nail. If I break the line in the 'Halo' version of the
> code, it does not work. The return creates a problem for the browser.
>
It is javascript not the browser. Andthis is a common mistake in javascript programming. A statement can be terminated by ; or newline. So

return
   "hello world";  

is the same as

return;

Norbert



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

Re: I reported an error in error list - it was incorrectly classified as 'ignored'

Intrader Intrader
Norbert , thanks.
Of course.
What happened is that in sending the code in the message, I overran the 80
character limit by inserting a return without noticing that the return
statement would terminate.
Thanks



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