Cats and Dogs, Living Together

Civilization is coming to an end. No, really. Consider the following: last Tuesday’s post, which was about tedious markup language minutiae, got seventeen comments. The post right before that, which was about the sleazy goings-on at a bachelor party, got a grand total of one comment. Call me crazy, but when esoteric XHTML issues are considered to be more important than girls in short-shorts, something has gone Seriously Wrong.

Not that I’m complaining about my little three-month experiment with comments. So far the level of discourse has been far better than expected. Tuesday’s post was a perfect example: people who I greatly respect were writing in and discussing the issues at hand in a thoughtful and informative manner. It’s like freakin’ NPR over here. Note that at the same time, poor Mark Pilgrim posted about his experience installing Windows XP and received over 200 helpful comments informing him that “your an idiot” or advising him to “get a Mac.” Yeah, Mark — what are you waiting for?

In other news: last weekend was my ten-year high school reunion. Last year Brian had to practically drag me to my five-year college reunion, which turned out to be a lot more fun than I thought. So I was definitely looking forward to the high school reunion, and the reunion did not disappoint.1 My only major mistake was in choosing to host a small post-reunion party, thus giving Nancy the opportunity to snicker at the contents of my bachelor’s fridge.2 I swear that it was full of vegetables just a couple of days before…

Finally, I’ve started a new job with Chordiant Software. It’s not earthshaking news or anything (“FOR IMMEDIATE RELEASE — CHORDIANT SOFTWARE, INC. ACQUIRES WAYWARD TECH WRITER…”), but I’m pretty excited about it nonetheless. New people to meet, new projects to work on, new software to play with — and a supply closet fully stocked with Swingline staplers. Pinch me!

1. Although unlike last year’s college reunion, nobody proposed marriage to Sherry. Seems like an oversight, but what can you do?

2. Three beers, assorted condiments, and some cheese.

Bulletproof XHTML

Is your XHTML bulletproof?

Jacques Distler‘s is. So is Yuan-Chung Cheng‘s. Dave Shea‘s working on it.

The day’s just wasting away, isn’t it?

Orthodoxies

I keep my RSS subscriptions fixed at a manageable 20; Jeffrey Zeldman‘s got a permanent spot on my list. Zeldman is a superb designer and a hell of a writer. I love Zeldman bunches.

And yet as often as I find his comments on web standards illuminating, occasionally I’m forcibly reminded that deep down Zeldman is a Technology Evangelist. Evangelists are great at efficiently spreading new ideas throughout the community… but the flip side is that they often have trouble departing from certain orthodoxies.

For a prime example of this, see Zeldman’s Web Design World keynote. There’s plenty of good stuff in the keynote overall, but this particular slide needs addressing:

  1. “XHTML is XML that acts like HTML in browsers.”

    Better to replace “acts like” with “is”, given that nearly all “XHTML” websites are actually parsed as HTML by all currently available browsers. (I suppose there are a rarified few sites that actually can be parsed as XML by certain highly advanced browsers, but this hardly counts as statistically significant.)

  2. “It also works as expected in most Internet devices (Palm Pilots, web phones, screen readers).”

    There are some who would dispute that. Apparently many real-world mobile devices happily support old-skool HTML cruft (table-based layouts, the <font> tag) while ignoring the products of our more enlightened era (XHTML Basic, CSS). Weird but true.

  3. “It’s as easy to learn and use as HTML.”

    Except you have to teach people about closing tags, proper nesting, encoding all your ampersands, and so on. Meanwhile, people who feel like writing tag soup HTML can just whip out a text editor and go. (Then again, considering the tremendous popularity of tag-soup XHTML on the web today, maybe this is a distinction without a difference.)

  4. “It’s the current recommended markup standard (replaces HTML 4).”

    The closest the spec comes to saying this is, “The XHTML family is the next step in the evolution of the Internet. By migrating to XHTML today, content developers can enter the XML world with all of its attendant benefits, while still remaining confident in their content’s backward and future compatibility.” That’s a fine marketing blurb, but it’s not an official announcement that HTML 4.01 is deprecated.

  5. “Because it’s XML, it works better with existing XML languages and XML-based tools (SVG, SOAP, RSS, SMIL, XSL, XSLT, databases, etc.).”

    This is pretty hand-wavy. On the server side, you can easily transform your backend data into valid XHTML, but you can also transform it into valid HTML 4.01 Strict just as easily. Heck, some people do both. On the client side, there are a tiny, tiny fraction of super-geeks who embed SVG or MathML directly in their valid and properly MIME-typed XHTML pages. These super-geeks are the only people in the world who have to present outward-facing XHTML; the rest of us are just fooling around.

  6. “It brings consistency to web documents that was missing in HTML.”

    I assume this means “more consistency in coding style.” XHTML theoretically enforces more consistency due to its more rigorous syntax… but since the vast majority of people can’t be bothered to produce valid XHTML code, this benefit is somewhat obviated.

  7. “It’s a bridge to more advanced (future) XML languages and applications and perhaps to more advanced versions of itself (XHTML 2?).”

    Heh.

The presentation then goes on to cite nine websites that are using structured XHTML and CSS, including some big names such as ESPN and Wired. None of the sites serve up their pages as application/xhtml+xml to browsers that accept this MIME-type, which means that each site is being treated as… you guessed it, good old fashioned HTML. And that’s a damn good thing, because four of the sites have invalid home pages, and four others have invalid secondary pages just one click away. The only site diligent enough to pass the “Laziness Test” is the CSS Zen Garden. (To his further credit, the creator of the Zen Garden is considering the MIME-type issues as we speak.)

Anyway. The point is not that cutting edge designs are bad; they’re not. The point is not that “Evan hates XHTML”; I don’t. XHTML allows you to do some amazing things that you can’t do with HTML. Unfortunately, due to the dreadfully primitive state of XML browsers and tools, there’s really nobody using XHTML for anything that you can’t do with HTML.[1]

The real problem is that XHTML is being touted as a replacement for HTML. It’s not. XHTML is a different technology that suits different purposes. There are a lot of influential people who are blurring this distinction, and I’d like to think that they know better.

1. Except for a few oddball physicists, mathematicians, and chemists, but who’s counting them?

Nerd Bachelor Party

Last Saturday, my college friend Russ was in town from Colorado for his bachelor party. It was awfully nice of Russ to select his Bay Area friends to host his bachelor party over his pockets of friends in Colorado, Southern California, and the Pacific Northwest. Take that, Portland! Then again, for all I know he had multiple bachelor parties. Maybe Russ was two-timing us. But why would he bother — how could anyone throw a better bachelor party than a collection of Harvey Mudd alumni? Damn skippy.

I arrived at dinnertime. Russ and the rest of the gang had been paintballing earlier that day, as evidenced by numerous welts. I asked where we were going for dinner. “Ciao Bella,” said Kevin, our ringleader. Ciao Bella? “It’s a restaurant up in Ben Lomond where the waitresses do cute little dances and sing songs and stuff. I’ve ridden up there on my bike before. It’s fun.”

What I thought was, “Hmmm. So we’re going to go to some dingy biker nudie bar in the Santa Cruz Mountains. Greeaat.” Of course I didn’t say that — I covered by saying, “Hmmm. So what kind of food do they serve?” Russ and Kevin gave me a funny look. Ciao Bella. Aha… I’m guessing, like, Italian food or something.

Fortunately, Ciao Bella turned out to not be a dingy biker nudie bar. Ciao Bella is a little hard to describe, actually.

There’s a genre of Restaurants That Have Crap on the Walls: Chili’s, Applebee’s, TGI Friday’s, and so on. Each of these franchises has a contract with the Wall Crap Factory in Schenectady, which churns out vast quantities of wall crap for each franchise: wacky pictures, plastic animal heads, snow globes, beach paraphernalia, and so on. Each restaurant can therefore cover the surface area of its walls with the precise fraction of wall crap that has been scientifically determined to provide a “fun” and “kitsch” atmosphere without going overboard and looking unclean or threatening.

Well, Ciao Bella has no problem with appearing unclean or threatening; the entire restaurant is slathered in wall crap several layers thick. A dusty 60s-era TV facing a 30-year-old bench car seat (with seat belts), a white porcelain sink used as an ashtray, a golden statue of a man wearing fins on his feet… and that’s just in the tiny outside smoking area. A narrow 4′ x 1.5′ slit in the wall connects the smoking area to the kitchen, presumably so that the staff can sneak out for quick smoke breaks. Maybe smoking keeps you skinny after all.

The entirely female wait staff can be described as “perky, athletic Goth.” There was nothing nudie bar about them, other than the fact that each waitress had a cute nickname such as “Tiger” or “Peanut”. Our waitress’s nom du service was “Agent 99”. There were a couple of male busboys that looked more yuppie than the waitresses: conservative haircuts, button down shirts, and no visible jewelry. However, at least one of the busboys had an elaborate sun tattoo peeking above his collar on the back of his neck, so I don’t think they’re fooling anybody.

Although the food was Spaghetti Factory-ish, the table wine was good. As it turned out, I should have ordered more wine, as Kevin generously picked up the tab. And the entertainment and atmosphere was top notch. As Kevin had advertised, every once in a while a waitress would spontaneously start singing — something in Italian, a song from a musical, a pop song. They had very nice voices that carried well through the restaurant. We were also treated to an energetic dance routine involving all the waitresses and Tad, the owner. We didn’t bring any cameras, but fortunately the SAGA North Ski and Snowboard club did take a couple of pictures last year, so you can get the general idea. On our particular evening, Tad was wearing shiny blue metallic shorts with some sort of garter belt contraption. And, as we discovered, red metallic thong underwear.

As the evening came to a close, Agent 99 offered to sign our wine cork for us, but we insisted that she sign our bachelor instead. “Agent 99 was here.” She gamely tried, but the thing about guys is… well, guys are hairy. Throughout our teens and twenties we grow progressively hairier — as teenagers, we think this is a good thing, but soon enough we start hoping that we hit a certain acceptable level of hairyness and then stop. Unfortunately, Russ shot past this level at about the age of fourteen. Agent 99 was therefore unable to sign Russ, not even with a Sharpie. She complained that her pen was inadequate to the task, but I think it’s a poor artist who blames her tools. We suggested that she try signing Russ’s (slightly less hairy) forehead, but spoilsport Russ mentioned something about an upcoming wedding and photographs and stuff. What-ever.

We then bid arrivederci to Ciao Bella and headed back down the mountain to San Jose. I have to admit that this made me sad — I had a bit of a crush on Agent 99, but she’s an alternative Santa Cruz Mountains type and I’m a straightlaced Silicon Valley nerd type, so there you have it. Now — I’m willing to grant that A) God exists and B) He has a wicked sense of humor. In fact, I’m convinced of both. However, God’s wicked sense of humor does not extend to Wacky Romantic Comedy, and for that reason Agent 99 and I would never work out.

The next stop was Sugars in San Jose, which is kind of like Hooters, but with coffee. I was of two minds about this. On the one hand, as most of my friends know, I’m a bonafide lefty feminist. On the other hand, I also like underdogs. Apparently the neighbors and the city hate Sugars and are trying to put it out of business through the usual methods: abusive code inspections, overly-conscientious OSHA reviews, and so on. If a man has a dream, and that dream involves having scantily-clad women serving coffee, who am I to stand in the way?

Sugars turned out to be a hole with techno music blaring, filled with assorted beady-eyed San Jose scuzzoids and creepos. Gang tattoos abounded on both the patrons and wait staff. The waitresses were friendly enough, but their outfits (red tanktops and black short-short-shorts) were extremely unflattering even in dim light. The four dollar coffee was mediocre but served in small portions. Our waitress gave us a pack of unpleasantly sticky cards, and so the six of us huddled around our table, drank our one coffee, and played a Russian card game. I actually didn’t do too badly at this new card game — maybe because I was focusing intently on the cards. Or maybe it was because I’m part Russian. At midnight, my fellow San Jose scuzzoids and I slunk out of Sugars in search of new entertainment.

We eventually found ourselves at South First Billiards. I’ve been there a couple of times, and I’m always surprised at how clean and well-lit and airy and spacious it is. Most of the tables were occupied, but the architecture of the place is such that it didn’t look that way. Hmmm. I just dunno how I feel about a pool hall where the air is clean, where the waitress brings you beer promptly and with a smile, and where you’re not constantly bumping the people at the next table with your cue.

After a few games of pool, it was about that time where the SJPD starts marshalling in force to clear out the downtown area. So it was home again, home again, jiggety-jig for us. Overall, I had a good time. But of course I don’t get out much. In any case, here’s hoping Russ had a good time too — and I wish him and his bride-to-be Holly all my best. Next time you’re in town, Russ, we’ll get you some better coffee. And maybe we’ll find a waitress with one of them NASA pens.

Linkdump: Contrarians and Barbarians

  • Fortune Magazine: Is a Futures Market on Terror Outlandish?

    Yet another mainstream publication stumbles upon Salon.com’s patented technique of writing contrarian articles that trample both logic and good taste in order to draw a few extra readers. On message boards this is called “trolling“; on Madison Avenue, this is called “guerilla marketing”. Dude, Fortune — when the Cato Institute is crapping all over your market-based solution, it’s time to pick up your marbles and go home.

  • Speaking of good ol’ contrarian Salon.com, it turns out they’re (surprise!) rather enamored of the movie Gigli. Although reviewer Charles Taylor deems it a “minor failure”, the film still “deserves credit for its refreshingly frank sexuality.” Heh. If “It’s turkey time! Gobble, gobble!” constitutes “refreshingly frank sexuality”, you Earthlings are straaange cats indeed.

  • John Gruber solves his labor shortage problem in Code Monkey:

    See, back in 1998 I became the owner of a South American woolly monkey, whom I named Paco, with the intention of training him to assist in my freelance graphic design work. Everyone told me this was a terrible idea, that it would not work, that at the very least I would need a chimpanzee or orangutan, that a mere monkey would never be able to do graphic design.

    Everyone in the Bay Area is worried about losing their programming jobs to cheaper labor from overseas. Meanwhile the real danger is lurking right around the corner, brandishing a banana.

  • Darren Barefoot and his Hall of Technical Documentation Weirdness: “Note that I’m not looking for just bad technical writing–there are plenty of examples of that. I’m looking for the inexplicable, the surreal and the strange.” By the way, if you’ve somehow gotten it into your head that all young male technical writers are as suave and handsome as this Darren character… well, you’d be dead right.

  • Speaking of suave and handsome, take a gander at ESPN’s Eric Karabell and DiveIntoMark’s Mark Pilgrim. Separated at birth?? We report, you decide.

  • The Onion, NPR Listener Acquires Kick-Ass Tote Bag
    (scroll to bottom):

    “If I knew listening to Morning Edition every day before breakfast was gonna get me this cool bag, shit, I woulda sent them money a long time ago.” Hasaji added that Renee Montagne’s insightful interview with author Diana Abu-Jaber was “totally off the hook.”

    I think we would all have to agree that Renee Montagne is indeed “totally off the hook.” Still, she ain’t got nothin’ on my Nina.

  • Finally… in case you were wondering, it turns out that Xena Is the Very Model of a Heroine Barbarian:

    Xena:

    I am the very model of a heroine barbarian;
    Through Herculean efforts, I’ve become humanitarian.
    I ride throughout the hinterland — at least that’s what they call it in
    Those sissy towns like Athens (I, myself, am Amphipolitan).
    I travel with a poet who is perky and parthenian
    And scribbles her hexameters in Linear Mycenian
    (And many have attempted, by a host of methods mystical,
    To tell if our relationship’s sororal or sapphistical).

    Chorus:

    To tell if their relationship’s sororal or sapphistical!
    To tell if their relationship’s sororal or sapphistical!
    To tell if their relationship’s sororal or sapphisti-phistical!

Yup, I’m out.

Here’s Some Green Ink

Did I say back next Thursday? I meant back next Tuesday.

Today’s business is to wish a hearty Happy Birthday to my friend Marissa. Welcome to your second quarter-century, kiddo — it’s all sagging, mysterious weight gain, and other instances of decrepitude from here on out. Yes, decrepitude. I, for one, have discovered that on a good morning I can run a little over a mile before collapsing in a gasping, wheezing heap. For crying out loud, I was on the varsity soccer team.1 This sucks.

But hey, here’s what sucks worse: somebody decided to give M’ris a a big flaming sack of poop for her birthday. See, Marissa had mused that while writing is a difficult profession, so are all the other professions out there — and that rather than overdramatizing our pain-as-writers, we should take care of business as best we can and move on. Just like nurses, carpenters, Marines, and so on. But no — along comes this gentleman, who insists that no, no no, my pain-as-a-writer is super-special after all. (Fortunately, M’ris can take care of herself just fine.)

This all begs the question — why are people so awfully sensitive about their own writing?

One theory might be that writers are necessarily sensitive, delicate souls who therefore wilt under the cruelties of rejection letters, bad editors, and mean family members.

The problem with this rather romantic theory is that most writers in the Real World aren’t like that at all; or if they are, they’ve learned to deal. In my experience most professional writers quickly develop a thick, crusty shell for protection. If a critique or edit is good, you think about it and incorporate it; if it’s crap, you ignore it (assuming business conditions permit). End of story.

Conversely, non-professionals are usually far more sensitive about their writing than professionals. Take it from me — when an engineer writes a tech paper or a specification, getting him or her to sit down and go over some edits is like pulling teeth. It happens over and over again. One minute, we’re cleaning up some API verbiage; the next minute, we’re in a symposium on the Soul of the Postmodern American Writer with our special guest, Jonathan Franzen.

After several years, I think I’m starting to understand this behavior. Writing is always an ego-intensive process; whether you’re writing fiction or an API specification,2 there’s always a lot of you in there. It’s just that the main difference between professionals and non-professionals is that non-professionals don’t learn how to detach their ego when it needs to be detached.

For this reason, every writer and editor needs a bag of tricks for dealing with bruised egos. Here’s one trick I’ve learned: never edit with red ink. Red ink makes people angry and defensive. Maybe it reminds them of bad experiences in high school English… or maybe red is just an angry color. Either way, I recommend switching to green ink. It makes a world of difference.

However, I’m still up in the air about smiley faces. On the one hand, smileys have powerful ameliorative properties. Just think! — you can transform a proofreading mark that means “This whole paragraph sucks, and we’re dropping it,” to mean “This whole paragraph sucks, and we’re dropping it — but I mean that in the nicest of ways.”

On the other hand, I can’t bring myself to use smileys. Hey, I’m just not That Guy.

1. I didn’t play very much, but still.

2. In some organizations the difference between the two is not as large as you might think.

Back Thursday

Got some bad news earlier today. A very nice lady who I’ve known for three years died of a stroke this weekend. I had gotten to know her through Bill Fredlund’s The Making of the Western Mind classes. She was a vivacious, intelligent, and very fit middle-aged woman — and now all of a sudden she’s gone.

I was all set to write a fluffy little entry this evening about my recent experiences setting up a wireless network in my apartment. But now my heart’s not in it. Maybe in a couple of days.

XHTML2 Explorations, Part II

In the last installment of XHTML2 Explorations, we touched on how XHTML2’s attribute collections provide a rich variety of behaviors for nearly all elements. Today’s installment focuses on the individual elements themselves. As with Part I, this post does not discuss “well-known” XHTML2 concepts.1

New Paragraph Model

XHTML2 gives us a new twist on our old friend the <p> tag. In previous versions of HTML and XHTML, you could not nest other block elements inside a paragraph. Now you can nest any block element except for another paragraph. In other words, you can now consider a list or table to be semantically part of a paragraph.

This leads to an interesting result (first brought to my attention by Jacques Distler). Consider the following (invalid) markup2:

  <p style="color: red">
    Why is Gordon better for Dana than Casey?
    <ul>
      <li>Knows mayor Giuliani</li>
      <li>Can dress self w/o assistance from Wardrobe</li>
      <li>Obvious physical prowess</li>
      <li>Two!! post-graduate degrees</li>
    </ul>
  </p>

Since a paragraph can’t contain lists, a standards-compliant browser would end the paragraph just before the start of the unordered list. Thus the words, “Why is Gordon…” would be colored red while the list items would remain unchanged.

However, under XHTML2’s new paragraph model this code is valid, and everything inside <p> and </p> would be red. I have to admit that from a coding standpoint, I like this. If nothing else, it matches my naive expectations a little better. (“Hey, why isn’t my list red?” the newbie web designer wonders…)

From a semantic standpoint, I’m a little less sure about this. I usually don’t think of my tables as being nested inside my paragraphs. Neither does Framemaker, for that matter. Is Framemaker broken? Am I broken? Well, maybe. The good thing about this model is that it’s totally optional — you can nest stuff inside paragraphs, or not. Works for me.

Scripting

You can now nest <script> elements and process them like the <object> element. If the browser understands the parent script, execute it; otherwise go on to the child script(s). It’s a nifty model, albeit one that is not backwards compatible. Whoops — I forgot, it’s not fair for us to harp on that. Sorry. Anyway, the model itself looks good, particularly if you want to script with multiple languages. The spec does take great pains to mention that there are scripting languages besides Javascript, such as… type="text/x-perl". Hmmm.

There is also a new declare attribute for both scripts and objects. This boolean attribute specifies whether the script or object is a “declaration only”, meaning that it is not to be processed until the user initiates some sort of action. And speaking of actions, there’s a brand-new events model defined by the XMLEVENTS standard (which is pleasantly short and easy to read). XMLEVENTS allows you to set any element as the observer or handler for standard DOM events. It also provides a generic <listener> element that can pass events off to handlers. The XMLEVENTS spec looks to be far more comprehensive and flexible than our current model, which involves slathering our code with onmouseover attributes and whatnot. The only catch is that XMLEVENTS has totally replaced the existing model, which means our current scripts all just went POOF!. Argh, there I go again…

The spec also declares the death of document.write:

Note that because of the XML processing model, where a document is first parsed before being processed, the form of dynamic generation used in earlier versions of HTML, using document.write cannot be used in XHTML2. To dynamically generate content in XHTML you have to add elements to the DOM tree using DOM calls [DOM] rather than using document.write to generate text that then gets parsed.

Well, that’s fair enough. The W3C seems to be saying, “Look guys, this is XML here. Not HTML, not some halfway-step that decays back into friendly tag-soup if you make a mistake — this is the real stuff here.” I suppose the real question is whether they’re going to forbid XHTML2 to be served up as text/html. I can’t find any discussion of MIME-type issues in the current spec, so it’ll be interesting to hear the W3C’s final decision on this.

Miscellany

  • There’s a new <quote> element for marking up inline quotes. Unlike its ill-fated predecessor <q>, the <quote> element does not automagically insert localized quotation marks. “We give up,” the W3C is saying. “Insert your own damn quotation marks.”

  • Tables are relatively untouched. The one noticeable change is that the summary attribute is now an element, presumably to provide a facility for richer descriptions. The spec makes no recommendations for how to display this content in visual browsers. I think we can assume that the default should be display: none, but you never know.

    I also noticed that the spec requires tables to have one or more <tbody> elements… but as it turns out, this requirement dates all the way back to HTML4! I must say this comes as quite a shock, given that the validator happily accepts pages with <tbody>-free tables as HTML 4.01 Strict. I’m looking at the spec again right now, and I’m still a bit freaked out over this. Do I not know how to read the spec? Am I hallucinating because I skipped lunch in preparation for the big Fourth of July BBQ? We report, you decide. (Edit: it turns out I can’t read the spec. Never post while under the influence of carbohydrate deprivation.)

  • Finally, Ruby text is now a standard module. This is good news for hundreds of millions of Asian-language speaking users… at least, I think. Actually, this begs the question: if Ruby text is a fundamental component of Asian typography, why are we forcing Asian users to go all the way to XHTML2 to use it? It seems like it would be useful and straightforward to retrofit Ruby text onto HTML. Then again, since HTML is officially a dead specification, the point is moot.

Conclusions

Errr… who needs conclusions? It’s barbeque time. Happy Fourth!

1. My definition of “well-known” is “I remember hearing about it vaguely on someone’s blog somewhere.”

2. As for whether the pro-Gordon argument is as invalid as the markup… well, I leave that as an exercise for the reader.

XHTML2 Explorations, Part I

You read that right: “XHTML2 Explorations”. Yes, the fun never stops here at goer.org.

I’ve decided to take a closer look at XHTML2, or more specifically, XHTML2 Working Draft 6. I’ll admit that I haven’t done a good job slogging through the thousands of messages on the W3C lists. I’m just a casual observer.

Fortunately, there’s been plenty of weblog chatter over the <object> replacing <img>, <cite> getting dropped and then added back, the excitement over <blockcode>, the battle over the style attribute, navigation lists, the new <h> and <section> model, the “href on everything” model, and more. The Alphas have been discussing these issues for months, and we Gammas have been well-served by just listening in.

But even with all the healthy public discussion, XHTML2 is a big specification (430 KB and counting). At least for my own edification, it’s time to see how deep the rabbit hole goes.

A Swarm of Attributes

XHTML2 provides a huge number of common attributes that are divided up into collections. Most XHTML2 elements accept attributes from all collections. The most well-known example of this is the “everything is a hyperlink” concept, wherein you can turn any XHTML2 element into a link by applying the href attribute.

But of course there’s much more. Consider the set of “common” attributes in HTML 4.01: there’s id, style, class, dir, lang, title, and the “event” attributes (such as onmouseover). This yields a little over 15 attributes, depending on how you’re counting. In contrast, XHTML2 already provides around 30 common attributes. Let’s take a closer look.

The Edit Collection

The Edit Collection provides an edit attribute with four allowed values: inserted, deleted, changed, and moved. Presumably if something is moved, you can specify where it moved to by using the href attribute. There’s also a datetime attribute for specifying the timestamp, the format of which is defined in XML Schema, which references ISO 8601, which has since been revised. Whew.

The default presentation should be display: none for deleted markup, while the other three types should be displayed as-is. Note that if we assume that the XHTML2 browsers of the future will have solid CSS2 support, then we can write:

  *[edit="deleted"] {
    display: inline;
    color: red;
    text-decoration: line-through;
  }

I’ll admit I like the idea of having a simple change record facility. However, there doesn’t appear to be an editedby attribute, which seems like a bit of an oversight.

The Embedding Collection

Through the Embedding collection, each element can have a src attribute. The browser attempts to replace the element’s content with the embedded file or resource. If the embedding fails for some reason, the browser proceeds to process the contents of the element. The spec provides an example involving a table:

  <table src="temperature-graph.png" type="image/png">
    <caption>Monthly temperatures</caption>
    ... (lots of table rows and cells) ...
  </table>

The spec also declares,

Note that this behavior makes documents far more robust, and gives much better opportunities for accessible documents than the longdesc attribute present in earlier versions of XHTML, since it allows the description of the resource to be included in the document itself, rather than in a separate document.

I scratched my head over the new src attribute for a while… but if you think of it as a replacement for the longdesc attribute, then it sort of makes sense. A couple of points, though.

First, a quibble with the W3C’s example — I’m not quite sure how replacing a perfectly good XHTML table with a PNG image constitutes a great leap forward under any circumstances.

Second, the W3C recommends:

This collection causes the contents of a remote resource to be embedded in the document in place of the element’s content. If accessing the remote resource fails, for whatever reason (network unavailable, no resource available at the URI given, inability of the user agent to process the type of resource) the content of the element must be processed instead.

Maybe I don’t understand this statement correctly, but I take the “instead” to mean that browsers should not continue to process content if the remote resource is accessible. If so, I certainly hope that the browsers ignore this recommendation. The browser doesn’t need to display the child content directly, but it needs to process the entire document and provide access to the child content somehow. Otherwise, accessibility gets worse, not better.

Finally, this concept opens up all sorts of interesting UI issues. Take the <table> example above. If I use my browser’s “Find Text In This Page” function, will the browser search the text in the table cells? How will it highlight successful matches?

The Cite Attribute

The Hypertext collection permits any element to have a cite attribute. At first glance, I thought that this made the <cite> element redundant. But as Mark Pilgrim points out in Semantic Obsolescence:

“No, the cite tag and the cite attribute are not the same thing. The cite attribute is a URL; the cite tag is wrapped around actual names within your text.”

Fair enough. However, I’ve been thinking that this might be an oversight on the part of the W3C, and the cite attribute should be allowed to contain arbitrary text. For example:

  <h1>Ask Dr. Science!</h1>

  <p>Q: Dr. Science, why is the sky blue? -- Ashley, age 8</p>

  <p>A: Glad you asked, Ashley!  The answer is simple, really:</p>

  <blockquote
    cite="Jackson, J.D. 1975. Classical Electrodynamics, 2nd. ed. 
          New York: John Wiley and Sons">
  <p>
    The scattering of light by gases, first treated quantitatively by Lord
    Rayleigh in his celebrated work on the sunset and blue sky, can be 
    discussed in the present framework.  Since the magnetic moments 
    of most gas molecules are neglible compared to the electric dipole
    moments, the scattering is purely electric dipole in character.  In 
    the previous section we have discussed the angular distribution and
    polarization of the individual scatterings (see Figure 9.6).  We 
    therefore confine our attention to the total scattering cross section
    and the attenuation of the incident beam.  The treatment is in two 
    parts...
  </p>
  </blockquote>

The cite attribute provides an elegant way to scope sections of a document as belonging somewhere else, so why limit it only to stuff on the web? As for the <cite> element, it would still be good for explicitly marking up citations (such as the ones found at the end of a journal article). Well, just a thought.

New LinkType Options

The rel attribute, once the sole province of the <link> element and <a> element, is now universal. The allowed values are defined by the LinkType data type. There are three new options:

  • parent: You may now specify a link as a parent document. Strangely, you can’t specify your children or siblings. After all, it’s kinda hard to construct a full tree without information about the children. Oh heck, let’s just say it: won’t somebody think of the children?

  • meta: The link “provides metadata, for instance in RDF, about the current document.” This allows you to place your metadata directly in the body content of your document. Not sure why you would want to do this as opposed to using the good old fashioned <meta> tag, but ours is not to question why.

    Speaking of <meta> element, the spec states that “A common use for meta is to specify keywords that a search engine may use to improve the quality of search results. When several meta elements provide language-dependent information about a document, search engines may filter on the xml:lang attribute to display search results using the language preferences of the user.” The idea that people will provide accurate keywords in the first place, let alone scope these keywords appropriately according to language, seems a quaint notion at best.

  • p3pv1: When I first read this, the first thought that popped into my head was, “What’s the ‘v1’ doing in there?” The second thought that popped into my head was, “What’s the p3p doing in there?” I have no idea why we would want to reference a particular technology here, let alone a particular version of a particular technology. The W3C should rename this one to “privacy” post-haste.

Note: Part II is now available.

I Want A Button

I want a button in Mail that automatically adds contacts to Address Book. Right now Mail has an “Add Sender to Address Book” function, but all it does is add the email address. I want the street, the city, the zip code, the phone numbers… everything.

Some emails include an “electronic business card” as an attachment, usually in a format such as .vcf. Many email applications allow you to drag-and-drop these .vcf files directly into your local address book, which is kind of nifty. However, any enthusiasm we might feel for .vcf attachments must be tempered by the fact that:

  • Many people find them to be annoying.
  • They present a security risk.
  • Most people don’t use them. (I certainly don’t).

Now, what many people do use is a plain text signature:

James Q. Workerbee
ABC Industries, Inc.
12345 Lakeside Dr.
Pleasantville, CA 90021
Tel: 888-555-1234 x567
Fax: 888-555-1021

This certainly isn’t beautifully structured data. It would be a lot easier to retrieve the information if we had standard for, say, passing this information in the email headers or tagging this as XML.1. That solution would be a lot easier and more fun for the programmers. But this solution depends on:

  1. Deciding on a standard.
  2. Waiting for email applications to implement the standard.
  3. Hoping that users A) notice that this option is available and B) change their behavior in order to make use of the standard.

Rather than all that, let’s take advantage of the thing that users do already. This won’t be easy, because plain text signatures are poorly structured. Still, a phone number looks different from a street number, which looks different from a firstname and lastname, which looks different from arbitrary text, and so on. A cell phone number often starts with c:, cell:, m:, or mobile:. We don’t have million-dollar markup to go on, but there is some structure here.

Anyway, back to The Button. When you select the button, the parser makes its best guess at person’s contact information. An Address Book window appears with the information filled in. You can then save the information, edit it, or dismiss it unsaved (if the parser’s results are total garbage). As long as the failure rate is low enough, this would be a pretty sweet little feature. Admittedly, it’s not the easiest application feature to build. But ladies and gentlemen, we can build it. We have the technology. Mail.app will be that application. Better than it was before. Better… stronger… faster…

Whoops, got carried away there.

1. For all I know there are standards for doing this, in which case Step #1 is obviated.