Avoid dependency on global document.