You're currently viewing a very old version of this website. Follow me to the latest version.


May 30, 2002

Signals and Slots

NetWindows curator Alex Russell has a nice introduction to the programming concept of signals and slots, an alternative approach to the popular event listener interface for Web applications.

CSS1 With Mozilla Notes

Lookit this: The CSS-1 spec with Mozilla bug annotations.

May 29, 2002

cellspacing and the DOM

By the way, if you're using the DOM to generate TABLE elements, you have to use setAttribute() to set the cellspacing and avoid the 2-pixel default spacing given to the table. Oh, and IE5.x stupidly requires that the cellspacing attribute be defined in camelCase: cellSpacing.

var tbl = document.createElement("TABLE");

Luckily this works in Mozilla too, so you don't have fork your code for each browser.

The iBrowser: We Don't Need Another Netscape 4

As noted yesterday, Register writer Andrew Orlowski suspects that Apple is going to adopt Chimera (Gecko-based OSX-native browser) as the engine for some forthcoming "iBrowser" to replace MacIE as the default browser for OSX.

More than one Mozilla developer has called horsefeathers on this. Mozillian Dave Hyatt refers to the Register piece as a conspiracy theory. Mozilla interface designer Matthew Thomas states that any new browser being developed is most likely based on "Apple's own HTML rendering engine, the same one as powers the help viewer in OS X." Even Orlowski himself, at the tail end of his piece, doubts the viability of such a plan: "It's a long-term commitment that only the brave would make. A temporary insurgency can turn into a full-scale Vietnam, if you're not careful."

It's too early to tell, and in fact this "iBrowser" may turn out to be mere speculation. But it's not impossible that a new OSX-native browser might become available. Witness the success of OSX, Apple's continued emphasis on ease of use, and the rising visibility of [Ti|i]Books as the portable of choice. If Apple is indeed at work on a stealth browser for OSX, it's my hope that it's at least as good as Mozilla in terms of standards-compliance. We don't need another Netscape 4.

What is "Apple's own HTML rendering engine?" How standards-compliant is it? What will it support? DOCTYPEs? CSS? XML? Will it support DOM? JavaScript? How's that box model looking?

And it's unlikely that Apple will set the story straight until good and ready. As an anonymous insider recently told me, "they wouldn't know. Apple is good at secrets."

May 28, 2002

Ticks and Poison Oak (With A Silent 'Poison')

When writing up clever directions to your geocache, one may wish to, as a courtesy to others, mention certain environmental factors for consideration. Like, say, tick season. And the probability that one may find oneself covered in hideous, bloodsucking arachnids while wading through knee-high grass in attempt to retrieve said cache. And the likelihood that one may continue to discover the little critters hiding in the cuffs and seams of your pants for hours afterward. And let's not forget the poison oak, shall we?

Her: I'm not letting you past the kitchen with those pants and shoes if they're covered with oak.

Me: You mean poison oak, right?

Her: Yes. I said "poison oak" with a silent "poison."

Chimera: the iBrowser?

Via Blogzilla comes this piece from the Register about the Apple iBrowser. iBrowser, what's that? According to rumor (and I do mean rumor), it's Chimera, repackaged as Apple's default browser for OS X. According to the article, none of the primary developers have confirmed Apple's interest. It's fun speculation -- and yet another reason to start taking Web standards seriously.

contenteditable for Mozilla

The folks art Q42, creator of Quek (cute little avatar/chat) and Xopus (browser-based WYSIWYG XML-editor) have released code that simulates a contenteditable attribute in Mozilla. With the code in place (it's JavaScript), text-containing elements in HTML pages can be edited in the browser.

May 24, 2002

Mozilla 1.0 Launch Party

I feel it is my patriotic duty to inform you of the following completely unsubstantiated rumor: Dealership may be playing at the Mozilla 1.0 launch party. I can think of nothing so thick square-rimmed glasses-wearing bowling-shirt-clad kernel-tweaking code-compiling wallet-chained standing-in-the-back-head-nodding geeky.*

I'm SO there.

More than one reader suggested that I try out Chimera, a Gecko/Carbon browser for OS X. It is indeed speedier than Mozilla for OS X, but is far from complete (little things like preference menus failing to open, lack of JS error messages, etc.). Great if you just wanna browse and not waste time. I'll be watching as the point releases come out. Here's a nice thing to know: the Google SOAP API demos I wrote work in Moz OS X. Whew!

In related news, Mozilla RC3 is out, which means the end is in sight.

And with that, I'm out. Have a great weekend. *the good kind.

May 23, 2002

x-browser list and Moz RC2 for OSX

I somehow got subscribed to xbrowser-list, the "Netscape Cross Browser Web Development Newsletter." In among the links to various reviews of the Netscape 7.0 browser was a recommendation that NS6.2 users upgrade immediately to patch a security hole.

A downer: the recommendation of the obnoxious RealPlayer as the default A/V player for NS7. Ugh.

I played around with Mozilla RC2 for Mac OS X yesterday night. The experience is about the same as the Windows versions, but the browser is dog-slow compared to Mac IE5.1. I've been looking for a comparison chart of features between the OSX and Win32 versions of Moz RC2 but haven't found anything, so for now I'm assuming that all the developer goodies (JS, DOM, etc.) are there. More on this as I experiment.

May 22, 2002

Netscape 7.0 PR1 released

Whoa, Netscape 7.0 PR1 is available. Rumor has it that NS7.0 is based on Mozilla RC2, with the final release to be built on Mozilla 1.0. Haven't had time to play with this yet. Any feedback out there?

May 21, 2002

DHTML Timeline/Keyframe Animation

Tim Morgan is working on a Flash-like timeline/keyframe extension for his DHTML toolset.

CARP Rejected, Briefs Filed in Eldred vs. Ashcroft

Good news. The Librarian of Congress has rejected the CARP proposal for licensing fees for webcasters. Cool, maybe now we can go back to the drawing board and inject some sanity into the determination of fair rates that webcasters can actually afford to pay.

In other news, opening briefs were filed yesterday in Eldred vs. Ashcroft, which challenges the constitutionality of the Sonny Bono Copyright Term Extension Act. The CTEA extended the length of both existing and future copyrights by 20 years.

DynAPI 2.9 and Mozilla compatibility ports

DynAPI 2.9 is the latest release of the popular cross-browser DHTML library, and is available at Dan Steinman's original site. For those of you still using DynAPI 1.0 and wish it supported Mozilla/Netscape 6, Dan has posted a drop-in port by Robert Clary that should solve your problems. Robert also has Mozilla-compatible ports of Mike "That BrainJar Guy" Hall's popular DHTML scripts originally found at Dynamic Drive.

May 20, 2002

Weblog is a word

This overview of Moby's upcoming Area:2 tour is the first non-weblog article I've seen use the word "weblog" without taking a whole paragraph to define the term.

May 18, 2002

E-Tech and Spider-Man

Actually, it was more like $75.

Got to spend a little time at the O'Reilly Emerging Tech Conference last Thursday. Saw Rohit Khare do a little thing on "SOAP routing" and a 7-layer burrito stack, or something. He's a rock star. Met Dave Winer for the first time. Enjoyed a little SOAP vs. REST debate that included Paul Prescod and Sam Ruby. Saw lots of people from afar.

Spider-Man was perfectly cast. Perfectly paced. Perfectly captured a lot of what made the comic book great. In many ways I enjoyed Spider-Man more than Episode II. So far, this summer blows away last year's season. Of course, it could be my acutely lowered expectations. Remember, on the Battlefield Earth sliding scale, everything relatively sucks, just as all meat tastes relatively like chicken.

May 16, 2002

On Episode II

First impressions of Star Wars Episode II, Attack of the Clones:

1) Ships! Everywhere ships! Things blowing up!
2) Yoda. Who'da thunk it?
3) Gosh, this dialogue is terrible.
4) Natalie Portman. Yowza. When did that happen?
5) Wow, they seriously dialed down the Jar-Jar.
6) Oh look, even more aliens. Gee, I hope we don't run out of aliens.
7) Christopher Lee must have gotten a new agent.
8) Now I hate C3P0 for the same reasons I hated Jar-Jar.
9) You promised me nine movies, George. Nine.

!lineDraw bookmarklet

Milov's !lineDraw bookmarklet is in fact the Coolest Bookmarklet Ever.

May 15, 2002

Napster Dead, Outlaw Office Depot

Oops, looks like some of the fancy new music CD protection schemes can be cracked with a magic marker or tape. I suppose we'll now have to outlaw office supplies under the DMCA.

Napster dead in a box. I wasn't too happy when Shawn Fanning was pulling down major VC cash to develop a system that gave artists nothing, but it's still sad to see a firestarter burn out. I particularly like what Cory (at BoingBoing, my "new favorite that was everyone's new favorite eons ago" favorite) had to say:

So I can't really feel too sad for poor old dead Napster. Death was the best it could hope for now. Dead, its name can remain synonymous with revolutions; had it lived, its name would have been synonymous with crap.


Here's an example of how Google can turn on you like a savage, cornered beast. My site is the number one result for "Moveable Type hacks", but only because I misspelled it. The top entries for "Movable Type hacks" are a different story. So enough people have misspelled "movable" to put me at the top of Google, but for those who spelled it correctly I'm nowhere in sight.

I've misgoogled myself. Beware, ye spellers of misspelled spellings.

Search and Expanded Categories

Okay, so after much fiddling and tweaking and turning of levers, I've implemented a beta site search for You can search the text of my weblog posts, or optionally you can search the metadata, which is a series of keywords I enter for a unique post (which defaults to the post title when I'm lazy. I'm often lazy.). Search results will include the metadata and a link to the primary category of each matching post. I have a bit of work to do on the search functionality; specifically, I want to have it search my non-weblog content, like the articles and tutorials I've written, and I need it to do AND/OR search constructs, and I want search request logging so I can see what you people are most interested in. The core MT Search code was written by Jay Allen who's currently cavorting across Europe, which doesn't make me envious at all, nooo.

I've also expanded the category archives greatly, which should give me more flexibility in classifying posts. I'm slowly importing my earlier Blogger-formatted archives into Movable Type so the search engine can index them as well. Of course, the reason for all this is so you, Gentle Reader, can more easily find relevant and related information on this site.

May 14, 2002

Weblogs in the CPD

My old hometown paper, the Cleveland Plain Dealer, has an article on weblogs. Please stay tuned for the end of the world.

Mozilla, DHTML and DOM links

Why Mozilla Rules (Link via Dean)

Steve Champeon: Why DHTML Will Win.

Glish finds a not-quite-DOM-compliant replacement for innerHTML. It should be noted that the key method used here, createContextualFragment(), is not part of the DOM 2 Range spec, but a proprietary Mozilla method. It works, and well at that, but it's not as pure as one might believe. Ahg, close enough.

Rock and Roll

As a reminder that Menlo Park is no safer than anywhere else in the Bay Area, Mother Nature sent a nice 5.2 tremor to the South Bay last night. For about 20 seconds I was frozen by the front entrance, one hand on the doorknob, wishing I had put on pants, while the shock waves rippled through the floorboards. What fun. I wonder if the cameras at Compaq Center caught the upper tiers shaking at the Sharks game.

At least here we only have the open sky above our heads, rather than, say, the Hotel Huntington and Masonic Center.

May 13, 2002

Combining XML and XHTML

Last Friday, I demonstrated how the CSS display attribute can be used to force HTML elements to be rendered a block-level or inline elements. In the example, I used a series of nested SPAN elements and forced them to be displayed as block elements via the HTML class attribute.

More than one astute reader pointed out to me that this approach, while legal, is discouraged by the W3C:

CSS gives so much power to the "class" attribute, that authors could conceivably design their own "document language" based on elements with almost no associated presentation (such as DIV and SPAN in HTML) and assigning style information through the "class" attribute. Authors should avoid this practice since the structural elements of a document language often have recognized and accepted meanings and author-defined classes may not. -- CSS2 Specification 5.8.3

It's probably best to avoid using CSS classes to override the semantic structure of markup, especially where long-established document types like HTML are concerned. There is, however, another option: embedding XML directly into HTML. The ability to combine non-HTML elements with XHTML is limited to a handful of browsers, specifically IE5.x, Mozilla and Netscape 6.2. Hopefully as browsers continue to evolve, we'll see more powerful implementations that allow web developers to do crazy things like render SVG and MathML directly into HTML pages, without the requisite plug-in. For now, we're limited to what the browser can do: styling custom XML element with CSS.

First, ya gotta start with an XML document. is valid XHTML 1.0 Strict, which means it is also valid XML. This enables me to take advantage of XML namespaces to combine my XHTML with other non-HTML element types.

View the source of, and you'll see this:

<html xmlns="" xml:lang="en" lang="en">

The xmlns attribute declares that that default namespace for this element is bound to the XHTML 1.0 specification. This tells any interested processor (like a browser) that the HTML tag and all elements it contains belong to the same default namespace.

Now, let's look at the sample XML from Thursday's post:

For you, most wicked sir, whom to call brother<br/>
Would even infect my mouth, I do forgive<br/>
Thy rankest fault, -- all of them; and require<br/>
My dukedom of thee, which perforce, I know,<br/>
Thou must restore.

If I were to insert this directly into my XHTML page, the browser would ignore the QUOTE, CHARACTER and TEXT elements, and display them without special formatting. Typically, browsers ignore non-HTML elements.

So, let's declare a namespace for these XML elements, by placing an xmlns attribute in the root QUOTE element. This namespace will apply to all elements contained within the QUOTE:

<quote xmlns="">

This particular namespace value is arbitrary. There are guidelines for declaring namespaces; the bottom line is a namespace should be a unique and persistent URI. (Check out how the W3C's XHTML namespace URI points to a placeholder page.)

Once the namespace is declared, I can apply CSS to the non-HTML elements. Simply declare each element as either block or inline as appropriate. Not all browsers can handle this mix of elements; the following example should only work in Netscape 6.2 or Mozilla (IE5 and Opera users should see unstyled text):

PROSPERO: For you, most wicked sir, whom to call brother
Would even infect my mouth, I do forgive
Thy rankest fault, -- all of them; and require
My dukedom of thee, which perforce, I know,
Thou must restore.

Here's the CSS used in the above example:

quote {
  border: 1px outset #cccccc;
  margin: 10px 50px;
  color: #990000;
  font-size: 12px;
  font-family: Courier New,sans-serif;
  padding: 10px;

character {

text {

Admittedly an XHTML document that uses additional XML namespaces does not strictly conform to the XHTML spec. The above example now invalidates my markup. In addition, IE5.x (dunno about 6.0) doesn't acknowlege additional namespaces declared in child elements inside the default namespace. To be compatible with both IE5.x and Mozilla, I need to move my additional namespace up into the HTML element.

<html xmlns="" xmlns:sa="" ...

Declaring all namespaces in the root element of a document is fairly common practice. Notice, however, that I've associated a special prefix for my custom namespace, sa. In order to use elements bound to my namespace, I must use this prefix in the element name with a joining colon:

For you, most wicked sir, whom to call brother<br/>
Would even infect my mouth, I do forgive<br/>
Thy rankest fault, -- all of them; and require<br/>
My dukedom of thee, which perforce, I know,<br/>
Thou must restore.

The namespace prefix is particularly handy for avoiding namespace collisions between elements with the same name. For example, I may want to use a custom TITLE element to contain the title of a movie. A namespace prefix would prevent my TITLE element from conflicting with the HTML TITLE element.

Now I have to go back to my CSS and add the prefix to the element names there, escaping the colon character with a backslash:

sa\:quote {
  border: 1px outset #cccccc;
  margin: 50px 50px;
  color: #990000;
  font-size: 12px;
  font-family: Courier New,sans-serif;
  padding: 10px;


Unfortunately, the W3C validator doesn't like this setup either. If validation is still important at this point, I might want to consider changing my document type from XHTML to pure XML, and include both the XHTML and custom namespaces in whatever root element I choose to begin with. That's a little far to go for a Web page, so for now I'll be satisfied with embedding XML fragments in my XHTML, rather than the other way around.

With this approach, I can create a custom set of elements with meaningful structure, without having to resort to CSS classes to override the established meaning and functionality of DIV and SPAN.

Mozilla 1.0 RC2

I'm late for this train: Mozilla 1.0 Release Candidate 2 is now available.

May 11, 2002

Peninsula Living

Of course, by "tomorrow" I actually meant "Monday."

As some of you have already figured out, I'm no longer a San Franciscan, having moved to sunny Menlo Park last week. As I type this, there are no sirens blaring, no trash littering the street, and my Jeep hasn't been broken into even once since I parked it in my honest-to-goodness-real-thing garage. We have a dishwasher. I haven't lived in a place with a dishwasher since I moved out of my parents' place. We have a back door.

Not that I won't miss the city. It's hard getting used to driving everywhere again. I'll miss being able to hop on a bus to the ocean, or hiking up one block to Grace Cathedral Park. I'll miss the spectacular view we had from our modest little apartment, and feeling like we were explorers in a strange city. But here it's flatter, bike-friendly, the neighbors don't flee in terror when I come down to check the mail, and for once I don't have that awful feeling that the hours of my life are being lost in the commute.

This morning we watched a motorcade of classic Jaguars roll by from our table at Buck's Woodside. It was a Silicon Valley moment.

Megan describes Woodside as "a lot of rich people going 'shh...shh...'" Heh.

May 10, 2002

Block and Inline Formatting With CSS

In yesterday's post, I demonstrated how CSS can be used to separate the presentation from a document's structure (and not its content; are you hearing me yet?). In the example code, I started off with content, then gave that content structure with some arbitrary markup. Then I replaced the markup with browser-friendly XHTML.

The quote element became a DIV, the character a SPAN, and the text a P. DIV and P are block-level elements, meaning they are designed to contain other elements. By default, DIV and P elements begin on a new line. SPAN, on the other hand, is an inline element.

Now, if you view the HTML source of yesterday's post, you'll see this markup for the CSS-formatted example:

This might look something like this (sorry, NS4 users):<br /><br />

<span class="quote">
<span class="character">PROSPERO:</span>
<span class="text">
For you, most wicked sir, whom to call brother<br />
Would even infect my mouth, I do forgive<br />
Thy rankest fault, -- all of them; and require<br />
My dukedom of thee, which perforce, I know,<br />
Thou must restore.

Hey, wait, what happened to the DIV and P? Why did I use only SPAN tags for that last example? And how did I get the SPAN to act like a DIV? Every weblog post here at is formatted as text inside a P element. As a rule, P elements cannot contain other block-level elements, including P itself. So if I were to take the code samples with DIV and P and insert them into my post, I'd be invalidating my site's markup. (Not to mention that some browsers choke nastily parsing nested block elements inside of a P.)

So I had a problem: how do I demonstrate what the code sample should look like in a browser, without invalidating my existing markup? Since the P element can only contain inline elements, switching to SPAN across the board seemed like a good choice. The only trick was to get the SPAN elements for the quote and the text to act like block-level elements.

Fortunately, the CSS-2 spec provides the answer: the display property. By setting the value of display to block, we can force the browser to render an inline element as a block element:

<span style="display:block; background-color:#ccffcc; border:1px dotted #cccccc; padding: 10px;">
This is a SPAN rendered as a block-level element.

This is a SPAN rendered as a block-level element.
Now I can safely demonstrate how the example code might be rendered. The W3 validator doesn't care that we've pressed our SPANs into service as block elements, as long as the element nesting rules are followed.

I like to use display:block with links to create funky rollover navigation bars, without all the JavaScript craziness:

One Fish Two Fish Red Fish Blue Fish
Here's all the HTML:

<span id="funkynav">
<a href="#" onclick="return false;">One Fish</a>
<a href="#" onclick="return false;">Two Fish</a>
<a href="#" onclick="return false;">Red Fish</a>
<a href="#" onclick="return false;">Blue Fish</a>

And here's the CSS used:

#funkynav {

#funkynav a {
  border-bottom:1px solid #ffffff;

#funkynav a:hover {

That's it.

So before you start going all DIV-and-JavaScript crazy, consider what CSS and HTML already provide.

Unless you're stuck with Netscape 4.

May 9, 2002



CSS: Structure from Presentation

CSS is for separating structure, not content, from presentation.

This is content:

For you, most wicked sir, whom to call brother
Would even infect my mouth, I do forgive
Thy rankest fault, -- all of them; and require
My dukedom of thee, which perforce, I know,
Thou must restore.

This is content with structure:

For you, most wicked sir, whom to call brother<br/>
Would even infect my mouth, I do forgive<br/>
Thy rankest fault, -- all of them; and require<br/>
My dukedom of thee, which perforce, I know,<br/>
Thou must restore.

Note how the markup simply gives some generic structure to the content. The markup is not the content. Notice also how, even though we now have structure, we don't really have any presentational information, with the possible exception of the BR elements to denote line breaks.

Now, let's translate this into something a browser can understand.

<div class="quote">
<span class="character">PROSPERO:</span>
<p class="text">
For you, most wicked sir, whom to call brother<br/>
Would even infect my mouth, I do forgive<br/>
Thy rankest fault, -- all of them; and require<br/>
My dukedom of thee, which perforce, I know,<br/>
Thou must restore.

This is semantically similar to the earlier example, except we're now using generic XHTML elements in place of the arbitrary XML markup. This decision is not without consequences though, as we've decided that quote and it's embedded text are to be treated as block-level elements DIV and P, and will be displayed in the browser as such. If we wanted to keep all text inline (i.e, with no line breaks), we could have specified SPAN tags across the whole of the structure. More on that tomorrow. Now we have something a browser can parse.

Now, by applying CSS, we have have structured content with presentation:

div.quote {
  border:1px solid #cccccc;
span.character {
p.text {

This might look something like this (sorry, NS4 users):

PROSPERO: For you, most wicked sir, whom to call brother
Would even infect my mouth, I do forgive
Thy rankest fault, -- all of them; and require
My dukedom of thee, which perforce, I know,
Thou must restore.

This illustrates a common misunderstanding about CSS. CSS is for separating structure, not content, from the presentation. Markup is meant to give meaningful structure to content. The content can come from a database or text files; the structure from page templates, a CMS or XSL transformation. Keeping your content free of meaningless structural elements allows you to pour your content into another structure suitable for different devices. CSS allows you to apply client-appropriate and easily-varied visual style to that structured output, without having to alter your markup.

May 6, 2002

javascript: is deprecated. Don't use it.

Repeat after me:

javascript: is deprecated. Don't use it.
javascript: is deprecated. Don't use it.
javascript: is deprecated. Don't use it.

Absolutely every link in the list of this year's Webby Award nominees is completely dependent on JavaScript being turned on:

<a href="javascript:winLaunch('')"></a>

People, please, stop using the javascript: protocol in your links. This has been common knowledge since, oh let's see, at least the last four years. At least allow people to follow the link if JavaScript is disabled. It's not rocket science:

<a href="" onclick="winLaunch('');return false;"></a>

At the very least, use <NOSCRIPT> to offer alternatives to JS-dependent content. Or put a big eye-catching notice telling vistors they need JavaScript enabled. Unless you don't actually care about users being able to, you know, use your site.

Scalable Vector Graphics (SVG) 1.1

Scalable Vector Graphics (SVG) 1.1 is now a W3C candidate recommendation. SVG allows you to create Shockwave-like embeddable graphics and animations that are scriptable with DOM and JavaScript. Unfortunately, we've got a long way to go before SVG is natively supported in browsers. For example, you can't enjoy the amazing, incredible, dazzling SVG widgets and demos at Kevin Lindsey's site unless you have Adobe's SVG Viewer plug-in. Mozilla's built-in support of SVG is useable but a long way from being complete (and won't support any of Kevin's demos, because the Adobe plug-in requires the SVG to be <EMBED>-ed). Must. Be. Patient.

Familiarity Breeds Bad UI

Megnut @ O'Reilly: The Sanctity of Elements, or Why You Shouldn't be Double-clicking in a <textarea>

Petitioning Google for REST

Paul Prescod is petitioning Google to implement a REST-based interface to its API.