JavaScript enhancements

This is a page to test out usability enhancements by JavaScript, whilst leaving the source HTML pure and re-usable. So far, this covers highlighting different link types, concatenating long links, changing the appearance of quote elements, and fixing abbr in IE.

The files used by this page are:

(Or download the handy zip archive.)

I find it annoying when you can't tell if a link will take you to another page on the same site, a document, or an external site. I used the Silk icons and jQuery to add little icons inline (as they might require alternative text). To do: within page links?

Internal link without domain: home page (should not have icon).

Internal link with domain: about this site (should not have icon).

UK Windsurfing association.The image-link to the left should not have an icon. However, this external link: W3C should.

Transforming (block)quotes

I first saw this done by Simon Willison, which really kicked off the idea of progressive enhancement for me. In this case, using the cite attribute to provide direct access to the quotation source, where possible.

Blockquote with cite and title:

this Ajax application is usable by screen-reader users some of the time. They aren’t totally shut out, but it isn’t totally easy for them, either.

Blockquote with cite:

this Ajax application is usable by screen-reader users some of the time. They aren’t totally shut out, but it isn’t totally easy for them, either.

Blockquote without cite:

this Ajax application is usable by screen-reader users some of the time. They aren’t totally shut out, but it isn’t totally easy for them, either.

Inline quotes (IE only)

Juicy Studio is the originator of the script to add quotation marks in IE, from the article Fixing IE quotes. I also use the same script as the blockquote one to add an onclick for any cite attributes.

Inline quote without cite: To be, or not to be.

Inline quote with cite: To be, or not to be. (should have onclick and title with the URL.)

Inline quote with cite & title: To be, or not to be. (should have onclick and title.)

Nested quote to test IE: My friend said: what a day!, which seemed apt., but no onclick or title.

Abbreviations (IE only)

IE doesn't support abbreviations properly, so Sovavsiti came up with a little script to add in a little markup (in IE only) to compensate. The script isn't jQueryfied, because as far as I can tell, IE would be required to support abbr for it to work that way. The script uses regex instead. This one should be brought in by a conditional comment to target IE < 7, as IE 7 seems to have fixed it.

  • Acronymn: NASA (should work anyway)
  • Abbr: W3C