JRS problem

Hi all,

I’m playing with the new RJS stuff. Very cool!

But I have a problem. The following code works ok:

page.select(‘div.blogcomment’).each do |element|
page.visual_effect :highlight, element
end

All div’s with class blogcomment are highlighted correctly. But I just
want the last elemen to be hightlighted. The following code is not
working:

page.visual_effect :highlight, page.select(‘div.blogcomment’).last

Instead of highlighting the last item the generated javascript is
visible on the page.

Do I mis something here?

Marc wrote:

The following code is not
working:

page.visual_effect :highlight, page.select(‘div.blogcomment’).last

Instead of highlighting the last item the generated javascript is
visible on the page.

Do I mis something here?

What javascript is generated?

Alex W. wrote:

What javascript is generated?

try { Form.reset(“comments_form”); Element.replace(“comments”, "
\n \n
Reacties
\n \n\t
\n\t\t
reactie van sdfa op 25-04-2006 21:27
\n\t\t
dsfdsaf
\n\t
\n\t\n\t
\n\t\t
reactie van dsf op 25-04-2006 21:27
\n\t\t
sdfsdaf
\n\t
\n\t\n\t
\n\t\t
reactie van sdf op 25-04-2006 21:28
\n\t\t
sdfdsf
\n\t
\n\t\n \t\n
\n"); $$(“div.blogcomment”).last().toJson().toS(); new
Effect.Highlight(#,{}); } catch (e) { alert(‘RJS error:\n\n’ +
e.toString());
alert(‘Form.reset(“comments_form”);\nElement.replace(“comments”, "
\n \n
Reacties
\n \n\t
\n\t\t
reactie van sdfa op 25-04-2006 21:27
\n\t\t
dsfdsaf
\n\t
\n\t\n\t
\n\t\t
reactie van dsf op 25-04-2006 21:27
\n\t\t
sdfsdaf
\n\t
\n\t\n\t
\n\t\t
reactie van sdf op 25-04-2006 21:28
\n\t\t
sdfdsf
\n\t
\n\t\n \t\n
\n");\n$$(“div.blogcomment”).last().toJson().toS();\nnew
Effect.Highlight(#,{});’); throw e }