Tech Archives, page 27

All things technology. Very popular here on Justinsomnia.

HTML Tag of the Day: q

Today’s under-utilized HTML tag of the day is the <q> tag, intended for inline quotations. The <q> tag’s oft-used block-level analog is the <blockquote>.

Interestingly enough, the HTML 4.01 spec tells us that:

Visual user agents must ensure that the content of the Q element is rendered with delimiting quotation marks. Authors should not put quotation marks at the beginning and end of the content of a Q element.

I’ve marked up the passage above using <blockquote>s. Here’s how it looks marked up with <q> tags: Visual user agents must ensure that the content of the Q element is rendered with delimiting quotation marks. Authors should not put quotation marks at the beginning and end of the content of a Q element.

If you’re looking at this post in a standards compliant browser, you’re probably seeing curly quotes around around the linked excerpt above. Unless of course you’re in France in which case you’re probably seeing angle quotation marks, aka les guillemets: « and ».

If we look at the default HTML stylesheet for Firefox (located here on Windows: C:\Program Files\Mozilla Firefox\res\html.css) we can see how Firefox adds locale-specific leading and trailing quotation marks.

q:before {
  content: open-quote;
}
q:after {
  content: close-quote;
}

Sadly IE 6 does not follow this requirement, nor does it implement the :before and :after pseudo-classes or the content: selector. Which is probably why this exceedingly useful tag has not enjoyed widespread use.

This post first appeared on From the Belly of the Beasts, a weblog from some of the people who build O’Reilly websites.

There are only 10 legal XHTML empty tags

I’ve always had this nagging question. Is <a name="target"/> legal XHTML? I mean, it seems like kind of waste to have to do <a name="target"></a> all the time. Same thing with <script src="file.js"></script>, but I wasn’t sure if I could just arbitrarily use the empty element shorthand.

Turns out I can’t. There’s limited list of tags in the XHTML 1.0 DTD that can use the empty element shorthand:

All elements other than those declared in the DTD as EMPTY must have an end tag. Elements that are declared in the DTD as EMPTY can have an end tag or can use empty element shorthand.

A quick search for “empty” on the XHTML 1.0 DTD returns the following list of tags that can legally use the empty element shorthand:

Note: <a/> and <script/> are not on that list.

This post first appeared on From the Belly of the Beasts, a weblog from some of the people who build O’Reilly websites.

View Source in Tab Bookmarklet

Holy cow, look what I just made! Drag this bookmarket to your toolbar and use it in Firefox to toggle between the view-source: pseudo-protocol and the rendered webpage.

View Source in Tab

Now if only I could associate a keyboard shortcut (thinking Ctrl+U) with this function, I’d be golden.

This post first appeared on From the Belly of the Beasts, a weblog from some of the people who build O’Reilly websites.

What’s so cool about Firefox 1.5?

Get Firefox 1.5!

Update: Problems I’ve had since upgrading to 1.5

  1. Highlighted items in the Bookmarks menu flicker on hover (after extended use without restarting browser) just like the description here.
  2. Uninstalled extensions don’t disappear from list after restarting browser
  3. Strange interaction between the Web Developer Toolbar and the integrated search box, which causes a view-source window to popup after submitting a search term

The first issue I only saw at work, and the second two I’m struggling with at home. I’m going to uninstall and reinstall Firefox and see if things work better from scratch.

Figured out number 3. I’ve been playing with Josh’s VSIT extension based on my View Source in Tab bookmarklet, but in order to get VSIT to work right, I removed the Web Developer toolbar’s shortcut for View Source (which is also Ctrl+Shift+U, same as VSIT). For some reason whenever a search term or URL was entered, the Web Developer Toolbar would trigger the view source window. This of course is fixed by choosing a different keyboard shortcut for the Web Developer Toolbar’s view source function, instead of leaving it blank.

Groan, it gets worse

So I uninstall Firefox, restart my computer, and delete my profile, the latter having the largest implications I hadn’t considered fully, that I will have lost the sum total of my saved form field values, which is something I quite like. Luckily that folder should be sitting happily in my “Recycle Bin” on the off chance I wish to restore some part of it.

So I launch the clean slate version of Firefox 1.5… and the status bar is b0rked? WTF?

Firefox 1.5 Status bar bug

Same thing after I restart the browser. The gray area beneath the status bar remains if I turn off the status bar. And for some reason there’s a red caret in the lower-left. I’m stumped.

Uncool URLs

I don’t understand why the iTunes RSS extension spec (you know, the one you get when you google for itunes rss) hasn’t been updated since July 2005:

http://phobos.apple.com/static/iTunesRSS.html

But if you want the latest version (as of October 2005) it’s buried in an archive of an Apple mailing list:

http://lists.apple.com/archives/syndication-dev/2005/Nov/msg00002.html

…that I wouldn’t have known about if I wasn’t on the feedvalidator mailing list.

This post first appeared on From the Belly of the Beasts, a weblog from some of the people who build O’Reilly websites.