Re: Cross-browser setOpacity() without browser sniffing?
- From: petermichaux@xxxxxxxxx
- Date: 4 Sep 2006 18:05:24 -0700
Hi Richard,
Richard Cornford wrote:
petermichaux@xxxxxxxxx wrote:
Does anyone have a a cross-browser setOpacity function<snip>
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.
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
.
- Follow-Ups:
- Re: Cross-browser setOpacity() without browser sniffing?
- From: Richard Cornford
- Re: Cross-browser setOpacity() without browser sniffing?
- References:
- Cross-browser setOpacity() without browser sniffing?
- From: petermichaux
- Re: Cross-browser setOpacity() without browser sniffing?
- From: Richard Cornford
- Cross-browser setOpacity() without browser sniffing?
- Prev by Date: Re: Cross-browser setOpacity() without browser sniffing?
- Next by Date: Re: Grab Elements of DL (2)
- Previous by thread: Re: Cross-browser setOpacity() without browser sniffing?
- Next by thread: Re: Cross-browser setOpacity() without browser sniffing?
- Index(es):
Relevant Pages
|