Andreas Wahlin schrieb:
>> For instance the use of the setInterval() to make "ready()" work
>> semi-nicely with Safari, or when to use "filter" in IE to implement
>> the standard "opacity" property. There's no way to quickly and easily
>> detect when these should be applied except for detecting the browser.
>
> Not true I think ... this little snippet for example should work
>
> if (image.style.filter != null) { ... }
>
> Andreas
typeof document.body.style.filter == 'string' would indeed work.
But still all that object detection isn't that future-proof in the end
either. Other browser vendors started to include all kind of objects for
compatibility, just because amateurs started to code thinking that IE is
the only browser in the world.
Quite recently we encountered a problem with elem.currentStyle, because
Opera all of a sudden supports both elem.currentStyle and the W3C
Standard getComputedStyle(this,null).getPropertyValue(prop). D'oh. And
to make it even worse, it returns different values depending on which
method you use (I think it exactly mimics IE in that case). And there
are other examples. I once use document.execCommand to sniff IE, because
I thought no browsers other than IE would ever have that. It turned out,
that it wasn't such a good idea. Mozilla added document.all if I
remember correctly. And so on...
I think using navigator.vendor is a good idea, because that string
cannot be changed by a user (or at least not as easy as the user agent
string). But not every browser has that.
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/