Fixing bugs for when map.parent is document.body, though it won't quite work yet in Safari 5.0.