你可以测试浏览器支持-moz-linear-gradient? [英] Can you test for browser support for -moz-linear-gradient?

查看:186
本文介绍了你可以测试浏览器支持-moz-linear-gradient?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用功能检测来判断用户的Firefox版本是否支持CSS样式值 -moz-linear-gradient 。 (这是在Gecko 1.9.2中添加的,Firefox的3.6版本使用这个。)

我不能使用 document.body.style。 mozLinearGradient (或类似的东西),因为 -moz-linear-gradient 不是样式属性,而是样式值。 b

有没有人知道如何在不使用版本号的情况下进行测试?

解决方案

确定如何,但 Modernizr (一个很好的小功能检测脚本)似乎这样做。



我猜你可以创建一个(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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆