Skip navigation.

exploreopera

| Help

Sign up | Help

CSS Warrior

Art of browser sniffing at W3C

if(MicroSoft) {run-around-pool('110m')}
else {swim('100m')}


Browser sniffers can hardly surprise Opera user. But the kind of browser sniffing that I encountered today is something new. It is interesting because web page is not usual web site, it is test suite maintatined by W3C and intended to test user agent conformance 'to help insure uniformity and interoperability between MathML implementations'.
Each test page from test suite is shipped with XSLT style sheet that determines whether user uses MSIE and if so transforms tests to make them compatible with that browser (proprietary JScript/ActriveX are used).
Style sheet causes XSLT processing errors in Opera so to test UserJS that renders MathML in Opera I had to save it locally and delete XSLT sniffer.

Quoted from http://www.w3.org/Math/testsuite/style/pmathml.xsl
<xsl:param name="activex">
   <xsl:choose>
     <xsl:when test="$docpref='techexplorer-plugin'">techexplorer-plugin</xsl:when>
     <xsl:when test="system-property('xsl:vendor')!='Microsoft'"/>
     <xsl:when test="$docpref='mathplayer-dl'">mathplayer-dl</xsl:when>
     <xsl:when test="$docpref and fns:isinstalled(string($docpref/@o))='true'">
           <xsl:copy-of select="$docpref/node()"/>
     </xsl:when>
     <xsl:otherwise>
       <xsl:copy-of select="(document('')/*/fns:x[fns:isinstalled(string(@o))='true'])[1]/node()"/>
     </xsl:otherwise>
  </xsl:choose>
</xsl:param>

Revival of ISO 12083 Mathematics DTDWeb gets back

Comments

avatar
As you can imagine, there was lively discussion at the time whether or not to include browser sniffing in the W3C MathML test suite. Obviously, in the end, it did go in, largely because at the time the test suite was created, none of the most prominent browser/MathML implementations would have worked without it. Since the main point of the test suite was to test MathML implementations, and not the integration of HTML or XHTML with MathML in browsers, the Math group opted to sniff and transform.

Of course, the sniffing that is there is badly outdated now. Firefox/Mozilla, Opera with UserJS, and Internet Explorer with MathPlayer will now all render a completely standard XHTML + MathML document served with MIME type application/xhtml+xml. Clearly the test suite should be updated to reflect this. I'll try to find resources to make this happen, since your work on UserJS is valuable, and should not be placed at an artificial disadvantage by old, outdated workarounds.

Robert Miner
Design Science, Inc.
W3C Math Interest Group co-chair

By rminer, # 16. February 2006, 15:42:47

avatar
I understand that WG wanted to provide test suite that mainly checks ability to render formulae and not the way they are embedded in XHTML/XML, as testing both would result incompatibility with existing browsers. IMHO WG should not make this compromise (instead it would be reasonable to post modified versions of test suite on Mozilla's/Design Science sites) but the test itself is not a problem. The main problem is that authors followed this practice and often MathML content is embeded in (X)HTML in strange ways that make it difficult to handle.
Browser sniffing is not the only issue, we often encounter bootstrap approach in namespace declarations
xmlns="&amp;mathml;"

with entity being defined in external DTD or undefined at all (sometimes causes well formedness error), often content is served as text/html (sometimes content negotiation is combined with browser sniffing). All this causes artificial compatibility issues that could be avoided in relatively young and small MathML community.

Regarding UserJS for Opera it could be good toy to play with, but in overall I would not consider it seriously. One can provide basic functionality via UserJS, but it is unlikely to achieve full compatibility with existing MathML content.

By White Lynx, # 17. February 2006, 09:31:16

Write a comment

You must be logged in to write a comment. if you're not a registered member, please sign up.