# Getting a hold of the \`document\` used by ProseMirror from \`toDOM()\`

**URL:** https://discuss.prosemirror.net/t/getting-a-hold-of-the-document-used-by-prosemirror-from-todom/8392
**Category:** Uncategorized
**Created:** [May 7, 2025, 12:41pm UTC](https://discuss.prosemirror.net/t/getting-a-hold-of-the-document-used-by-prosemirror-from-todom/8392 "2025-05-07T12:41:38Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![strogonoff](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/strogonoff/32/4297_2.png) [@strogonoff](https://discuss.prosemirror.net/u/strogonoff)
#### Post date: [May 9, 2025, 10:32am UTC](https://discuss.prosemirror.net/t/getting-a-hold-of-the-document-used-by-prosemirror-from-todom/8392/6 "2025-05-09T10:32:16Z")

</div>

1. Getting a hold of DOM serializer’s `document` in `toDOM()` seems to involve:

2. Regarding what `document` entails, for ProseMirror’s purposes (meaning both what callers must pass to `serializeNode()` and what it’d pass to spec’s `toDOM()` per (1) above) it seems to be a tiny subset of `Document` with only the following:

Notes;

- The above changes are backward compatible and don’t affect existing users.

- The changes are independent of each other, though I would say it’d be better to narrow down `Document` first, if it’s to be added to `toDOM()`’s signature.

- In fact, instead of giving `toDOM()` access to `document`, even a narrowed-down version, it could be worth passing _just_ an element constructor function:

---

_[View the full topic](https://discuss.prosemirror.net/t/getting-a-hold-of-the-document-used-by-prosemirror-from-todom/8392)._
