Jacob Rask

web stuff & who knows what else

jQuelements

Problem

According to the W3C, visual brow­sers should render quotation marks around text marked up with the HTML quote element, q. Modern browsers do, but not Internet Explorer versions prior to 8. Additionally, IE8 is the only major browser to apply quotation marks according to the specified lang attribute by default.

Solution

Use a small jQuery script to check if the browsers recognizes the CSS property quotes, if not, insert the quotation marks automatically.

jQuelements was inspired by the work David Hellsing did on making more browsers recognize the lang attribute, using suitable quotation marks depending on what language the quote is.

I have written more about this, and explained some of the code, at my blog: Fixing <q> for IE. Please put your comments and questions there.

Examples

<p><q>Default quote and <q>another quote</q> inside</q></p>

Default quote and another quote inside

<p lang="sv"><q>Svenskt citat och <q>ytterligare ett citat</q> inuti</q></p>

Svenskt citat och ytterligare ett citat inuti

<p lang="da"><q>Dansker citat og <q>en anden citerer</q> indeni</q></p>

Danske citat og en anden citat ideni

<p><q lang="en-us">American English quote and <q>another quote</q> inside with the lang att­ribute set in the parent q tag</q></p>

American English quote and another quote inside with the lang attribute set in the parent q tag

<p lang="fr"><q>Français et une <q>autre citation</q> dans la citation</q></p>

Français et une autre citation dans la citation

Browser Support

Showing when browsers will render proper quotation marks around q, including support for the lang attribute.
Firefox 3 Opera 9.6 Safari 3.2 Chrome 1.0 IE 5.5 IE 6 IE 7 IE 8
default no yes
CSS yes unknown no yes
CSS + jQuelements yes unknown no yes