How is this any different in principle than $.get("page", function(result){document.body = result;}); ?
If the attacker can run the javascript you mentioned, they've already run.
If the attacker can run the javascript you mentioned, they've already run.