IE9 says it supports document, but it returns the wrong document. So try contentDocument first, then fall back to document. #29