在跑这些代码时,所有的文件路径都是本地的路径
如果样式表为外部样式表,如:
<link rel="stylesheet", type="text/css" href="style.css" />
那么
document.styleSheets[0].cssRules
返回null
;
在火狐下则不会。
信息来源:https://stackoverflow.com/questions/46356349/document-stylesheetsx-cssrules-are-null