Listen to document start instead of document-end