Implement Document::doctype

Closes #1482.