RE: MathML and "Clipboard API and events"

As to the lack of a MathML clipboard data type, I worry that this will make the copy ambiguous. We already see that in some desktop apps where some kind of Paste Special is needed.

Speaking of Paste Special, I didn't see that mentioned. It would be really nice to be able to easily implement special kinds of paste in web apps. I am sure there are many, many use cases for Paste Special but for math it might be used to paste alternative forms of the math, such as LaTeX, ASCII math, or literal MathML code (useful when documenting MathML itself). Perhaps it could also provide conversions to computational forms, such as a spreadsheet formulae. Of course, I am not sure this clipboard spec prevents any of this or even plays a role in it.

Surely such sanitization would be easy to specify and implement. It would not bother me if all mactions were removed in the MathML to be copied. That may be too drastic though. I would assume that the HTML sanitization folks have guidelines as to what kinds of things need to be removed. With such guidelines in hand, I doubt that the MathML community would have much trouble specifying the necessary filter for MathML.

Paul

> -----Original Message-----
> From: Paul Libbrecht [mailto:paul@hoplahup.net]
> Sent: Friday, April 12, 2013 1:19 PM
> To: Paul Topping
> Cc: public-webapps@w3.org
> Subject: Re: MathML and "Clipboard API and events"
> 
> Hey Paul,
> 
> nice to hear you raise this!
> 
> I fully agree it should be possible for some JS code such as MathJax to copy
> MathML to clipboard.
> The reason it is not listed as a mandatory data type, I believe, is that I, at
> least, have been unable to demonstrate the zero risk of doing so.
> I believe I have tried, although this spec has been running since quite long
> and things maybe have been changed.
> 
> Putting html in the clipboard is a requirement and there's a subtle and
> unspecified (yet) way of "sanitizing" the fragments so that it does not
> represent a risk when inserted in another context. Recent discussions have
> emerged about this. All of the browsers which implement html-copying have
> their own implementation.
> 
> Doing the same for MathML, e.g. removing maction, or, at least, any html-
> sensitive things should be needed. I do not know it is done.
> 
> Halvord Steen, the editor of this spec, and others might correct me but I
> interpret that this is the reason it is not in the required types.
> 
> I would be happy if we can formulate such a thing in a convincing way.
> 
> Paul
> 
> 
> 
> 
> > 10. Mandatory data types
> >
> > I am surprised not to see a MathML type in this list. I suppose MathML
> could be typed as application/xml but SVG gets its own image/svg+xml type
> so I would expect MathML to be treated in an analogous manner. I will admit
> to not knowing the ramifications of this.
> >
> > I also want to mention MathJax (www.mathjax.org). MathJax is an open
> source JavaScript engine for rendering MathML and LaTeX in browsers. It
> could be looked at as a polyfill for the current lack of good browser support
> for MathML. However, it also has its own UI and processes LaTeX so it will
> definitely have a place even after browsers routinely render MathML.
> >
> > I mention MathJax here as it is a good use case for the clipboard API. It
> transforms MathML or LaTeX in the web page to a chunk of renderable
> HTML, CSS, SVG, or even MathML if the browser supports it natively. The
> user would like to be able to select, cut, copy, and paste a mathematical
> expression rendered this way as if it was a single object. It sounds like
> MathJax should be able to do this using this clipboard API, though it does not
> address the selection aspect. Taking this a step further, someday we might
> hope to allow the user to select sub-expressions of a mathematical equation
> for the purpose of cut and copy.
> >
> > Paul Topping
> > Design Science, Inc.

Received on Friday, 12 April 2013 20:30:18 UTC