特别是如果作为JS特征检测,我可以使用:
if (localStorage in window) { // you have local storage }
或者更简单:
if (crypto.subtle) { // you can encrypt document}
对于css检测:
if (CSS.supports('display', 'flex')) { // you can load flex layout }
我想创建一个基于flex的CSS2.1词法扫描器。在上有scanner flex实现。我试着给你打电话
$ flex css2.1.flex
$ gcc lex.yy.c -lfl
但是会出现错误:
css2.1.flex: In function ‘yylex’:
css2.1.flex:53:9: error: ‘S’ undeclared (first use in this function)
css2.1.flex:53:9: note: each undeclared identifier is reported only once for each function it app