Hi all! On Tue, Apr 09, 2024 at 08:46:46AM +0100, Julian Gilbey wrote: > Package: node-mathjax-full > Version: 3.2.2+~cs4.2.1-2 > Severity: normal > > I invoked MathJax using the line: > > <script type="text/javascript" > src="file:///usr/share/nodejs/mathjax-full/es5/tex-mml-chtml.js"></script> > > in the header of a file, but MathJax would not load; the console gave > the error message: > > MathJax(?): class constructors must be invoked with 'new' > > referring to tex-mml-chtml.js:1:18018
It looks like the problem comes from this JS code (produced by TypeScript
compiler):
var info_js_1 = require("mj-context-menu/js/info.js");
var html_classes_js_1 = require("mj-context-menu/js/html_classes.js");
var SelectableInfo = (function (_super) {
__extends(SelectableInfo, _super);
function SelectableInfo() {
return _super !== null && _super.apply(this, arguments) || this;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
...
return SelectableInfo;
}(info_js_1.Info));
This code can be seen in js/ui/menu/SelectableInfo.js in the build tree or in
/usr/share/nodejs/mathjax-full/js/ui/menu/SelectableInfo.js.
Here, _super is the (constructor of) parent class, Info.
Maybe the problem is that node-mj-context-menu is compiled for ES 6, so it
uses the native ES 6 classes.
/usr/share/nodejs/mj-context-menu/js/info.js has this definition:
export class Info extends AbstractPostable {
constructor(title, content, signature) {
super();
...
}
}
But we are building MathJax for ES 5, so the TypeScript compiler is trying to
generate functions instead of classes.
https://caniuse.com/es6 says ES 6 is available for >98% of users, so perhaps
we can just build for ES 6?
Although, I am not sure about my hypothesis, so I need an advice from someone
with more JS experience.
--
Dmitry Shachnev
signature.asc
Description: PGP signature
-- Pkg-javascript-devel mailing list Pkg-javascript-devel@alioth-lists.debian.net https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel
