Re: Cross-browser setOpacity() without browser sniffing?



Hi Richard,

Richard Cornford wrote:
petermichaux@xxxxxxxxx wrote:
Does anyone have a a cross-browser setOpacity function
that does not use browser sniffing? I looked at the Yahoo!
UI function and it detects IE by looking for
window.ActiveXObject. I also looked at Scriptaculous and
it uses navigator.userAgent.
<snip>

You should not need to ask this question.

It seems like in the browser scripting world there are always suprises
due to bugs. I don't know about all the bugs. Also the Yahoo! UI guys
do know a thing or two and the fact that they double up with the
following two checks makes me wonder if something else is going on.

if (window.ActiveXObject && typeof el.style.filter == 'string')


The general principle of
feature detection is to devise a test that is as closely related
(preferably directly related) to the question that needs to be answered.
If your question is whether a browser supports IE-style filters then
test for the manifestation of filters; the - filters - collection of the
element:-

if(el.filters){
... //has filters collection.
}

- or the - filters - property of the style object:-

if(typeof el.style.filters == 'string'){
...//has filters property on style object..
}

(the latter being the most direct test)

Richard, you have helped me much in the past months. I do appreciate it
greatly. Due to your persistance, I am currently trying to get myself
off the Yahoo! UI code and also ultimately rid my Rails code of
Prototype.js. I am moving to the layered library approach that you
described previously.

Thank you,
Peter

.



Relevant Pages

  • [kde] Re: KDEPIM 4.6 prob^Wimpressions
    ... Did you file a feature request? ... X or the akonadi processes (right at this very moment: ... browser engine is not that good, ... I don't miss filters at all. ...
    (KDE)
  • Re: IE Disinformation bar woes
    ... Evidently the security settings used ... emails at yahoo is sure to realize this. ... of the browser and logs into yahoo on one, ...
    (microsoft.public.windowsxp.security_admin)
  • Yahoo! Messenger Auth Bypass Vulnerability
    ... including the popular Yahoo! ... improper caching of pages by the browser. ... Response to this URL does not specify that the browser should not keep its entry in the cache. ... Therefore, even after the user logs out of both messenger and email account, the URL entry ...
    (Bugtraq)
  • Re: Getting Rid of a Yahoo Browser
    ... How to Make Internet Explorer the Default Web Browser ... where do I go to find and then install IE6 & OE. ... How do I dump Yahoo and replace it with IE6 and Outlook Express. ... client, not the SBC Yahoo! ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Help--IE 6 wont open
    ... and some images in my Yahoo DSL browser would ... Tech support at Yahoo said it was an Internet ... > set up and install files for a full Internet Explorer ...
    (microsoft.public.windows.inetexplorer.ie6.browser)