Thanks a lot.
@Sanford:
As long as the check is in a function, the element will be garbaged
when the function completes, no?!
This would be best practice I assume (any other gotchas?):
var isGradientSupported = function(){
return !!new Element('div').setStyle('background','-
moz-linear-gradient(red, blue)').getStyle('background');
}();
I actually did not know about the navigator object, or I would have
used it. [* hides head in shame *]
I'm glad though, as I found this thread informative.
@Barry
I agree with trying to do it all via css where possible (though I
would test if your styles don't overwrite each other).
You should include the styles for MS
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr="#FF000000", EndColorStr="#00000000")
-ms-filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,
StartColorStr="#FF000000", EndColorStr="#00000000")
In my case though [that color picker], the Javascript must know what
styles have been applied: the behavior is entirely different if the
browser supports the styles I need.
On Feb 14, 10:59 pm, Sanford Whiteman <[email protected]>
wrote:
> > Perhaps the simplest way to do this is to do it in the CSS
> > itself...
>
> That would def'ly accomplish the initial rendering, but it doesn't
> tell the script how the page (probably) looks. If you follow your
> suggestion to show no style at all unless the browser has at least
> provisional CSS support, such dynamics can affect later Fx, etc..
>
> IMO, there's a big advantage in JS being aware of enhanced
> presentation, even when all styles are in classes (no dynamic element
> styles).
>
> -- S.