And more Web technologies get bastardized
Microsoft released a preview of IE 9 with support for XHTML and Scalable Vector Graphics (SVG). Microsoft should be commended for supporting XHTML, SVG and their attempt to make application development easier using these technologies. However, their implementation of XHTML and SVG in IE 9 destroys the very essence of these technologies - which is that they must be used according to specification.
What is SVG?
SVG is an XML markup language for rendering vector graphics, which are made up of mathematically described shapes such as lines, circles, polygons, etc. Unlike bitmap graphics, vector graphics can be stretched to any size without much distortion. This makes vector graphics ideal for building maps, charts, graphs and diagrams.
What is XHTML?
XHTML is a version of HTML that follows the rules of XML. Web developers can instruct Web browsers to process XHTML as HTML or as XML using an HTTP header. XHTML can be very useful in the area of content management and other application development, because it is very easy to parse and transform using off-the-shelf DOM and XSLT parsers.
What did Microsoft do to XHTML and SVG?
XHTML and SVG were designed to be XML languages but IE 9 processes them with what appears to be an HTML parser. As a result IE 9 will try to render incorrectly written XHTML and SVG documents without notifying the user that there are markup errors. Let's look closely at the implications of this. Below is an SVG document that contains, let's say, important pricing information:
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><polygon style="fill:yellow;stroke:black;stroke-width:1" points="85,41 132,48 100,81 108,127 65,105 25,127 33,81 0,48 45,41, 65,1" /><text style="font-size:26px;fill:#800080" x="40" y="70">$</text><text style="font-size:40px;fill:#000000" x="51" y="84">1</text><text style="font-size:40px;fill:#000000" x="67" y="84">0</text></svg>
The following screen shot shows how Opera will display the preceding SVG document:

Now let's introduce a markup error into this document. For example, an incorrectly quoted attribute in the last <text> element. This time, Opera will display an error message as shown in the screen shot below:

However, instead of an error message, IE 9 Developer Platform Preview release will try to render the incorrectly constructed SVG document. As a result, it will display incorrect information as shown in the screen shot below:

Do I hear you say: "But Microsoft will get better at auto-correcting SVG"? Unfortunately, some errors cannot be auto-corrected.
Now let's take a look at how IE 9 will process an incorrectly constructed XHTML document. If the following document is served to IE 9 with a content type application/xhtml+xml, which is an explicit instruction to the Web browser to process content as XML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>Hello world!</title></head><body><p>Hello World!</body></html>
...IE 9 will display the document as follows:

The correct behaviour of course would be to display an error message informing the user that the XHTML document is incorrectly constructed.
How do Web technologies get bastardized?
It starts with good intentions. I do believe that in IE 9 Microsoft is trying to make XHTML and SVG easy for developers to use. But history has shown that well intentioned but unilateral decisions by browser vendors have far reaching consequences for all stakeholders in Web technology. For example, Netscape was probably motivated by good intentions when they decided to silently auto-correct invalid HTML. That decision made the cost of developing Web browsers skyrocket, which in turn wiped out many competing browsers. That's why today even the richest companies in the world such as Google and Apple cannot afford to build Web browsers from scratch and instead rely on 3rd-party libraries.
How Microsoft can fix the problem
How browser vendors implement XHTML and SVG affects all stakeholders in Web technology. To Microsoft I say: Please consult with other stakeholders in Web technology regarding the parsing method for XHTML and SVG before the final release of IE 9.
Update: Mozilla follows Microsoft's lead. Pre-release versions of Firefox 4 parse inline SVG and MathML as HTML and do not display error messages if SVG or MathML markup contains errors.
Comments are closed for this article.