$('#foo').writeCapture().find('.bar').html(dangerousHtml).end().
find('.baz').load('returnsDanger.php').after(moreDangerousHtml).end().
addClass('loading');
In this context, "dangerous" HTML is any HTML that does or could contain a script tag that uses
document.write
, aka, the evil method. The implementation details are wonderfully complicated, but I've made the usage so simple that any code monkey can just chain whatever they like off of a call to writeCapture() and everything will be perfectly "safe". e.g., document.write will not destroy the application and all the content will show up where it is supposed to. So enjoy.EDIT: the comments here aren't a good place to ask for help. You can get help through GitHub.