# [Math Processing Error] with framespacing #367

Closed
opened this issue Dec 21, 2012 · 14 comments

Projects
None yet
3 participants
Contributor

### fred-wang commented Dec 21, 2012

 The following code  text [/itex]  generates a [Math Processing Error] error: "m.toFixed is not a function" file: "http://cdn.mathjax.org/mathjax/latest/unpacked/jax/output/HTML-CSS/jax.js" line: 810 I assume the leading space in the framespacing attribute value is not trimmed.
Contributor Author

### fred-wang commented Dec 24, 2012

 The syntax of framespacing is given in chapter 3 by "length, length" where the comma means "one instance of each form fi, in sequence, with separating whitespace characters (but no commas)" In autoload/mtable.js, framespacing is parsed that way: values.framespacing.split(/[, ]+/)[0] values.framespacing.split(/[, ]+/)[0] that seems to split the framespacing by either a space or a comma (or a repetition of these characters). There are two issues here: the leading/trailing whitespaces are not trimmed. only actual space can be used, not general whitespaces. Also, comma should not be accepted here. The REC suggests "Since some applications are inconsistent about normalization of whitespace, for maximum interoperability it is advisable to use only a single whitespace character for separating parts of a value. Moreover, leading and trailing whitespace in attribute values should be avoided." but the most general syntax is still allowed (in particular by the RelaxNG schema), though. I have proposed a fix on my issue367 branch: https://github.com/fred-wang/MathJax/compare/master...issue367

### ghost assigned fred-wangDec 24, 2012

Contributor Author

### fred-wang commented Jan 5, 2013

 Crashtests/issue367.html => In testsuite
Member

### dpvc commented Mar 20, 2013

 I see you have used the String trim() method. Unfortunately, it is not available in some supported browsers (e.g., IE < 9). So I think it would be better to replace trim() by our own copy. It could call the built-in if available, otherwise do the replace by hand. I suppose the check could be made only once by making the definition of the method being dependent on the availability of String.prototype.trim.
Contributor Author

Member

### pkra commented Mar 22, 2013

 Do we know how other frameworks handle the trim problem (e.g. jquery)?
Contributor Author

### fred-wang commented Mar 25, 2013

 OK, I've rewritten the changes in a separate branch. I've also fix a potential math processing error with invalid framespacing attribute. I'll also update the crashtest to include this case.

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 1, 2013

 Merge remote-tracking branch 'fred/issue367-bis' into develop 
Resolves issues mathjax#367.
 ffb9b53 
Member

### dpvc commented Apr 1, 2013

 Thanks. I've merged the issue367-bis branch into develop.