Incorporate fixes from google-caja branch. Fix some bugs.


git-svn-id: http://es-lab.googlecode.com/svn/trunk@796 aeea10e6-ec39-11de-83d8-6d5adf01d787