Posts in the Browsers Category

Freezer Case

Published 20 years, 2 months past

Since a few people asked for it, I’ve created a test file that reproduces the Internet Explorer freeze reported yesterday.  You can find it with the title “Internet Explorer Freezes — BEWARE!“.  If you follow that link with a non-IE browser, you should see a static copy of the “Ten Things To Do…” post, with two differences:

  1. I stripped off the theme stylesheet so the masthead graphic isn’t shown.
  2. I inserted a warning/explanatory comment near the top of the document.

Under the hood, the main difference is that the style sheets are all embedded in the document, so if you’re so inclined you can download that single page to your hard drive and fiddle with it to your heart’s content.  If anyone can narrow down this problem to a very minimal test case, I’d love to see it.  Refer back to “When Browsers Attack!” for notes on what I discovered.  There may well be more to the story, but if so, I didn’t find it.

I’ll reiterate the warning, in case it somehow wasn’t clear enough: iif you load this document in IE/Win, the odds are very, very, very high that it will freeze Internet Explorer, necessitating a force-quit of the application.  It may also crash Windows.  If you don’t want those sorts of things to happen to you, then don’t load the document.  Clear?  Good.


When Browsers Attack!

Published 20 years, 2 months past

Remember my recently posted conversation with Molly?  Boy, am I ever feelin’ that today.  In spades.

Some of you have noticed earlier today that things were presentationally unstable.  Depending on when you dropped by, you would have seen raw document presentation with no author styles at all, or some chunks of the site’s usual styles but not others, or all of the usual styles with a few oddities thrown on top for good measure.  For a few hours, during which I had to attend to something else, the site was fine except that in IE/Win, the main content column was quite a bit wider than usual, and some bits of content were visually exceeding the edges of the design box.  All that was happening because I was turning styles on and off in an attempt to stop freezing Internet Explorer for Windows.

Freezing?  Oh, yes.  As in locking it up so that people had to use the Task Manager to force-quit the process.  There were probably a few reboots out there as well; there were at least a couple here in Casa de Meyer.  Ordinarily, I’d apologize.  Not this time.  If you want an apology, try finding the person or persons responsible for IE’s CSS handling, and demand an apology from them.  I’m not taking the rap for this.

To set the stage, let me back up a couple of days.  As I passed by Kat’s office, she called out, “Hey, how come my browser keeps getting screwed up?”

“Because it’s Explorer,” I said.  “Next question?”

“Ha ha.  Seriously, every time I try to view your ‘ten things to do in Cleveland‘ post, the computer crashes.  I think there’s something wrong with it.”

Grumbling, I wandered over to her computer.  Sure enough, the browser was completely frozen.  She’d already called up the Task Manager and was forcing the browser to quit.  She said it was the third time she’d had to do it.  As I watched, the screen went blank, then drew the desktop color and stopped.  The cursor appeared as an hourglass, and refused to change or even move.

Once the system had gone through a hard reboot, I fired up Netscape 7 and loaded up meyerweb.  I surfed around to various posts.  No problems at all.  I then launched IE and loaded up the home page.  No problem.  I went to the offending post.  Instant freeze.

After a few more invocations of the Fatal Freeze, I wandered out of her office again, muttering about Explorer and Windows and pondering the possibility that her computer had been infected with some kind of virus, malware, or other nastiness.  But then, the next day, I got some e-mail reporting similar problems.  Then Ian Firth managed to get a comment in about the problem on the post “Really Undoing html.css“, even though others were getting the Fatal Freeze on that very post.  And he mentioned that it was happening in both IE and FeedDemon—which meant it was something in IE’s rendering engine, since FeedDemon just wraps itself around the engine.  A similar report cropped up in the FeedDemon forums this morning, where it was mentioned that a similar problem had already been seen in the post “Standards Savings“.  (Not that anybody had actually bothered to tell me, but hey, whatever.)

So I fired up VirtualPC this morning and tested the problem for myself.  And sure enough, I was very quickly the latest resident of Lockup City.  So I started narrowing down the cause.  I’ll spare you all the nasty details (and foul language) of my bug hunt, and cut to the chase: the lockup was happening on entry pages where the post content included an element that used left padding.  Blockquotes and lists were the prime triggers.  There wasn’t an absolute 100% guarantee of trouble, but it was close.  I could avoid the freeze by commenting out a single declaration in my main style sheet:

#main {
  margin: 0 15em 0 0;
  /* padding: 3em 4em 3em 4em; */
  border-right: 1px solid #AAA;
  background: #FFF;
  min-height: 30em;
}

That’s why the content was running rampant earlier today.  I had to leave that line commented out for a few hours.  But I knew that couldn’t be the real cause, because it didn’t cause freezes on the home page, or even on monthly or daily archive pages.  The freeze only happened on an individual entry page where there was a padding-indented element inside the content column.  Thus, the source was most likely to lie in style sheet that’s applied only to post pages.

So I started digging through my entry style sheet until I narrowed the problem down to this line:

.prev-next {margin: 0; padding: 0.25em 1% 0; 
  float: left; width: 98%;}

If I commented it out, and uncommented the padding declaration from before, there were no problems.  So the culprit lay somewhere in the .prev-next rule.  Anyone want to guess at the cause?  Go ahead.

Oh, all right, I’ll tell you.  It was float: left;.  As soon as I removed that declaration, the IE6 freezing problem just melted away.  So if you’ve encountered freezes while trying to view entry pages in the past, you shouldn’t any more.  (If you do, please comment on this entry with the exact browser and OS you’re using.)

The original point of the float statement was to get the unordered list to wrap around the floated list items within it, since floated elements wrap around floated descendants (for more details, see my article “Containing Floats“).  Since that was apparently a recipe for disaster, I modified the rule to read:

.prev-next {margin: 0; padding: 0.25em 1% 0; 
  width: 98%; height: 1em;}

It isn’t exactly the same as what I was doing before, but the result is close enough for now.

What else might I have done?  Well, in all honesty, I thought seriously about leaving things status quo and letting IE users go hang.  I don’t cater to potential crash bugs in NN4, for example; why should I make an exception for another browser?  But as I always knew I would, I grumbled a bit and then made an accommodation for IE.  I may one day restore the float for more modern browsers and use some sort of hack to hide it from IE/Win, but for now I’ll leave things be.

What’s odd to me is that the styles involved in triggering this problem have been in place literally for months.  If this was a problem, it should have arisen before now.  Yet the first I heard of this freeze bug was two days ago, and then all of a sudden I was hearing about it from multiple sources.  If I’d been updating my CSS, that would be understandable, but I wasn’t.  So what happened?  Did the installed Explorer population just get spontaneously and collectively buggier over the weekend, or what?  Is there a subtle worm running around adding bugs to IE’s rendering engine?  I’m really at a loss here.

As to why that particular combination of styles would cause IE to freeze up, I’m completely at a loss.  Not a clue in the world.

While I was mucking around in the CSS anyway, I decided to see if I could fix the rendering error in IE/Win that made the sidebar hang out over the vertical separator.  I did, so far as I can tell.  The problem there was the “Exploration” box and the styles I’d applied to it.  Apparently, if you set a form element to width: 95%; margin-left 5%; and then set a text input within that form to width: 100%;, it all adds up to something like 120%, or something.  So I did a little bit of a hack to hide the input element’s width value from IE/Win.  The input box won’t be as wide for IE/Win users, but as far as I’m concerned that’s an acceptable loss.

I hope your morning was substantially less frustrating than mine.


Really Undoing html.css

Published 20 years, 2 months past

There’s an aspect of document presentation most of us don’t consider: the browser defaults.  If you take an HTML or XHTML document—for the purposes of this exercise, assume it contains no presentational markup—and load it up in a Web browser with no CSS applied, there will still be some presentational effects.  A level-one heading, for example, is usually boldfaced and a good deal larger than other text, thus leading to the old stereotype of headings being “big and ugly”; the pre element typically honors whitespace and uses a monospace font; a paragraph is separated from other elements by a “blank line”; and so on.  From a CSS point of view, all this happens because the browser has built-in styles.

Tantek recently wrote about his creation of a file called undohtml.css, whose sole purpose is to strip away some of the default browser styles applied to common elements.  By resetting all headings to the same size, for example, he avoids the inconsistencies of heading sizes across browsers and brings everything to a common baseline.  If a different size is desired, the author has to do it manually.  (He should probably zero out the margins on headings as well, as those too tend to be inconsistent across browsers.)  He also zeroes out their margins, using a separate rule that I overlooked when I first posted.  Apologies to Tantek for my initial claim that he didn’t take that step.

Of course, Tantek isn’t really removing all the default styles, but (so far) just those that have given him the most trouble.  When it comes to Gecko-based browsers like Firefox and Mozilla, however, you can completely eliminate all built-in styles.  These browsers use a series of style sheets to control the presentation of documents, forms, MathML markup, and so on.  In OS X, you can find most of these style sheets by showing the package contents of the browser’s application file and navigating to Contents > MacOS > res.  On just about any other OS, it’s even easier; just search your hard drive for html.css and open the directory that contains that file.

If you look in html.css, you’ll find all of the styles that make what we think of as “unstyled” documents act the way they do.  Consider, for example:

area, base, basefont, head, meta, script, style, title,
noembed, noscript, param {
   display: none;
}

That rule is why the head element and all its contents don’t appear in your browser (as well as all those other “invisible” elements).  From a CSS standpoint, there’s nothing special about those elements as compared to others like div or ul.  The fact that they’re traditionally “invisible” is irrelevant—but with that one rule, the tradition is preserved.  You can always override the rule, of course; try style {display: block;} on a test document that contains an embedded style sheet and load it up in Firefox/Mozilla.  It isn’t magic.  It’s just a change from the usual way that documents are presented.  (See this test document for an example.)

There’s also:

/* nested lists have no top/bottom margins */
ul ul,   ul ol,   ul dir,   ul menu,   ul dl,
ol ul,   ol ol,   ol dir,   ol menu,   ol dl,
dir ul,  dir ol,  dir dir,  dir menu,  dir dl,
menu ul, menu ol, menu dir, menu menu, menu dl,
dl ul,   dl ol,   dl dir,   dl menu,   dl dl {
  margin-top: 0;
  margin-bottom: 0;
}

So in order to remove the top and bottom margins from nested lists, which is a traditional behavior of HTML browsers, that rule needs to be in the default style sheet.  Remove it, and nested lists would have top and bottom margins thanks to another rule in the style sheet:

ul, menu, dir {
  display: block;
  list-style-type: disc;
  margin: 1em 0;
  -moz-padding-start: 40px;
  -moz-counter-reset: -html-counter 0;
}

That rule not only sets the usual margins and such, but also includes some Mozilla-proprietary properties that help lists act in accordance with our expectations.  There are certain aspects of traditional presentation that aren’t (yet) fully describable using CSS, so the Mozilla folks have had to add properties.  In accordance with CSS2.1, section 4.1.2, these proprietary extensions are marked with a vendor prefix; here, it’s -moz-.  So any property or value you see starting with that string is a proprietary extension.  (For the record, I have no objection to extensions so long as they’re clearly marked as such; it’s the “silent” extensions that bug me.)

There is more to the presentation story than just html.css.  In the same directory, you can find quirk.css, which is applied instead of html.css when the browser is in “quirks” mode.  Another style sheet, viewsource.css, affects the presentation of any view source window.  All the nifty color-coding happens as a result of that style sheet, which is applied to automatically-generated markup that underlies the actual source you see.

So how do you completely strip out the default styles for an (X)HTML document?  Quit the browser application and rename the file html.css to something like html222.css.  Do the same for quirk.css.  Now re-launch the browser and find out just how much you’ve been taking for granted.  Feel free to browse around the Web and see what happens on various sites, but you’ll have to type blind, because the address bar won’t show any text.  You can still drag HTML documents on your hard drive into the window and see what happens.  If a document has any CSS applied to it, then the browser will use it.  It just won’t have any of the default styles available, so you’ll be applying your styles on top of nothing, instead of the usual foundation of expected presentation.

So what exactly is the point of all this?  As it turns out, I believe there are four:

  1. By studying html.css, beginning CSS users can compare the rules to the “unstyled” presentation of documents, and thus get a much better idea of how CSS works.
  2. By removing the default styles, you can come to a much greater realization of how much presentation is taken for granted, and how much there is to be dealt with when creating a new design.
  3. On a related note, note that the absolute bare minimum presentation of a document is to render all elements with inline boxes, and to show every scrap of content available.  Even something as basic as making a paragraph generate a block box is a style effect.
  4. It helps us to realize that what we often think of as the “special handling” of HTML is anything but: in Firefox/Mozilla, HTML documents are just a case of some markup that happens to have some pre-defined CSS applied to it.  Granted, the proprietary extensions needed to keep things in line with expectations are a case of special handling, and those tell us one of two things:
    • CSS still has a long way to go before it can be called a full-fledged layout tool, since it can’t fully recreate traditional HTML layout.
    • Old-school HTML layout was so totally wack, it’s no surprise that it’s hard to describe even with a tool like CSS at your disposal.
    I’ll leave it to the reader to decide which of those two they prefer.  Or, heck, choose both.  It isn’t as though they’re mutually exclusive.

Have fun fiddling with or completely removing the built-in styles!  Just remember: modifications like those described are made at your own risk, I’m not responsible if you do this and your hard drive vaporizes, no warranty is expressed or implied, not a flying toy, blah blah blah.


Scenes From An iChat Window

Published 20 years, 2 months past

Excerpt from an IM session this afternoon:

Eric Meyer: Browsers– can’t live with ’em, can’t kill their developers.

Molly Holzschlag: well one could …

Eric Meyer: Okay, but not legally.

Molly Holzschlag: justifiable homicide?

Eric Meyer: Juries are notoriously unsympathetic to technical explanations.

Molly Holzschlag: you have a point


Of Site Styles and CSS Columns

Published 20 years, 3 months past

Thanks to a post over at Simon’s weblog, I discovered that the Mozilla 1.8a3 readme file tells us of some interesting CSS-related developments:

       
  • Users can now disable CSS via Use Style > None or a global preference (bug 32372.)
  •    
  • Mozilla now supports a at-rule for matching on site/document URL. Among other things, this makes site-specific user style rules possible (bug 238099.)
  •    
  • Preliminary support for CSS columns has been checked in to Mozilla bug 251162.)

The middle of the three is what Simon wrote about, and it’s indeed very cool.  CSS signatures would never have been necessary if browsers had always supported per-site styles.  I’m not entirely thrilled about the syntax, but it’s a good start.  And for those who are wondering how I could support a non-standard extension, I’ve never been against them as long as they were clearly marked as such.  Microsoft’s extensions (behavior, filter, the scrollbar stuff) weren’t, which inevitably led to confusion.  The Mozilla stuff is marked in such a way that you can tell it’s an extension, and in a way that won’t conflict with future CSS.

I’m happy to see that Mozilla will finally let users easily disable CSS.  For those who need the text view, say because they have poor vision, it will be a welcome feature.  For those who want to quickly check the document’s unstyled rendering, it will be similarly useful.

But I’m most intrigued by the addition of “preliminary” support for CSS columns.  This would allow you to declare that a given element’s content should be flowed into columns, complete with auto-balanced heights and everything.  For example, if you wanted a list flowed into two columns, you could declare:

ul {-moz-column-count: 2;}

That would split the contents of every undordered list into two halves, filling the first column with the first half of the list and the second column with the second half.  Thoroughly awesome.  See the CSS multi-column layout module for more details, although I don’t know how much Mozilla actually supports at this juncture.

Update: it turns out that column support isn’t present in Mozilla 1.8a3, contrary to the release notes.  I’ve been told that it will be present in 1.8a4.


Dashboard Again

Published 20 years, 4 months past

To paraphrase Tim Bray, I had thought I’d said enough about the Dashboard and its markup, but when Dave Hyatt says he’s interested in hearing your thoughts, out loud you think.  Dave’s interest in my thoughts was sparked by Ian Hickson‘s post about extending HTML, where he raised objections to all the technical proposals made thus far and advocated working with the WHAT WG before adding anything new.  So let me first establish my baseline for my thinking on the subject, both past and present:

Dashboard will happen, and will be present in Tiger, and will have at least the features described thus far.  All that remains is to advocate for interoperability with standards.

That isn’t some sort of admission of defeat: I’m really looking forward to the Dashboard.  I think it’s a great thing.  I think it shows how, with just a little bit of extension, the standards we already know can be used in compelling and useful ways, and for that matter how standards can yield powerful applications on their own.  The baseline assumption I make above is a way of establishing the parameters for my discussions of the subject.  It helps keep me focused.

In order to keep things clean, I proposed an approach centering around a new DOCTYPE, and Tim Bray proposed another revolving around namespacing.  Ian pointed out the technical flaws in all of our suggestions.  Strictly speaking, Ian’s right: there are technical problems with each of the proposed solutions.  In the world of pragmatic standards, though, what’s important is making things work as necessary to get the job done.  Thus my approach.  You haven’t heard me complain about the addition of contenteditable to the Web Core’s DOM, for example.  Why would I?  Dave’s right to add it.

It seems that both Tim and Ian felt that creating a new DOCTYPE was a poor idea; one reason was that it would mean recreating the entirety of HTML in DashboardML, with elements bearing the same name and given (presumably) the same semantics.  I don’t really see why that’s a problem, since it’s already been done once before, for a little number we call XHTML.  Now, it might very well be a better idea to create WHATML instead of DashboardML.  That’s fine with me; in fact, I mentioned that as a possibility in my proposal.  The actual name and home of the new language doesn’t much matter to me, although I should point out that whoever is responsible for the new language, it’s going to require either a new DOCTYPE or some kind of namespacing solution.  If Apple’s additions can be accepted by the WHAT WG in time to get Dashboard shipped with Tiger, then great.  If not, they’ll have to move ahead without that imprimatur.  My goal is to advocate that they do so in a standards-friendly way.

In response to my comment that I thought Dashboard would be better off as XML instead of HTML, because that way you can make up whatever markup is needed, Ian said:

So let me get this right. It’s ok to send proprietary non-standard markup over the Web, so long as the angle brackets are XML angle brackets and not HTML angle brackets?

In a word, yes.  That’s what the W3C has been telling us for a while now, so why would I think otherwise?  Sure, the W3C publishes new stuff using XML and it’s all been thoroughly vetted and worked over and generally committeed to death, and that’s great.  But XML makes it possible to invent any markup language you like.  So far as I can tell, that’s kind of its point.  As long as things are well-formed, you’re good; if you’re both well-formed and valid, then angels descend from the markup heavens to sing your praises.

HTML is a well-defined, long-understood (almost-)SGML application.  Changing it willy-nilly is like making up new words to add to English.  (Hey, did you see that roopyrastic article in last month’s Scientific American?)  On the other hand, if you create a new XML language, then you’ve gone the Esperanto route.  The language is as valid as you say it is, and it is a whole new thing, but at least you’re not polluting an existing language with stuff you made up.

So with XML, anyone can make up anything and release it into the wild.  It might be argued that to send new XML languages flying around the public Web is a technological rebirth of the Tower of Babel, to which I would respond, “What else did you think was going to happen?”  In fact, it’s been happening for a while, as the widespread use of RSS will attest.  I haven’t noticed that being a major problem for anyone, and in fact you can combine RSS and CSS to display them in a browser.  That doesn’t seem to be a problem either.

Besides, all of the XML-centric solutions, flawed or not, were excluded by Dave from the outset when he said that Dashboard widgets needed to be HTML, not XML.  The reason given was to lower the entry barrier for would-be widget developers.  I personally don’t agree with that perspective, as I believe anyone skilled enough to create a decent widget will find XHTML (or even namespacing) syntax the least of their concerns.  My disagreement isn’t terribly relevant, though, since I’m not the one defining the way Dashboard widgets work.

As for the concern that adding new stuff to HTML will leave it free of semantics and confuse everyone, I don’t accept that at all.  The semantics that exist in HTML, XHML, and so on exist because we’ve collectively agreed on what they mean.  I don’t mean that we all held a big convention and voted on the meaning of h2.  The HTML specification defined what h2 means semantically, and the rest of us (authors, editors, search engines, etc.) tacitly agreed to go along with that definition.  The same thing can happen again—and, in RSS, already has.  RSS defines its own semantics, and everyone’s agreed to go along with its definitions.  It helps that the elements are given obvious names like description, of course.  RSS also has a title element for every entry in the feed.  Yet nobody, so far as I know, has gotten those title elements confused with HTML’s title element.

So now what?  Now the team at Apple keeps pushing forward to make Dashboard the best product it can be while still making it as easy to develop for as possible.  Fortunately, Dave is willing to publicly discuss how that will be accomplished, which is nothing short of amazing (although totally in keeping with what I know of Dave).  He has also said Apple is willing to submit their additions to the WHAT WG for discussion.  I honestly don’t know what more one could ask for at this juncture.  There is every opportunity to work with Apple (rather than protesting against it) to make sure that Dashboard widgets interoperate with the Web’s foundations… or at least don’t cause unnecessary problems.  Apple is listening.  It’s up to us to talk with them, understanding their needs and limitations while making clear our concerns and suggestions.

Despite my complete lack of time and reluctance to add still more mail to my bulging Inbox, I may well have to subscribe to the WHAT WG public mailing list.


Extended Dash

Published 20 years, 4 months past

It’s been interesting to see the back-and-forth over Dashboard the past few days.  Dave‘s posts have been greatly illuminating, and I belatedly discovered Tim Bray‘s initial reaction and further thoughts on the topic.  Dave has now done a test implementation of adding a default namespace for Dashboard widgets, using the namespace URI http://www.apple.com/2004/xhtml-extended/.  That doesn’t (yet?) point to an actual document, but that’s okay; URIs don’t have to refer to a specific resource.  They just have to be unique.  This is in contrast to URLs, which in theory have to point to something that actually exists.  Although clearly reality has a long way to go before it catches up with that theory.

As Dave points out, his approach not only makes it possible for HTML to be extended without breaking with existing standards, it also provides a handy “pay attention to the Dashboard stuff” trigger and it opens a clear path toward supporting XML-based widgets in the future.  This is all kinds of cool, and I can’t see any real drawbacks.  If you do, let Dave know, or comment on this post; I’ll collect them (since Dave doesn’t presently have commenting on his site) for his review.

Despite it being Dave’s second choice, the “create a new DOCTYPE” idea is something I want to discuss in a little more detail, if only to illustrate how it can work.  Here’s a markup example of an amazingly stupid and useless widget using a hypothetical DashboardML DTD.

<!DOCTYPE html SYSTEM
  "http://www.apple.com/dtd/2004/dashboardml-10.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();">
<canvas blah="foo" yadda="baz">
<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>

By referring to a DTD defining a language that looks just like HTML except for the canvas element and composite attribute, along with any other additions, the markup stays free of explicit namespacing and works the way authors already expect.  It really is that simple.  IBM already does something like this, having created an “IBM XHTML 1.1 Transitional” DTD that’s used throughout their Web presence.  The comments at the top of the DTD file explain how it’s different than regular old XHTML, but the executive summary is that it permits some old table-and-spacer-era markup hacks in an XHTML environment.  If you run an IBM-XHTML compliant document through a validator that loads and uses IBM’s DTD to check over the document’s markup, then the document will validate.  The same thing could be done for Dashboard—or for any other project, really.  That’s the beauty of it.  We aren’t constrained to HTML any more, nor even to XHTML.  We’re only constrained by what clients will support… as always.

(It was pointed out to me via e-mail that XHTML is perfect for this, because it’s already modularized so all you have to do is tack on another module.  That would be quite true, except for Dave’s statement that the Dashboard widgets won’t be using XHTML.)

The other potential problem with my suggestion, according to Dave, is that the DOCTYPE is used to pick a rendering mode in current browsers.  Dave says he doesn’t want to restrict widget authors to one mode or the other.  Now, I’d personally have no problem forcing all widgets to be rendered in standards mode, but that’s probably just my inner purist talking.  If it were important to allow quirks mode, then create a transitional DashboardML DOCTYPE that triggers it; use the default (above) for triggering standards mode.  This would be consistent with current DOCTYPE switching schemes.

Regardless, at this point, I think we’re pretty well assured that things are headed in the right direction.  That’s very much thanks to Dave’s openness and genuine interest in doing the right thing, not to mention his swift response times.  Where things go from here, we’ll see, both at Surfin’ Safari and (I expect) by way of submissions to and work by the WHAT WG—which itself will be the subject of a post in the near future.


DashboardML

Published 20 years, 4 months past

Now we know more about Dashboard, and according to Dave, the widgets are indeed HTML, not XML.  Fortunately, hastily-applied bandages kept my ruptured vein from killing me.  As for my TiBook, some quick squeegee work saved the display, but now the keys are kind of sticky.  How’s that for an image?

As most people who know me are aware, I’m very much a real-world kind of guy.  That side of me is in favor of what’s being done to make Safari and the Dashboard more useful.  The additions to HTML and the DOM are indeed minimal—so far.  I’m sure the first few proprietary extensions to IE/Win were minimal, too.  After all, it’s just a tag called MARQUEE.  What’s one more element?

I also recognize that HTML is far too limited for anything except simple document structuring.  It doesn’t have interesting controls like sliders, and it certainly doesn’t provide any joy for people who want irregular shapes.  SVG does provide such things, but Dave’s point about it being a huge task to implement is understandable.  If only Quartz had been based on SVG instead of another technology… but there’s no sense crying about spilled milk under the bridge now, I suppose.

Of course, the theorist in me is quivering in outrage.  The browser-wars veteran isn’t too thrilled either.  For years, we heard Microsoft and Netscape say things like “standards are secondary to customer demands” and “standards aren’t as useful as the cool new proprietary features we’re adding”.  These things need not be inimical to standards support.  They should not require a breaking of standards.

As I observed previously, making Dashboard widgets be XML would solve the problem, or at least could fairly easily.  Dave says that won’t happen:

…it was suggested that the widgets be written in XML rather than HTML and that all of the new tags and attributes be namespaced. However, this would have dramatically increased the complexity of crafting Dashboard widgets. People know how to write HTML, but most of those same people have never written an XML file, and namespaces are a point of confusion.

I agree about namespaces being confusing; the only reason I have any comfort level with them is because we had to define multiple namespaces for the XML format we used on DevEdge, and I made enough mistakes using them that I eventually came to understand them.  Sort of.  To an author who’s only ever seen HTML or even XHTML, they would likely be very annoying.  I’d like to point out, though, that I suggested not namespacing everything, but creating a whole new DashboardML that used a whole bunch of elements that looked and acted the same as XHTML, with whatever additions were needed.  Thus the beginning of the document (after the DOCTYPE) might look something like this:

<html xmlns="http://www.apple.com/2004/dashboardml">
<head>
<title>This is an example</title>
</head>

So instead of pointing to the XHTML namespace URI, you point to the DashboardML namespace URI.  The end result is that you can have a document that looks exactly like XHTML, except for the additions (composite and so on).  It seems like it would be fairly simple to do, but again, I can’t say that with any authority.

So let’s assume that, for whatever reason, the above approach isn’t possible within the Tiger timeframe.  There is another way, one I mentioned briefly in my last post.  That would be to create a new DTD for DashboardML, one that’s a direct copy of the HTML 4.01 DTD with the needed additions.  It could look like this:

<!DOCTYPE html SYSTEM "http://www.apple.com/dtd/2004/dashboardml-10.dtd">

That would point to a DTD that defines DashboardML.  DashboardML would be exactly like HTML 4.01 (or whatever version they wanted) in every respect except for the additions of the canvas element and the composite attribute.  The advantage is that they can add more things if needed, and not pollute the HTML space.  Since Apple’s working with the WHAT WG to get these things accepted, then perhaps the WHAT WG should host the DTD.  Then it might look something like:

<!DOCTYPE html SYSTEM "http://www.whatwg.org/dtd/2004/whatml-10.dtd">

The URI could be anything, so long as it pointed to an actual DTD.  I don’t even care where it lives, so long as it lives somewhere.  I should also point out that this would need to be done even if the widgets were XML, as opposed to an HTML-like language.  Either way, they keep Dashboard extensions out of the HTML space.

Why should we even bother?  One word: validation.  By providing a DTD that defines the markup language being used to create the widgets, validation becomes a snap.  That’s important, because with validation, widget authors can keep their markup clean.  It will help them with their development efforts.

Here’s another reason to bother: reducing confusion.  “But Eric, a new DOCTYPE will increase confusion!” you might be thinking.  Maybe at first, although overall I doubt it will.  The confusion-reducing aspect is that when widgets get published on the Web—and they will be published on the Web—there will be an obvious indication that the markup is not traditional HTML, but something really close to it.  Browsers can then do what they’ve always done: handle what they understand, and ignore what they don’t.

It’s been argued that Dashboard widgets are intended for a closed environment, and not to sit out on the Web.  True, but that won’t change anything.  Within a week of their appearing in the WWDC build of Tiger, Dashboard widgets appeared on the public Web (they’ve since been pulled offline).  This won’t exactly tail off as more widgets are built.  If anything, we’ll see more and more widgets getting out into the wild—for example, when people find a widget they like and adapt it for use on their public sites.  The calendar is the most obvious example that comes to mind.  In order to keep things straight, widgets need to have their own DOCTYPE.  If nothing else, it will provide a convenient explanation when someone throws a widget onto their site and it breaks in other browsers.  (“Yeah, see, that uses DashboardML and only Safari supports it…”)

Over at the WaSP, Anders Pearson wrote:

Overall, though, it’s not that big a deal. Safari does an excellent (not perfect) job of supporting the various HTML, XHTML, and CSS specs as they’re written and ultimately, that’s what’s most important. If developers don’t want to use the extensions, they don’t have to.

As long as these extensions happen within a new document type, then I agree.  Allowing them to operate within any document bearing a W3C DOCTYPE would be a big, big mistake.


Browse the Archive

Earlier Entries

Later Entries