返回列表

页面上有用到的所有CSS (二)

默认分类 2019/10/29 04:15

代码如下:

var result = [];
[].forEach.call(document.styleSheets, function(item1) {
  if (item1.cssRules) {
    [].forEach.call(item1.cssRules, function(item2) {
      if (!item2.selectorText) return ''
      var selectorText = []
      var list = String(item2.selectorText).split(',')
      list.forEach(function (item3) {
        try { if (document.querySelector(item3.replace(/\:+[^:\,]*/ig, ''))) selectorText.push(item3) } catch (e) {console.log(e)}
      })
      if (selectorText.length) result.push(selectorText.join(',') + item2.cssText.replace(item2.selectorText, ''))
    })
  } else {
    console.log('[crossorigin="anonymous"]: ' + item1.href)
  }
});
result;
var out = document.getElementById('out')
if (!out) {
  document.body.insertAdjacentHTML('afterEnd', '<div id="out">123</b>')
  out = document.getElementById('out')
}
out.innerHTML = result.join('')

http://www.runoob.com/bootstrap/bootstrap-modal-plugin.html

https://ant.design/components/modal-cn/


>> 留言评论