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

Definition of MathML Length #63

Closed
fred-wang opened this issue Feb 28, 2019 · 18 comments
Closed

Definition of MathML Length #63

fred-wang opened this issue Feb 28, 2019 · 18 comments
Labels
compatibility Issues affecting backward compatibility css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification MathML 4 Issues affecting the MathML 4 specification need polyfill Issues requiring implementation changes need specification update Issues requiring specification changes

Comments

@fred-wang
Copy link

fred-wang commented Feb 28, 2019

I think it's not nice that we have a definition of MathML Length different from CSS, but I guess we cannot really solve this.

The RelaxNG pattern is pattern = '\s*((-?[0-9]([0-9].?|.[0-9])[0-9](e[mx]|in|cm|mm|p[xtc]|%)?)|(negative)?((very){0,2}thi(n|ck)|medium)mathspace)\s*'

The definition is https://mathml-refresh.github.io/mathml/chapter2.html#fund.units

Note that "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. ". I think we should be more explicit about white spaces...

My proposal is to:

Then this definition should go into MathML Core.

Update: Some people proposed to actually removed namedspace values too #75 which would make things even closer to HTML/CSS lengths.

@fred-wang fred-wang added MathML Core Issues affecting the MathML Core specification MathML 4 Issues affecting the MathML 4 specification css / html5 Issues related to CSS or HTML5 interoperability need tests Issues related to writing WPT tests labels Feb 28, 2019
@davidcarlisle
Copy link
Collaborator

@fred-wang I added a placeholder section to the core draft, feel free to edit, I sketched out dropping all support for mathml-specific length syntax from core, including named lengths. that may be too aggressive or controversial, I also added markup to allow links back to this issue tracker.

fred-wang added a commit to w3c/mathml-core that referenced this issue Mar 14, 2019
Agreed on https://lists.w3.org/Archives/Public/public-mathml4/2019Mar/0007.html
"General agreement that all named lengths and unitless precents (#24, #4, #7), should be removed from the core"

Still need to be more explicit about the MathML lengths w3c/mathml#63
@dani31415
Copy link

CSS currently have 3 levels

If a match between MathML and HTML5 has to be done, a level from the above list has also to be chosen.

@fred-wang
Copy link
Author

If a match between MathML and HTML5 has to be done, a level from the above list has also to be chosen.

Yes, I guess we should use whatever is used in browsers... Using definitions in WHATWG's HTML5 could probably avoid the version number issues.

@fred-wang
Copy link
Author

@fred-wang I added a placeholder section to the core draft, feel free to edit, I sketched out dropping all support for mathml-specific length syntax from core, including named lengths. that may be too aggressive or controversial, I also added markup to allow links back to this issue tracker.

I opened #75 for the namedspace discussion.

@fred-wang fred-wang added the compatibility Issues affecting backward compatibility label Mar 20, 2019
@physikerwelt
Copy link
Member

can we also get rid of the string constants

(negative)?((very){0,2}thi(n|ck)|medium)mathspace)

@fred-wang
Copy link
Author

can we also get rid of the string constants

(negative)?((very){0,2}thi(n|ck)|medium)mathspace)

That's #75

@NSoiffer
Copy link
Contributor

On 29/4/19 call, agreed to drop unitless values except 0 from core.
The call agreed that the handling of whitespace in attribute values should follow whatever CSS does.

The full spec will continue to allow namedspaces.

@fred-wang fred-wang reopened this May 2, 2019
@fred-wang
Copy link
Author

cc @rwlbuis @bkardell

@rwlbuis
Copy link

rwlbuis commented May 2, 2019

I am doing an experiment to support MathML lengths using CSS subsystem in chromium, same as SVG does for its attributes. Findings:

  • CSS has slightly different parsing rules for numbers, after the decimal dot at least one number should be present, i.e. 7.em would not be accepted. HTML has the same restriction.

  • modern CSS has new units, quarter-millimeter (https://www.w3.org/TR/css-values-4/#absolute-lengths) and various viewport units (https://www.w3.org/TR/css-values-4/#viewport-relative-lengths). Right now in my experiment I disable support for that.

  • while not enabled in my experiment, it would be trivial to start parsing calc(). But AFAIK SVG does not do that, so maybe so shouldn't we?

@rwlbuis
Copy link

rwlbuis commented May 2, 2019

Another interesting point is whether to support exponents or not.
For SVG 1.1 it is supported for attributes but not in stylesheets:
https://www.w3.org/TR/SVG11/types.html#DataTypeLength

For SVG 2 it just refers to CSS, so will support exponents:
https://svgwg.org/svg2-draft/geometry.html#Y (length-percentage link)

@NSoiffer
Copy link
Contributor

NSoiffer commented May 3, 2019 via email

@fred-wang
Copy link
Author

* while not enabled in my experiment, it would be trivial to start parsing calc(). But AFAIK SVG does not do that, so maybe so shouldn't we?

@rwlbuis What about CSS variables? ( https://drafts.csswg.org/css-variables/ )

I'm wondering whether we can do things like:

mfrac {
  --thin: 50%;
  --medium: 100%;
  --thick: 200%;
}

<mfrac linethickness="var(--thin)">

or even

math {
  --thickmathspace: 4em;
  --thinmathspace: .5em;
}

<mspace width="var(--thickmathspace)" height="calc(var(--thickmathspace) - 2 * var(--thinmathspace) + 1px)"></mspace>

which would give users the possibility to do things removed elsewhere ( #75 #5 #4 ...).

@rwlbuis
Copy link

rwlbuis commented May 7, 2019

@rwlbuis What about CSS variables? ( https://drafts.csswg.org/css-variables/ )

That is a great find, I forgot about them. I verified that in chromium CSS variables works in the SVG-in-HTML case, so it seems the way to go, but we may want to check with the SVG WG.

@NSoiffer
Copy link
Contributor

Interesting!

First off, caniuse says that this is implemented in all the major modern browsers. So it seems safe to use.

Does this really allow us to keep named quantity such as mediumspace and thick in the spec, or just provide an easy target for polyfills? It seems they would need to have the -- prefix, but maybe that is something that is easy for a browser implementation to do?

@bkardell
Copy link
Collaborator

Not sure I'm following so feel free to ignore if I've misunderstood but

-- is supposed to be reserved for author space afaik there's no precedent for browsers setting variables in this particular way (note: should look up recentish discussions about environment properties as the discussion is probably relevant and I could be wrong).. but.. CSS has always had this mechanism for non standard extension of all of it's 'parts' ( properties, pseudoclasses, fns, etc) so that the parser can stay forward compatible. The pattern has always been dash, vendor prefix, dash - like -moz-blah. Custom anything in CSS will follow this same pattern, it's just that there is no vendor prefix, so you get -- meaning author defined rather than vendor defined.

That said, variables in CSS are actually custom properties - and that's a thing vendors have been doing, as I say, forever.

otherwise they are just vendor prefixed things without a vendor (ie -moz-blah becomes -- because there is no vendor).

@fred-wang fred-wang added the need resolution Issues needing resolution at MathML Refresh CG meeting label May 16, 2019
@fred-wang
Copy link
Author

Resolution:

@fred-wang fred-wang added need implementation update and removed need resolution Issues needing resolution at MathML Refresh CG meeting labels May 16, 2019
@fred-wang fred-wang added need polyfill Issues requiring implementation changes need specification update Issues requiring specification changes labels May 16, 2019
@fred-wang
Copy link
Author

The core spec now refers to from CSS.

@fred-wang fred-wang removed the need specification update Issues requiring specification changes label Jun 5, 2019
@fred-wang fred-wang removed the need tests Issues related to writing WPT tests label Sep 16, 2019
@fred-wang
Copy link
Author

There are tests for that, so closing.

@fred-wang fred-wang added the need specification update Issues requiring specification changes label Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Issues affecting backward compatibility css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification MathML 4 Issues affecting the MathML 4 specification need polyfill Issues requiring implementation changes need specification update Issues requiring specification changes
Projects
None yet
Development

No branches or pull requests

7 participants