Skip to content

Update safe extension to remove event listeners in MathML input - #1548

Merged
dpvc merged 2 commits into
developfrom
fix/safe-listeners
Aug 13, 2026
Merged

Update safe extension to remove event listeners in MathML input#1548
dpvc merged 2 commits into
developfrom
fix/safe-listeners

Conversation

@dpvc

@dpvc dpvc commented Aug 9, 2026

Copy link
Copy Markdown
Member

This PR adds support for filtering out event listeners like onclick from MathML input. By default these are now filtered out. This behavior is controlled by on* entry in the filterAttributes map. One could use

MathJax = {
  loader: {load: ['ui/safe']},
  startup: {
    ready() {
      MathJax.startup.defaultReady();
      MathJax.startup.document.safe.filterAttributes.delete('on*');
    }
  }
}

to remove this filter. There is no configuration parameter for this, as there are completely unsafe, so removing this filter should be hard to do.

The PR also fixes the alignment of @returns jsDoc declarations.

@dpvc
dpvc requested a review from zorkow August 9, 2026 12:25
@dpvc dpvc added this to the v4.2 milestone Aug 9, 2026
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.92%. Comparing base (6c2be35) to head (7f3916c).
⚠️ Report is 21 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1548      +/-   ##
===========================================
- Coverage    86.92%   86.92%   -0.01%     
===========================================
  Files          390      390              
  Lines        87853    87857       +4     
  Branches      4984     4983       -1     
===========================================
- Hits         76370    76368       -2     
- Misses       11464    11470       +6     
  Partials        19       19              

☔ View full report in Codecov by Harness.
📢 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.

@zorkow zorkow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm.
One typo, but I might be wrong.

Comment thread ts/ui/safe/SafeMethods.ts Outdated
Co-authored-by: Volker Sorge <v.sorge@mathjax.org>
@dpvc
dpvc merged commit 5826d38 into develop Aug 13, 2026
1 check passed
@dpvc
dpvc deleted the fix/safe-listeners branch August 13, 2026 12:44
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