I’ve contributed my two penn’orth to a couple of interesting HTML related posts. Dan posed another SimpleQuiz asking how best to mark up a numbered list of title + description pairs. I proposed a number of solutions depending on context and writing style (varying from ordered lists to definition lists with headings or strong elements). The response was vast, so as a taster it’s well worth reading Tantek’s organized analysis of the answers.
Cameron asked whether frames had a place nowadays. The response was mostly ‘no’, with folks rightly citing printing and bookmarking problems. However when these issues are not important, I maintain that frames still have an important role to play.
At A List Apart, Aaron Gustafson gives us an tutorial on using the DOM for advanced show/hide functionality. The tutorial does a fine job of keeping behaviour as a separate layer – there are no event handlers in the HTML source at all – thus the page would still be usable for browsers without scripting enabled. The separation is achieved by using JavaScript to rewrite ordinary hrefs as javascript: protocol function calls.
Slightly bizarrely, the tutorial works the technology into navigating a long article. Ryan Singer pointed out on Signals vs Noise that hiding all of an article except the bit you’re reading is not exactly a good idea, particularly as one does not have a clear idea of length or position within the article. However it is not a stretch of the imagination to see the same technique used for creating a DOM-driven tabset.
Update: Further to Mark’s comment, it is well worth reading Peter Paul Koch’s analysis of Aaron’s, and other ALA JavaScript articles. In particular PPK points out that rewriting hrefs as javascript: is pretty hacky compared with using a lightweight onclick handler. PPK also directs our attention to Simon Willison’s Enhancing Structural Markup with JavaScript tutorial which covers pretty much the same ground as Aaron’s.
DOM | JavaScript · Mark-up techniques
Mark wrote:
PPK posted an interesting item on recent ALA javascript articles, following on from his critique several months ago.
ALA and JavaScript – five months later
His analysis of this particular article mentioned that Simon Willison had produced a similar superior script (to Aaron’s), of which I and possibly other clagnut readers, was unaware.
Tim Parkin wrote:
Is this the sort of dom tabset you were thinking of or have I mis-scanned the article
http://matt.pollenation.net/hb/mother
ps. this probably won’t be here for very long but I’ll link to the full site when it’s done.
Phil Wilson wrote:
The link to “Mark’s comment” doesn’t work from the front page because it’s relative.
Rich wrote:
Thanks Phil – fixed now.
Yes. Except in your example (at time of writing) if style sheets are enabled and scripting disabled all the tabbed content is hidden. Under this situation, all the content should really be shown.