Peter Michaux
2006-Sep-05 02:48 UTC
scriptaculous setOpacity function workarounds question
Hi, Is there any documentation about all the workarounds in the setOpacity function. Seems like there are many problems with many browsers here. The Yahoo! UI library doesn''t make an effort to take care of any of these problems. They just have the IE filters part. In the Scriptaculous, this line is the most curious to me. (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : null Is this line for good measure or actually a browser bug workaround? if(value < 0.00001) value = 0; Thank you, Peter Element.setOpacity = function(element, value){ element= $(element); if (value == 1){ Element.setStyle(element, { opacity: (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : null }); if(/MSIE/.test(navigator.userAgent)) Element.setStyle(element, {filter: Element.getStyle(element,''filter'').replace(/alpha\([^\)]*\)/gi,'''')}); } else { if(value < 0.00001) value = 0; Element.setStyle(element, {opacity: value}); if(/MSIE/.test(navigator.userAgent)) Element.setStyle(element, { filter: Element.getStyle(element,''filter'').replace(/alpha\([^\)]*\)/gi,'''') + ''alpha(opacity=''+value*100+'')'' }); } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Thomas Fuchs
2006-Sep-05 16:21 UTC
Re: scriptaculous setOpacity function workarounds question
Am 05.09.2006 um 04:48 schrieb Peter Michaux:> > Hi, > > Is there any documentation about all the workarounds in the setOpacity > function. Seems like there are many problems with many browsers here. > The Yahoo! UI library doesn''t make an effort to take care of any of > these problems. They just have the IE filters part. > > In the Scriptaculous, this line is the most curious to me. > > (/Gecko/.test(navigator.userAgent) && > !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? > 0.999999 : nullFirefox up to 1.5 (but not including) has a bad render bug and flickers.> Is this line for good measure or actually a browser bug workaround? > > if(value < 0.00001) value = 0;That''s because very small values (which can occur in effects) could lead to numbers with exponents, so this is good measure.> Thank you, > Peter >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Peter Michaux
2006-Sep-05 18:04 UTC
Re: scriptaculous setOpacity function workarounds question
Hi Thomas, Thanks for the reply. I just looked at the new scriptaculous release and the changes in the setOpacity function.> > In the Scriptaculous, this line is the most curious to me. > > > > (/Gecko/.test(navigator.userAgent) && > > !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? > > 0.999999 : null > > Firefox up to 1.5 (but not including) has a bad render bug and flickers.I can see in the new version the "null" was changed to "1" which maybe makes sense if the JavaScript will later use with getInlineOpacity. Was that the thinking? The conditional implies that some browsers that test positive for Gecko will also test postitive for Konqueror, Safari or KHTML and that these browsers will not tolerate a value of 0.999999. Is it true they can''t handle that value? In the Yahoo! UI library they do not seem to worry about this 0.999999/Firefox <1.5 bug. They have el.style.opacity = val; el.style[''-moz-opacity''] = val; el.style[''-khtml-opacity''] = val; Perhaps this solves the firefox problem without the potentially buggy use of navigator.userAgent? ---------------> > Is this line for good measure or actually a browser bug workaround? > > > > if(value < 0.00001) value = 0; > > That''s because very small values (which can occur in effects) could > lead to numbers with exponents, so this is good measure.Ahh ok. Good idea. --------- I can also see that in the new version of the setOpacity function if (/MSIE/.test(navigator.userAgent) && !window.opera) couldn''t you just use this? if (element.style.filter) --------- One last question. I don''t really know how the filters property works. In this next line does there need to be a separator before the newly added alpha string? Something like '';alpha('' element.style.filter.replace(/alpha\([^\)]*\)/gi,'''') + ''alpha(opacity=''+value*100+'')''; Thank you, Peter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Peter Michaux
2006-Sep-06 00:13 UTC
Re: scriptaculous setOpacity function workarounds question
On 9/5/06, Peter Michaux <petermichaux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > In the Scriptaculous, this line is the most curious to me. > > > > > > (/Gecko/.test(navigator.userAgent) && > > > !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? > > > 0.999999 : null > > > > Firefox up to 1.5 (but not including) has a bad render bug and flickers.I just tried element.style.opacity = 1 in Firefox 1.0 on OS X and Win XP without any flicker. Previous versions of Fx are not available on their FTP site. Do you have an example? Thank you, Peter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Thomas Fuchs
2006-Sep-06 06:23 UTC
Re: scriptaculous setOpacity function workarounds question
No, I don''t. But I _know_ the problem was there. See http://dev.rubyonrails.org/browser/spinoffs/scriptaculous/ CHANGELOG?rev=5014#L600 for the change. -Thomas Am 06.09.2006 um 02:13 schrieb Peter Michaux:> > On 9/5/06, Peter Michaux <petermichaux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>>> In the Scriptaculous, this line is the most curious to me. >>>> >>>> (/Gecko/.test(navigator.userAgent) && >>>> !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? >>>> 0.999999 : null >>> >>> Firefox up to 1.5 (but not including) has a bad render bug and >>> flickers. > > I just tried element.style.opacity = 1 in Firefox 1.0 on OS X and Win > XP without any flicker. Previous versions of Fx are not available on > their FTP site. Do you have an example? > > Thank you, > Peter > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Peter Michaux
2006-Sep-06 07:31 UTC
Re: scriptaculous setOpacity function workarounds question
Hi Thomas, I will try to write a file to get the problem to happen for me. Thanks, Peter On 9/5/06, Thomas Fuchs <t.fuchs-moWQItti3gBl57MIdRCFDg@public.gmane.org> wrote:> > No, I don''t. But I _know_ the problem was there. > > See http://dev.rubyonrails.org/browser/spinoffs/scriptaculous/ > CHANGELOG?rev=5014#L600 for the change. > > -Thomas > > Am 06.09.2006 um 02:13 schrieb Peter Michaux: > > > > > On 9/5/06, Peter Michaux <petermichaux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > >>>> In the Scriptaculous, this line is the most curious to me. > >>>> > >>>> (/Gecko/.test(navigator.userAgent) && > >>>> !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? > >>>> 0.999999 : null > >>> > >>> Firefox up to 1.5 (but not including) has a bad render bug and > >>> flickers. > > > > I just tried element.style.opacity = 1 in Firefox 1.0 on OS X and Win > > XP without any flicker. Previous versions of Fx are not available on > > their FTP site. Do you have an example? > > > > Thank you, > > Peter > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---