Just Another Blog

Are you thinking what I'm thinking?

Saturday, July 10, 2004

Please extend the web correctly

Dave Hyatt is an open person who listens to comments. But unfortunately he seems to misunderstood the suggestions.

On his previous blog post, he mentioned 2 ways to extend the (X)HTML:

  • Namespace mechanism
  • New DOCTYPE declaration
He now proposes to use namespace mechanism in HTML, which is not correct.

There is no namespace in HTML. It is the X(HT)ML stuff. DOCTYPE is, however, available to both HTML and XHTML. Eric Meyer has made a very good example illustrating this. As you can see, the example is written using the old-school HTML.

Another benefit is that if the web browser doesn't support this DOCTYPE, it can choose not to render it at all (or handle it with special care). After all, those new elements and attritubes are used in the Dashboard only, isn't it? So webpage will those new stuffs are useless in other browsers anyway...

If the Dashboard is going to stick with HTML in its first release, it should use the HTML way of extending the web. Developers can add the (real) namespace mechanism later when Safari has better (and real) support of XHTML.

P.S. Lachlan Hunt made another cool suggestion: use the generic <object> element (wow, my favorite). This element might be new to you, but it exists in both HTML and XHTML. Let me modify Eric's example a little bit...

In blah.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>myWidget</title>
<style type="text/css">
body {background: aquamarine;}
</style>
<script type="text/javascript">

function startup() {
  alert('Happy!  Joy!');
}
</script>
</head>
<body onload="startup();">
<object type="application/dashboard+xml" data="blah.dashboard">
  Your browser doesn't support dashboard...
</object>
<h1>Widget!</h1>
<div class="main">
<p>So cool.</p>

<p>So fine.</p>
</div>
<img src="yar.gif" composite="punchout" alt="Yar!">
<p id="footer">copyleft nobody</p>
</body>
</html>

In blah.dashboard (an XML with content-type of "application/dashboard+xml"):

<dashboard>
  <blah>A blah element/blah>
</dashboard>

Browser that doesn't support the Dashboard object will then simply display "Your browser doesn't support dashboard...", while other (X)HTML contents are still visible.

0 Comments:

Note that troll and spam comments will be deleted without any notification.

Post a Comment

<< Home