# NodeView with nested structure and parsing

**URL:** <https://discuss.prosemirror.net/t/nodeview-with-nested-structure-and-parsing/2678>\
**Category:** Uncategorized\
**Created:** [April 12, 2020, 8:39am UTC](https://discuss.prosemirror.net/t/nodeview-with-nested-structure-and-parsing/2678 "2020-04-12T08:39:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreypopp](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/andreypopp/32/369_2.png) [@andreypopp](https://discuss.prosemirror.net/u/andreypopp)\
**Post date:** [April 12, 2020, 8:39am UTC](https://discuss.prosemirror.net/t/nodeview-with-nested-structure-and-parsing/2678/1 "2020-04-12T08:39:04Z")

</div>

I’m trying to make a custom node view which has a non-trivial structure and `contentDOM` is not a direct descendant of the `dom`.

```auto
list_item: () => {
  let dom = document.createElement("li");
  let contentDOM = document.createElement("div");     
  dom.innerHTML = `<span>prefix: </span><div class="inner"></div>`;
  dom.querySelector(".inner").appendChild(contentDOM);
  return { dom, contentDOM };
}

```

The `Enter` is set to split the list item and `Shift+Enter` is set to split the paragraphs inside the list item.

**The problem** is when I do `Backspace` on a 2nd empty line:

![Screenshot 2020-04-12 at 11.54.06](https://discuss.prosemirror.net/uploads/secondsite/original/2X/8/8d4d98ca877b3b7a22e96a5e3fd0d5e3f82f4a01.png)

Instead of putting a cursor at the end of the first line it removes all lines from a list item.

I suspect the parsing of DOM isn’t set correctly but I can’t figure out how to do that — the callbacks in a parsing rule for `list_item` don’t get called at all (see `console.log(...)` there).

**CodeSandbox with minimal setup:** [https://codesandbox.io/s/prosemirror-example-oe8rn?file=/src/index.js](https://codesandbox.io/s/prosemirror-example-oe8rn?file=/src/index.js)

**Video:** [https://v.usetapes.com/PwYlqSYCSg](https://v.usetapes.com/PwYlqSYCSg)

---

<div class="post-metadata">

**Author:** ![andreypopp](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/andreypopp/32/369_2.png) [@andreypopp](https://discuss.prosemirror.net/u/andreypopp)\
**Post date:** [April 12, 2020, 10:21am UTC](https://discuss.prosemirror.net/t/nodeview-with-nested-structure-and-parsing/2678/2 "2020-04-12T10:21:18Z")

</div>

Added some `console.log` inside PM:

- Seems like `contentElement` isn’t get called if `getContent` is set.
- `getContent` is set by PM itself on rule (and overrides the one provided by me) if `contentLost` is `true`

But I can’t figure out how `contentLost` become `true` in my case — seems like `contentDOM` element is being detached from `dom` element at some point.
