How to check the existence of div?

Neat. Not surprising to see yet another excellent thing from Dan Webb!. With the latest stuff I've been I doing I've taking to just the writing the javascript statically.
Actions render :json (or just html fragments) and the ajax callbacks on the other side put things together. With a good dose of prototype javascript isn't that bad. And I can write better unit tests for my static javascript than I can for generated javacscript.

Fred

page.select("##{params[:id]}parents").any(elem){|elem|.replace_html
'blah'}

page.select will return a collection of dom elements that match a css
selector, so the first part of that line is selecting the element with
id='xparents'

The second half of the line (*.any(){}) translates to a javascript
iterator on the returned collection. I have not tested that
particular code but I've used rjs like it to conditionally update the
browser in the past.