jQuery is doing something similar with its "support" object:
http://docs.jquery.com/Utilities/jQuery.support
It uses feature detection once at the script initialization and then
uses boolean values to determine which code is appropriate..

On Aug 20, 7:50 am, ludovic <ludothebe...@gmail.com> wrote:
> > It is a bad idea because there is no such thing as foolproof browser
> > sniffing.
> > The only way to know what the browser can do is to test its features,
> > and loading a piece of script for every feature implementation
> > specific to a browser completely kills the benefit of loading less
> > script.
>
> Unless you create as much files as there are features support
> combinaisons, or you create it once on-the-fly when you have a
> combinaison that has never been encountered.
>
> The main reason I was asking for that was not because I wanted to
> download a lighter file, but because I didn't wanted at each
> iteration  tests which could be done once.
>
> Another way would be to download the entire script, but to do like
> that :
>
> in spite of
> o.setClass = function( class ) {
>   if( isGoodDOM() ) {
>      this.setAttribute( 'class', class );
>   }
>   else {
>      this.setAttribute( 'className', class );
>   }
>
> }
>
> to do
> if( isGoodDOM() ) {
> o.setClass = function( class ) {
>      this.setAttribute( 'class', class );
>   }}
>
> else {
> o.setClass = function( class ) {
>      this.setAttribute( 'className', class );
>   }
>
> }
>
> ---
> Ludovic
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to