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

Add more global attributes from HTML #118

Closed
fred-wang opened this issue Jul 11, 2019 · 12 comments
Closed

Add more global attributes from HTML #118

fred-wang opened this issue Jul 11, 2019 · 12 comments
Labels
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

The global attributes are defined here:
https://mathml-refresh.github.io/mathml-core/#global-attributes

Some of them are taken from HTML:
https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements

After discussions in w3c/mathml-core#129, we agreed that we want to add some IDL for all MathML elements:
https://mathml-refresh.github.io/mathml-core/#dom-and-javascript

(1) GlobalEventHandlers, DocumentAndElementEventHandlers would mean adding all the onsomething event attributes:
https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
https://html.spec.whatwg.org/multipage/webappapis.html#documentandelementeventhandlers
Rob mentioned that SVG has something to avoid to explicitly mention them:
https://svgwg.org/svg2-draft/interact.html#EventAttributes

(Side comment: do we really want to keep the non-normative https://mathml-refresh.github.io/mathml-core/#relaxng ? Now that we are relying a lot on HTML and CSS definitions (in particular for attribute values) instead of having a standalone document, it seems a bit tedious to keep things in sync. Maybe the RelaxNG schema should be moved in a different repository?)

(2) HTMLOrSVGElement would add this:
https://html.spec.whatwg.org/multipage/dom.html#htmlorsvgelement

'data-' attributes:
https://html.spec.whatwg.org/multipage/dom.html#attr-data-

nonce attribute:
https://html.spec.whatwg.org/multipage/urls-and-fetching.html#nonce-attributes

tabIndex attribute:
https://html.spec.whatwg.org/multipage/interaction.html#attr-tabindex

(3) ElementCSSInlineStyle has a style attribute
https://www.w3.org/TR/cssom-1/#elementcssinlinestyle
which is already here:
https://mathml-refresh.github.io/mathml-core/#style
so nothing to add.

In several places, the HTML spec mentions that IDL attributes reflect content attributes:
https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflect
Maybe we need to mention that too.

@fred-wang fred-wang added MathML Core Issues affecting the MathML Core specification need tests Issues related to writing WPT tests need resolution Issues needing resolution at MathML Refresh CG meeting need specification update Issues requiring specification changes need polyfill Issues requiring implementation changes need implementation update labels Jul 11, 2019
fred-wang added a commit to w3c/mathml-core that referenced this issue Jul 11, 2019
@bkardell
Copy link
Collaborator

Hmm, somehow until now I didn't catch that math elements can have an href. would it have to link to/specify/mixin idl like https://html.spec.whatwg.org/#api-for-a-and-area-elements ?

Which annotation attributes from https://html.spec.whatwg.org/#linkTypes does it support (I assume the same as a/area?) and that then all of the things about building requests/CORs etc are exactly the same too?

This seems kind of considerably underspecified, do you know how those that support linking (Safari definitely does) handles those questions?

@bkardell
Copy link
Collaborator

ahh, I assume all of the 'location' things in CSS would treat this like links too? Basically all of these:

https://www.w3.org/TR/selectors-4/#location

@fred-wang
Copy link
Author

ahh, I assume all of the 'location' things in CSS would treat this like links too? Basically all of these:

https://www.w3.org/TR/selectors-4/#location

Yes, I think so. The spec actually has such a selector in the UA stylesheet https://mathml-refresh.github.io/mathml-core/#dfn-href

@fred-wang
Copy link
Author

Hmm, somehow until now I didn't catch that math elements can have an href. would it have to link to/specify/mixin idl like https://html.spec.whatwg.org/#api-for-a-and-area-elements ?

That seems sensible to me. IIRC, the MathML href implementations in Gecko/WebKit/Chromium basically rely on or copy what is done for the a element, so I expect they would behave the same.

(BTW, as a side comment MathML 2 used to rely on xlink for hyperlinks. I think SVG does it too)

@NSoiffer
Copy link
Contributor

The UA Style sheet in the spec uses

:any-link {
  color: blue;
  text-decoration: none;
}

While I understand what is desired, isn't that too broad as it affects all links, not just those in MathML?

FYI: href was added in MathML 3 because XML and its linking doesn't really fly in HTML. It was added to all elements because we thought people might want to link out to a definition of some component. I think it is useful mainly on the math element and on the leaf elements, at least in terms of linking out to definitions. I'm sure that others can find cases where an mrow or msup or whatever is a better point for adding a definition link though. You can still add xml:xlink to any element if you are in an XML context.

@fred-wang
Copy link
Author

The UA Style sheet in the spec uses

:any-link {
  color: blue;
  text-decoration: none;
}

While I understand what is desired, isn't that too broad as it affects all links, not just those in MathML?

The complete stylesheet is https://mathml-refresh.github.io/mathml-core/#user-agent-stylesheet

And this rule forces all rules to apply only to element in the MathML namespace:

@namespace url(http://www.w3.org/1998/Math/MathML);

@ExE-Boss
Copy link

ExE-Boss commented Aug 26, 2019

Well, MathML doesn’t currently support event handler attributes at all, and I’d like it to stay that way, as event handler attributes are mothballed in favour of addEventListener, which is currently the only way to add event listeners to MathML elements.


TL;DR: I object to adding on<something> event handler attributes to MathML elements, since they’ve never been supported for them in the past.

@bkardell
Copy link
Collaborator

bkardell commented Sep 8, 2019

@ExE-Boss it seems very strange for mathml to be special in this regard. The default position should be, in my mind, that working like everything else should be the default goal and that being special should be only if we can give a really good justification for why it has to be, no? Is there some very strong argument as to why it should continue to be different really?

@ExE-Boss
Copy link

ExE-Boss commented Sep 9, 2019

Because event handler attributes are deprecated, and a legacy mistake, IMO.

@bkardell
Copy link
Collaborator

bkardell commented Sep 9, 2019

They aren't deprecated. They have even expanded in the not distant past whatwg/html@940a2d4

@bkardell bkardell closed this as completed Sep 9, 2019
@bkardell bkardell reopened this Sep 9, 2019
@fred-wang
Copy link
Author

I think @davidcarlisle raised the issue during one meeting. The conclusion was that as long as HTML supports them, it is not a big extra code to support this for MathML and as Brian said it makes things more consistent with SVG/HTML. Also, it's sometimes more convenient (e.g. for quick testing) to use on[event] attribute than to register events via addEventListener. I believe people still use onload a lot for example.

@fred-wang
Copy link
Author

Remaining work was done by

w3c/mathml-core@c2d770c

and we have several tests for that. So I think we can close this.

@fred-wang fred-wang added MathML 4 Issues affecting the MathML 4 specification need specification update Issues requiring specification changes and removed need resolution Issues needing resolution at MathML Refresh CG meeting need specification update Issues requiring specification changes need tests Issues related to writing WPT tests labels Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

4 participants