Last Comment Bug 544036 - (maction) Improve/Complete implementation of maction
: Improve/Complete implementation of maction
Status: NEW
: helpwanted, meta
Product: Core
Classification: Components
Component: MathML (show other bugs)
: Trunk
: All All
P5 normal with 3 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Anthony Jones (:kentuckyfriedtakahe, :k17e)
Depends on: 433774 544001 398505 523037 523045 657279 678708 706406 maction-statusline dynamic-maction-math maction-selection 745535 748779 749044
Blocks: mathml-2 mathml-in-mathjax 755525
  Show dependency treegraph
Reported: 2010-02-03 10:24 PST by Frédéric Wang (:fredw)
Modified: 2012-12-01 13:31 PST (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Frédéric Wang (:fredw) 2010-02-03 10:24:06 PST
This is a meta-bug to track the issues for <maction/>.

MathML suggests actions toggle, statusline, tooltip and input. According to the  source code, work is done for actions toggle, statusline and an extra action "restyle".
Comment 1 User image Frédéric Wang (:fredw) 2011-04-22 03:48:40 PDT
More thoughts on maction... First, here are the places where it is used in our MathML demo pages:

fred@debian:~/mozilla$ find mathml -name *html | xargs grep actiontype
mathml/start-thai.xhtml:maction[actiontype="restyle#background"] {
mathml/start-thai.xhtml:maction[actiontype="restyle#zoom"] {
mathml/start-thai.xhtml:<maction actiontype="restyle#zoom">
mathml/start-hebrew.xhtml:maction[actiontype="restyle#background"] {
mathml/start-hebrew.xhtml:maction[actiontype="restyle#zoom"] {
mathml/start-hebrew.xhtml:<maction actiontype="restyle#zoom">
mathml/start.xhtml:maction[actiontype="restyle#background"] {
mathml/start.xhtml:maction[actiontype="restyle#zoom"] {
mathml/start.xhtml:<maction actiontype="restyle#zoom">
mathml/demo/basics.xhtml:                <maction id="a11" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a12" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a13" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a21" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a22" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a23" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a31" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a32" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a33" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a41" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a42" actiontype="toggle" selection="2">
mathml/demo/basics.xhtml:                <maction id="a43" actiontype="toggle" selection="2">

The "restyle" actiontype is used on the start pages. It is a nonstandard attribute and I'm not sure it is really used on the Web (and it is even not documented in our pages). Its implementation is not really clean (see bug 398505) and confusing for the users, since it is contrary to the usual CSS/DOM rules. I suggest to remove it. Here is how it works:

The user defines a CSS rule:

maction[actiontype="restyle#zoom"] {
  font-size: 40pt;

and sets the corresponding attribute value on a maction element:

<maction actiontype="restyle#zoom">...</maction>

At this point, one would expect the maction to be styled with "font-size: 40pt;". However, the actiontype attribute is removed from the DOM tree in nsMathMLmactionFrame.cpp and it's only when we click on the maction element that this attribute is set back and the style applied. If we click on the maction again, the actiontype attribute is removed, and we come back to the initial style.
The "toggle" actiontype is also used in our demos. Bugs have been reported in the past, so I guess it has been used by some people. The idea is to have

<maction actiontype="toggle" selection="i">
  child0 child1 ... child(N-1)

At the beginning the (i-1)-th child is selected and each time one clicks on the maction element, the next child is selected (modulo N).
The "statusline" actiontype works like this:

<maction actiontype="statusline#message">

when the mouse passes over the maction element, the message is displayed in the statusline. Note however that our implementation is not the one recommended in the MathML REC (the message should be a <mtext> given as the second child of the maction). Hence, we should probably modify this to follow the REC.
The "tooltip" actiontype is not implemented. This feature has been asked in bug 544001 and I believe on the MathML mailing list too. Also, I've seen recently someone asking how to do a tooltip on the MathJax mailing list. The behavior is similar to "statusline", except that the message is displayed as a tooltip.
I think we should implement it, probably using the work of the "title" attribute.
Comment 2 User image Karl Tomlinson (:karlt) 2011-04-24 21:48:45 PDT
(In reply to comment #1)
> It is a nonstandard
> attribute and I'm not sure it is really used on the Web (and it is even not
> documented in our pages). Its implementation is not really clean (see bug
> 398505) and confusing for the users, since it is contrary to the usual CSS/DOM
> rules. I suggest to remove it.

I suspect many maction use cases could be implemented with javascript, and so are not necessary in a web browser situation.

I guess there's an argument for MathML situations with no script, and so we should support actiontypes required by the rec.  For nonstandard actiontypes, this argument does not apply and so there is no good reason to implement (or continue to support) them.
Comment 3 User image Frédéric Wang (:fredw) 2012-02-23 06:47:16 PST
If I understand the spec correctly, the "selection" attribute only applies to the toggle actiontype. So it seems to me that in all other cases,


should return 1.

Note You need to log in before you can comment on or make changes to this bug.