Re: Supporting MathML and SVG in text/html, and related topics

On Thu, Apr 10, 2008 at 11:51 AM, Ian Hickson wrote:
>  A common theme across some of the problems listed above, and discussed in
>  detail in the e-mails below, is the issue of a generic syntax for non-HTML
>  namespaces in text/html. It turns out to be _exceedingly_ hard to handle
>  the giant mass of weirdness found in legacy content on the Web while
>  adding new features. For example, this page:
>       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>       "">
>       <html xmlns="" >
>       <math xmlns="">
>       <math xmlns="&mathml;">
>       <head>
>       [... continues with just a normal XHTML page]

...renders exactly the same in Firefox 2 and IE8b1 (don't know why,
probably because they come before <head>)

>  ...or this page:
>       [...]
>       <table width="592" border="0" cellspacing="0" cellpadding="0">
>         <tr align="left" valign="top">
>           <td width="592"><svg width="200" height="200" viewBox="0 0
>       200 200"><img name="r1_c1" src="map/resortmap.jpg" width="600"
>       height="465" border="0" alt="Cocopah RV and Golf Resort"
>       usemap="#r1_c1Map"><map name="r1_c1Map"><area shape="rect"
>       coords="4,2,298,230" href="map/lmp1a.jpg"><area shape="rect"
>       coords="1,230,296,460" href="map/lmp1b.jpg"><area shape="rect"
>       coords="297,4,598,231" href="map/lmp2a.jpg"><area shape="rect"
>       coords="297,231,599,462" href="map/lmp2b.jpg"></map><rect
>       x="100" y="100" width="10" height="20" style="fill: green"/>
>           </svg> </td>
>         </tr>
>       </table>
>       [...]

Don't use xmlns="" so renders exactly the same in Firefox 2 and IE8b1
(I've nly tested those two; not that I couldn't have tested more, but
I thought it was sufficient).



>  On Tue, 10 Apr 2007, Sam Ruby wrote:
>  >
>  > Instead of "starts with x_", how about "contains a colon"?
>  I considered that, but unfortunately, it forms a dichotomy of semantics,
>  where when used in XML the DOM shows one set of names, and when used in
>  text/html, it shows another (at least in legacy UAs, though we could
>  hard-code behaviour for new UAs).

IE already does this (report the thing following the first colon)
since version 5.5 (if there's a corresponding xmlns:<prefix> attribute
on the <html> element or a <?XML:NAMESPACE prefix=<prefix> />
If we follow the same rules (except for the <?XML:NAMESPACE />), we
probably won't break much pages...

>  On Sun, 9 Mar 2008, Sam Ruby wrote:
>  >
>  > > Establishing a pseudo-XML parsing scope for <svg> and math.
>  >
>  > IE8's approach seems to be "establish a pseudo-XML parsing scope for
>  > unknown elements which contain an attribute named xmlns that happens to
>  > match a list of known values", where the list of known values may vary
>  > by user agent or installation.  IMHO, that approach merits exploration.
>  Unfortunately, exploration basically shows that IE8 doesn't do anything
>  (at least, I couldn't reproduce it) with xmlns="", other than screw up the
>  attribute parsing),

It processes "/>" and puts the elements in a different "scope" (cf.
scopeName and tagUrn).

> and a quick study of existing documents suggests that
>  there's a great deal of content that wouldn't be handled very well at all
>  by anything triggering off xmlns="",

You might well be correct (Sam's blog fails to render in IE8b1, but it
seems to be a bug in their parser, probably because of the screwed-up
attribute parsing), though aside from those parser-bugs I guess
Microsoft has done some testing on their own...
Maybe someone from Microsoft could comment on this? Chris?

> even if it were limited to unknown elements or known namespaces
> (e.g. see the examples at the top of this  e-mail).

They're all rendered "correctly" (i.e. the same as in Firefox) in IE8b1.

Actually, the only problem I see with IE8's "enhanced namespace
support" is the lack of namespace support for attributes.

And fortunately, supporting namespaced elements (à la IE8 or
IE5.5/6/7) is not incompatible with your effort for supporting SVG and
MathML "out-of-the-box" (great job by the way).

My 2 c€nts...

Thomas Broyer

Received on Thursday, 10 April 2008 14:16:49 UTC