[session/transaction] move most undo support into transaction
A small part that need repo access has not been moved into transaction yet.
<div id="ajaxroot">
<div class="ajaxHtmlHead">
<script src="http://foo.js" type="text/javascript"> </script>
<link rel="stylesheet" type="text/css" media="all" href="qunit.css" />
</div>
<h1>Hello</h1>
</div>