我想检查对省略号溢出的支持,而不是通过查询浏览器类型或版本。这可能吗?
我知道 firefox 版本 < 7 不支持这个。
谢谢, 塔尔
最佳答案
没有尝试过这种方法,但这可能有效:
function checkEllipsis() {
var d = document.createElement('div');
if(typeof d.style.textOverflow == 'undefined')
return false;
d.style.textOverflow = 'ellipsis';
return d.style.textOverflow == 'ellipsis';
}
关于javascript - 如何检查文本溢出:ellipsis is supported in browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12026675/