Re: W3C Validator with HTML in <math>

Deyan,

At some point, I dropped a quote in editing or copy/pasting. Thanks for the
correction.

I started to write up a validator issue, but I was surprised that I
couldn't find anything in the core spec that says where it is legal to
embed HTML. It should be in this section:
https://w3c.github.io/mathml-core/#integration-in-the-web-platform, but
there is only an example (and no text) that uses mtext. Did I miss the
reference?

The MathML 4 draft mentions it here:
https://w3c.github.io/mathml/#presm_html_insertion. Seems like these should
be aligned.

    Neil


On Thu, Apr 10, 2025 at 1:50 AM Deyan Ginev <deyan.ginev@gmail.com> wrote:

> Hi Neil,
>
> The following validates for me. Note that your snippet had other unrelated
> syntax issues, maybe you were seeing some of them in the report.
> Based on the link in my previous email, I think it's an easy change to the
> schema(s) used by the validator to allow HTML phrasing content in more
> places.
>
> I suggest looping in the validator maintainer (maybe a github issue if we
> have no direct contact?)
>
> <!DOCTYPE html>
> <html lang="en">
> <head>
>   <meta charset="UTF-8">
>   <title>Input element in MathML</title></head>
> <body>
>   <math display='block'>
>     <mtext><input type="text" size="2" id="answer" name="answer"></mtext>
>   </math>
> </body>
> </html>
>
> On Thu, Apr 10, 2025 at 12:51 AM Neil Soiffer <soiffer@alum.mit.edu>
> wrote:
>
>> The comments are about only allowing for mtext, but when I used mtext,
>> the validator failed it in the same way. I don't think the comments reflect
>> the reality of either MathML or what is implemented.
>>
>>     Neil
>>
>>
>> On Wed, Apr 9, 2025 at 7:08 PM Deyan Ginev <deyan.ginev@gmail.com> wrote:
>>
>>> Hi Neil,
>>>
>>> If I'm scanning their code correctly, there is a 2010 rationale for that
>>> decision:
>>>
>>> https://github.com/validator/validator/blob/6138b0facb22bcbe28ee86d716f340cd7fb1e723/schema/.drivers/xhtml5-svg-mathml.rnc#L35-L38
>>>
>>> Rationale at:
>>> http://www.w3.org/Bugs/Public/show_bug.cgi?id=9859#c8
>>>
>>> Likely the validator maintainer needs to be convinced the situation is
>>> changed in 2025 - which may be easier with MathML Core in CR.
>>>
>>> Greetings,
>>> Deyan
>>>
>>>
>>> On Tue, Apr 8, 2025 at 6:37 PM Neil Soiffer <soiffer@alum.mit.edu>
>>> wrote:
>>>
>>>> Someone told me that the W3C validator refused to accept <input>
>>>> inside of leaf elements. I tried it with both <mi> and <mtext> -- the
>>>> example below uses <mi>. The page seemed to work fine in Chrome and Firefox.
>>>>
>>>> Did I do something wrong? If not, is there anything we can do to get
>>>> the validator fixed?
>>>>
>>>>      Neil
>>>>
>>>>
>>>> ==================
>>>>
>>>> <!DOCTYPE html>
>>>> <html lang="en">
>>>> <head>
>>>> <meta charset="UTF-8">
>>>> <title>Input element in MathML</title>
>>>> <script type="module">
>>>> import { _MathTransforms } from '
>>>> https://github.com/w3c/mathml-polyfills/common/math-transforms.js'
>>>> import 'https://github.com/w3c/mathml-polyfills/menclose.js'
>>>> document.head.appendChild ( _MathTransforms.getCSSStyleSheet() );
>>>>
>>>> window.addEventListener("DOMContentLoaded", () => {
>>>>  _MathTransforms.transform(document.body)
>>>> })
>>>> </script>
>>>> </head>
>>>>
>>>> <body>
>>>> <h1>Input Field in MathML</h1>
>>>> <p>Adding the 'input' element breaks parsing in the W3C validator</p>
>>>> <math display='block'>
>>>>  <mrow>
>>>>   <mn>3</mn><mo>+</mo><mn>4</mn><mo>=</mo>
>>>>   <menclose notation="box"><mi><input type="text" size="2" id="answer"
>>>> name="answer/></mi></menclose>
>>>>  </mrow>
>>>> </math>
>>>> </body>
>>>>
>>>> </html>
>>>>
>>>>
>>>>

Received on Saturday, 12 April 2025 06:22:22 UTC