WTF of the Week

This week’s award goes to Apple’s Mail.app for generally sucking at life.

More specifically, it took 12K worth of HTML in order for a correspondent to say this:

Hi,

I am looking for a way to bring in my passwords for websites that I have been using in Firefox.

Aloha,

[name withheld]

__________________________________________________________

[contact info in sig removed]

Highlights from the 11.5K of extraneous HTML code in the message:

SPAN class=”Apple-style-span” style=”border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; “

along with

P style=”margin: 0.0px 0.0px 0.0px 0.0px”

Note the multiple “0px” values. CSS specifies that 0 requires no units, so that’s two wasted characters (at minimum) every single time it occurs. In the second case, Mail’s HTML generator has wasted 22 characters (and that string occurs several times in the message). Furthermore, good programming practise dictates that you don’t generate output for empty attributes. Since a SPAN tag is an inline element, it will never render with a border unless you specify one in CSS, so you should never have to set its border to 0.

Which segues nicely into point two — namely, since Mail isn’t including a stylesheet anywhere in the message, 2a) why is it giving a named class attribute to all these spans, and 2b) why is it necessary to manually specify default settings in their style property?

Here’s another great WTF:

SPAN class=”Apple-style-span” style=”border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; “

The above is the very first SPAN tag in the document. HTML parent elements pass their properties on to their children, and “Cascading” is part of the name of CSS, fer Chrissakes. So why the hell is Mail including the exact same (manually specified default) values in the next six (!) SPAN tags?

That brings us to WTF #4 — why have seven nested SPAN tags all containing the same attributes? Is Mail trying really really hard to make sure that style gets followed or something? Nesting seven <em> tags in HTML doesn’t give the tagged text seven times as much emphasis. It just wastes 54 characters! This takes that waste to a whole new level.

Finally, since this HTML/CSS code is never going to be seen by a human (in theory), and is being used strictly to make an e-mail message look like a goddamn glossy brochure (that’s another rant entirely), there’s no need for spaces after colons or semicolons in the style attribute, and there’s certainly no need for a trailing semicolon and space at the end of a style attribute.

Not that it’s an excuse for sending HTML mail, but if Mail would bother remotely optimising its HTML/CSS, that message would have been about 3K. Still a waste of 2.5K, but that’s at least 75% less wasteful than it was before.

posted by Chris on 20 July 2006 at 2224 in computing

Trackbacks

TrackBack URL for this entry:
http://chrislawson.net/blog/t.pl/703
 

Post a Comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?