Fix renderSpec failing to recognize DOM element and {dom, contentDOM} specs #95

Merged
marijn merged 1 commit from nperez0111/prosemirror-model:main into main 2026-05-18 13:44:15 +02:00
Contributor

In commits 042fe20a74 and bb834ae103 the simplification of the return type broke valid {dom, contentDOM} usage.

This patch adds tests which fail on main & the patch gets them to pass again like they should.

The nodeType checks in renderSpec were incorrectly narrowed to == 3 (text nodes only), causing element nodes and {dom, contentDOM} objects to fall through to the array handling code and throw.

Issue https://github.com/ProseMirror/prosemirror/issues/1566

BlockNote Issue: https://github.com/TypeCellOS/BlockNote/issues/2751

In commits 042fe20a74e7d4dd9b664e9c02040fd411aedf31 and bb834ae1036caabc86db89f42d96870548da70e3 the simplification of the return type broke valid {dom, contentDOM} usage. This patch adds tests which fail on `main` & the patch gets them to pass again like they should. The nodeType checks in renderSpec were incorrectly narrowed to == 3 (text nodes only), causing element nodes and {dom, contentDOM} objects to fall through to the array handling code and throw. Issue https://github.com/ProseMirror/prosemirror/issues/1566 BlockNote Issue: https://github.com/TypeCellOS/BlockNote/issues/2751
The nodeType checks in renderSpec were incorrectly narrowed to == 3 (text
nodes only), causing element nodes and {dom, contentDOM} objects to fall
through to the array handling code and throw.

Issue https://github.com/ProseMirror/prosemirror/issues/1566
Owner

It looks like the intended check there would be == 1. We don't want to let through any DOM node, we want to check for elements. I'm not sure how I ended up writing == 3. Could you adjust the patch to keep the test but just change the 3 to a 1?

It looks like the intended check there would be `== 1`. We don't want to let through any DOM node, we want to check for elements. I'm not sure how I ended up writing `== 3`. Could you adjust the patch to keep the test but just change the 3 to a 1?
Author
Contributor

Thanks for confirmation @marijn, agreed it makes sense to be == 1. Force pushed the patch, so this should be ready now

Thanks for confirmation @marijn, agreed it makes sense to be `== 1`. Force pushed the patch, so this should be ready now
marijn merged commit c167ca40a4 into main 2026-05-18 13:44:15 +02:00
Owner

Thanks for noticing and fixing this! That was quite a bad regression. Released as 1.25.7

Thanks for noticing and fixing this! That was quite a bad regression. Released as 1.25.7
Author
Contributor

No worries, it happens! We have an action runner which always runs BlockNote with the latest prosemirror packages every day. So, we can catch it pretty quickly

No worries, it happens! We have an action runner which always runs BlockNote with the latest `prosemirror` packages every day. So, we can catch it pretty quickly
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-model!95
No description provided.