Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new SVG() crashing #3128

Open
pkra opened this issue Nov 10, 2023 · 1 comment
Open

new SVG() crashing #3128

pkra opened this issue Nov 10, 2023 · 1 comment
Labels
Accepted Issue has been reproduced by MathJax team Merged Merged into develop branch Test Needed v3
Milestone

Comments

@pkra
Copy link
Contributor

pkra commented Nov 10, 2023

Just a random note in case you consider it relevant

While

import { SVG } from 'mathjax-full/js/output/svg.js';
const svg = new SVG({});

is ok, this

import { SVG } from 'mathjax-full/js/output/svg.js';
const svg = new SVG();

throws for me (4-beta4) with

[snip]node_modules/mathjax-full/mjs/output/common.js:17
        const [fontClass, font] = (options.fontData instanceof FontData ?
                                           ^

TypeError: Cannot read properties of null (reading 'fontData')
    at new CommonOutputJax ([snip]node_modules/mathjax-full/mjs/output/common.js:17:44)
    at new SVG ([snip]node_modules/mathjax-full/mjs/output/svg.js:15:9)
    at [snip]mjtest.js:2:13
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
    at async loadESM (node:internal/process/esm_loader:40:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.5.1
@dpvc dpvc transferred this issue from mathjax/MathJax-src Nov 11, 2023
@dpvc
Copy link
Member

dpvc commented Nov 11, 2023

Thanks for the pointer. It is due to an incorrect default value in the SVG class constructor (and in the underlying common output jax constructor). It is an easy fix, and I'll make a PR for it.

@dpvc dpvc added Ready for Development Accepted Issue has been reproduced by MathJax team v3 labels Nov 11, 2023
@dpvc dpvc added this to the v4.0 milestone Nov 11, 2023
dpvc added a commit to mathjax/MathJax-src that referenced this issue Nov 11, 2023
dpvc added a commit to mathjax/MathJax-src that referenced this issue Nov 20, 2023
@dpvc dpvc added Merged Merged into develop branch and removed Ready for Review labels Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Merged Merged into develop branch Test Needed v3
Projects
None yet
Development

No branches or pull requests

2 participants