unified usage of JS interface for Document