怎样获取所有style节点

通过 document.styleSheets 获取所有的样式表节点.

document.styleSheets instanceof StyleSheetList;
// true

 

注意: 

1. 返回的是一个StyleSheetList对象实例;

2. 不能通过document.querySelectorAll('style') 和 document.getElementsByTagName('style') 获取.

posted on 2019-09-17 18:18  aisowe  阅读(394)  评论(0编辑  收藏  举报

导航