-
Notifications
You must be signed in to change notification settings - Fork 19
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
Make MathML attributes ASCII case-insensitive #178
Comments
I did a quick check and for the MathML-specific definitions, I only see case-insensitive against strings with ASCII letters and dashes. So the only difference would be for "LATIN SMALL LETTER LONG S", "KELVIN SIGN" and maybe a few "LATIN SMALL LIGATURE" (e.g. |
That's a good catch. I'm pretty sure we all agree that we only mean ASCII case-insensitivity. I suggest we add the following to the spec, which is a slight rewording from the HTML spec:
I suggest this goes into Appendix G.1: Document Conventions. |
I would prefer to be explicit everywhere and use "ASCII case-insensitive" with a link to https://infra.spec.whatwg.org/#ascii-case-insensitive ; this seems to be what the HTML and CSS specifications do (or how they would be fixed it e.g. w3c/csswg-drafts#4599 (comment)). I'm sure if we just keep case-insensitive as it is now, people will easily not read the appendix. We should also avoid duplicating definition from HTML5 as it was mentioned in another issue. |
Consensus from 2019/12/16: Move to ASCII case-insensitiveness |
The mathsize and dir attributes are defined modulo ASCII case-insensitive equivalence and are mapped to CSS font-size and direction properties [1] [2]. Since the CSS keywords are themselves defined modulo ASCII case-insensitive equivalence [3], there is not need to filter out other (Unicode) case-insensitive equivalent keywords (e.g. "ſmall") in the MathML Code, they will be rejected by the CSS parser. This CL replaces DeprecatedEqualIgnoringCase with EqualIgnoringASCIICase and adds tests to ensure that (Unicode) case-insensitive equivalent strings remain disallowed. [1] https://mathml-refresh.github.io/mathml-core/#global-attributes [2] w3c/mathml#178 [3] https://www.w3.org/TR/css-values-4/#keywords Bug: 6606 Bug: 627682 Change-Id: Ice84368c8cc7e8fff9faccb454c23fad87b99d59
These are the attributes, with the behavior changes that will require tests:
Other attributes rely on CSS ( https://mathml-refresh.github.io/mathml-core/#types-for-mathml-attribute-values ) so nothing is changed here (although tests can always be added). |
…20807) The mathsize and dir attributes are defined modulo ASCII case-insensitive equivalence and are mapped to CSS font-size and direction properties [1] [2]. Since the CSS keywords are themselves defined modulo ASCII case-insensitive equivalence [3], there is not need to filter out other (Unicode) case-insensitive equivalent keywords (e.g. "ſmall") in the MathML Code, they will be rejected by the CSS parser. This CL replaces DeprecatedEqualIgnoringCase with EqualIgnoringASCIICase and adds tests to ensure that (Unicode) case-insensitive equivalent strings remain disallowed. [1] https://mathml-refresh.github.io/mathml-core/#global-attributes [2] w3c/mathml#178 [3] https://www.w3.org/TR/css-values-4/#keywords Bug: 6606 Bug: 627682 Change-Id: Ice84368c8cc7e8fff9faccb454c23fad87b99d59
The mathsize and dir attributes are defined modulo ASCII case-insensitive equivalence and are mapped to CSS font-size and direction properties [1] [2]. Since the CSS keywords are themselves defined modulo ASCII case-insensitive equivalence [3], there is not need to filter out other (Unicode) case-insensitive equivalent keywords (e.g. "ſmall") in the MathML Code, they will be rejected by the CSS parser. This CL replaces DeprecatedEqualIgnoringCase with EqualIgnoringASCIICase and adds tests to ensure that (Unicode) case-insensitive equivalent strings remain disallowed. [1] https://mathml-refresh.github.io/mathml-core/#global-attributes [2] w3c/mathml#178 [3] https://www.w3.org/TR/css-values-4/#keywords Bug: 6606 Bug: 627682 Change-Id: Ice84368c8cc7e8fff9faccb454c23fad87b99d59 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1970615 Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Frédéric Wang <[email protected]> Cr-Commit-Position: refs/heads/master@{#725481}
If we want to keep the relax schema there are two choices either we could say in words that values should be ascii-lowercased before validation or we could make the schema do the case insensitive match. That would mean for example changing
to
which works but isn't very human readable or informative. Since we already need some pre-processing described in words to allow data-foo attributes (or onfoo attributes to be ignored, I'm tempted to suggest we keep the existing string match but could be persuaded otherwise.... |
I think this was already the case since #22 ; not sure how important it is for legacy XML applications. I wonder what is done for HTML5 ? |
On Tue, 17 Dec 2019 at 13:07, Frédéric Wang ***@***.***> wrote:
I think this was already the case since #22
<#22> ; not sure how
important it is for legacy XML applications. I wonder what is done for
HTML5 ?
The validator.nu html5 validator has a relaxng schema at its core but
heavily preprocesses the document with custom code before validating it, so
I think pre-processing is fine (and makes the schema a lot easier to read)
|
…to validate mathsize and dir, a=testonly Automatic update from web-platform-tests [mathml] Use ASCII case-insensitiveness to validate mathsize and dir (#20807) The mathsize and dir attributes are defined modulo ASCII case-insensitive equivalence and are mapped to CSS font-size and direction properties [1] [2]. Since the CSS keywords are themselves defined modulo ASCII case-insensitive equivalence [3], there is not need to filter out other (Unicode) case-insensitive equivalent keywords (e.g. "ſmall") in the MathML Code, they will be rejected by the CSS parser. This CL replaces DeprecatedEqualIgnoringCase with EqualIgnoringASCIICase and adds tests to ensure that (Unicode) case-insensitive equivalent strings remain disallowed. [1] https://mathml-refresh.github.io/mathml-core/#global-attributes [2] w3c/mathml#178 [3] https://www.w3.org/TR/css-values-4/#keywords Bug: 6606 Bug: 627682 Change-Id: Ice84368c8cc7e8fff9faccb454c23fad87b99d59 -- wpt-commits: 0cc6eb16b46a76070b11ce771e4026da2e328a6d wpt-pr: 20807
…to validate mathsize and dir, a=testonly Automatic update from web-platform-tests [mathml] Use ASCII case-insensitiveness to validate mathsize and dir (#20807) The mathsize and dir attributes are defined modulo ASCII case-insensitive equivalence and are mapped to CSS font-size and direction properties [1] [2]. Since the CSS keywords are themselves defined modulo ASCII case-insensitive equivalence [3], there is not need to filter out other (Unicode) case-insensitive equivalent keywords (e.g. "ſmall") in the MathML Code, they will be rejected by the CSS parser. This CL replaces DeprecatedEqualIgnoringCase with EqualIgnoringASCIICase and adds tests to ensure that (Unicode) case-insensitive equivalent strings remain disallowed. [1] https://mathml-refresh.github.io/mathml-core/#global-attributes [2] w3c/mathml#178 [3] https://www.w3.org/TR/css-values-4/#keywords Bug: 6606 Bug: 627682 Change-Id: Ice84368c8cc7e8fff9faccb454c23fad87b99d59 -- wpt-commits: 0cc6eb16b46a76070b11ce771e4026da2e328a6d wpt-pr: 20807
Could you, please, define this term, @fred-wang? I don't know which XML applications are legacy and which aren't. |
I believe I was talking about XML-based MathML3 implementations. |
Removing "tests" label, we have tests for mathsize and dir. It's not exhaustive, but HTML or CSS don't test exhaustively either... Also removing core label since the only remaining changes are in mathml full |
Adding back spec update label because MathML 4 spec needs to mention this. I'm not sure where. The only mention of case-insensitivity in the full spec is in "A.1 Validating MathML". Maybe we can add a sentence ("All attribute names are ASCII-case insensitive") in "2.1.5 MathML Attribute Values" after it says "Attribute names are shown in a monospaced font throughout this document." @davidcarlisle: suggestions? |
@NSoiffer you mean attribute values not attribute names I think? |
I dn't think it can be all values eg in xml ids are case sensitive, we have defined which means we should change instances of |
I was trying to understand the reference link: https://infra.spec.whatwg.org/#ascii-case-insensitive It apears to define "ASCII case-insensitive match". To me that reads as a more operational definition. I am not sure how that is used in the HTML spec text, but it ought to be doable to modify relevant MathML algorithms (e.g. matching an intent concept) to fit in, assuming we can find all of them. |
well it's both an operational definition but it also affects syntax. For MathML it mainly affects any boolean attribute plus some other enumerated lists such as so the ascii case insensitive change means that unlike MathML3
is valid, but also with the operational definition that it should be treated like
similarly But that doesn't mean all attributes should be lowercased,. anything with text or a URL for example can not be. It really just applies to attributes that take a fixed enumerated list of values. |
Sorry, yes I meant values -- it was late at night... In https://w3c.github.io/mathml/#fund_attval, we define what the syntax is for attribute values. One of the values is "string" which currently says
We could add something like "With the exception of That assumes that we want this for all non-intent string values. If not, then I think every instance needs to say whether it is ASCII-case insensitive or not. A bit ugly, but that is what core does. |
IDs are also attributes that are not to be considered case-insensitive. |
A general proclamation that all matches are case-insensitive sounds dangerous to me. The HTML spec mentions each case where that rule applies, examples:
There are at least 140 references to ASCII case-insensitive match in the HTML spec. It is likely a bit painful, but I suggest we identify which algorithms in the MathML Full text permit this treatment and specify per-algorithm. Without a globally applicable rule. |
@NSoiffer I think it needs to be per type so basically: lengths, colors, mathml-boolean and mathvariants. id, alttext, etc can't be case insensitive and |
I was being hopeful that we didn't need to say it everywhere, but I'm convinced we do. That's a chunk of work, but maybe there is an emacs-macro someone has already written to do it :-) |
I don't think we need to say this in so many places, just in the definition of the types such as boolean and length-percentage, we already specify the type of all attributes |
We don't (currently) have a type "boolean", at least not in the main text. Types are defined here. I only see it defined for the schema. Take a look at the table attributes: there are a lot that take on string values and it seems that every one of them needs to say they are ASCII-case insensitive. Most elements don't have that many attributes, but most elements do have attribute values that take on string values that should be ASCII-case insensitive. Am I misunderstanding which should be ASCII-case insensitive? |
This is a follow-up of #22 ; we decided to follow HTML/CSS which treat things as ASCII case-insensitive. Concretely, ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt has this line:
which means that
falſe
is case-insensitively equal tofalse
. However, it is not ASCII case-insensitively equal tofalse
(only a-z <-> A-Z equivalence are considered in that case).Currently, the MathML Core spec just says "case-insensitive".
Note: for CSS colors, I reported w3c/csswg-drafts#4599
The text was updated successfully, but these errors were encountered: