OK, I was having a problem where I was passing an article title to the sharethis JavaScript and the presence of single quotes (for example) was breaking the widget.
I discovered that if I added the following script before the sharethis JavaScript and then calling this variable instead of the raw title works.
Now, the system I'm using has an escape function built in, but so does JavaScript, which you can use to escape the title string.
Hope that helps someone.
<script type="text/javascript">
escaped_title="{{ entry.title | escape }}";
</script>