[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Comments needed: quotes with other browsers



On Sat, Feb 18, 2006 at 12:36:58PM +0100, Jutta Wrage wrote:
> Am 18.02.2006 um 10:27 schrieb Richard Atterer:
> > However, I have a problem with including obfuscated-source JavaScript 
> > on the Debian website! :-/
> 
> I have no other idea. The IE7 scripts repair IE HTML and CSS support.
> 
> Either we care IE and use it or we do not. I do not see any other 
> alternatives.

There's always an alternative... ;-)

The JavaScript code below can be put into a .js file and referenced by a 
page. It waits until the page has been loaded, then it goes through all <q> 
tags and adds normal quotes around the contained text. For example, 
<q>foo</q> becomes <q>"foo"</q>. It could be extended to produce 
language-dependent quotes and not just plain ASCII "" with quite a lot of 
extra work, but honestly, I can't be bothered to do this just for MSIE...

This code must only be executed for browsers which are known not to do 
anything about the <q>-related CSS, otherwise too many quotes will be 
displayed (something ""like this"").

[If you tried to execute it with Firefox/Konqueror, nothing would seem to 
happen because they don't support the attachEvent() function - their 
equivalent for this is called addEventListener(). However, e.g. Opera 
supports both the CSS and the JavaScript, so it displays too many quote 
characters. Weird, actually Opera produces stuff like «"single Quote»"», I 
would have expected a result like «"single Quote"». ]

FWIW, I've now also checked whether your div[lang=xx] CSS works with MSIE 7 
beta 2. It doesn't work, the results are identical to MSIE 6! :-(( From 
what I've read in various places, hardly any CSS improvements have been 
made to MSIE 7 so far - let's hope that MS will end up implementing more 
than tabbed browsing and eye candy.  Grrrr...
For the moment, I'd still go for the check "[if lt IE 7]" in the hope that 
later MSIE 7 betas will actually come with improved CSS capabilities.

Did I mention that MSIE sucks? ;-/

Cheers,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer     |  GnuPG key: 0x888354F7
  | \/¯|  http://atterer.net  |  08A9 7B7D 3D13 3EF2 3D25  D157 79E6 F6DC 8883 54F7
  ¯ '` ¯

/* MSIE 6 does not support CSS attribute selectors like [lang=de], so
   manually add quote characters inside q tags.
   Copyright 2006 by Richard Atterer, redistributable under GPLv2. */
window.attachEvent('onload', addQuotes);
function addQuotes() {
  var qTags = document.getElementsByTagName("q");
  for (var i = 0; i < qTags.length; ++i) {
    var q = qTags[i];
    q.insertBefore(q.document.createTextNode('"'), q.firstChild);
    q.appendChild(q.document.createTextNode('"'));
  }
}



Reply to: