Fixed a problem when the DOCUMENT-END event is not emitted until the beginning of...