问题描述
我想使用功能检测来判断用户的Firefox版本是否支持CSS样式值 -moz-linear-gradient
。 (这是在Gecko 1.9.2中添加的,Firefox的3.6版本使用这个。)
我不能使用 document.body.style。 mozLinearGradient
(或类似的东西),因为 -moz-linear-gradient
不是样式属性,而是样式值。 b
有没有人知道如何在不使用版本号的情况下进行测试?
确定如何,但(一个很好的小功能检测脚本)似乎这样做。
我猜你可以创建一个(offscreen?)元素,将其设置为样式,然后在DOM中查找浏览器是否成功应用它? b $ b
I would like to use feature detection to tell whether the user's version of Firefox supports the CSS style value -moz-linear-gradient
. (This was added in Gecko 1.9.2. Version 3.6 of Firefox uses this.)
I can't use document.body.style.mozLinearGradient
(or something similar) because -moz-linear-gradient
is not a style property but a style value.
Does anyone know how to test for this without using version numbers?
I'm not sure how, but Modernizr (a nice little feature-detection script) appears to do it.
I guess you could create an (offscreen?) element, set that as it's style, and then poke around in the DOM to see if the browser successfully applied it?
这篇关于你可以测试浏览器支持-moz-linear-gradient?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!