Skip to content

Add isEmpty test (deep tree check) to MmlNode and use it to test for empty mathop.#1428

Merged
dpvc merged 3 commits intodevelopfrom
fix/empty-op
Feb 5, 2026
Merged

Add isEmpty test (deep tree check) to MmlNode and use it to test for empty mathop.#1428
dpvc merged 3 commits intodevelopfrom
fix/empty-op

Conversation

@dpvc
Copy link
Member

@dpvc dpvc commented Feb 5, 2026

This PR adds an isEmtpy getter to the MmlNode class that does a deep tree test to see if an element contains only empty elements and that token nodes only empty text nodes as children. This is used in the test for empty \mathop elements so that it catches \mathop{\mathrm{}} as empty, the original case the Peter reported.

It also adds an additional test to check for that situation.

@dpvc dpvc requested a review from zorkow February 5, 2026 13:56
@dpvc dpvc added this to the v4.1.1 milestone Feb 5, 2026
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.51%. Comparing base (2cf7459) to head (574e1c3).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
ts/core/MmlTree/MmlNode.ts 86.66% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1428   +/-   ##
========================================
  Coverage    86.51%   86.51%           
========================================
  Files          340      340           
  Lines        86002    86032   +30     
  Branches      3186     3190    +4     
========================================
+ Hits         74406    74432   +26     
- Misses       11596    11600    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.
There is one more occurrence in MathtoolsUtil.ts that you could replace.

@dpvc
Copy link
Member Author

dpvc commented Feb 5, 2026

There is one more occurrence in MathtoolsUtil.ts that you could replace.

I had looked at that one, but didn't think it was necessary, but I've changed it, as I don't think it should hurt.

@dpvc dpvc merged commit 2bb30bb into develop Feb 5, 2026
1 check passed
@dpvc dpvc deleted the fix/empty-op branch February 5, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants