-

xiyuetaCSS().debug() 属性方法

在浏览器调试面板里显示全部CSS结构
快速上手

xiyuetaCSS.debug()属性方法,二种调用方式:
1、xiyuetaCSS().debug(); //在浏览器调试面板里显示全部CSS结构
2、xiyuetaCSS().debug(true); //在浏览器里显示全部CSS结构源码

总结:打印出当前解析出来的CSS结构,以数组方法显示。html:为标记块,label: 为标记名称,lv: 为层级,tagpair: 为单双标记,upHtml: 为标记上方文本内容,downHtml: 为标记下方文本内容
尝试一下>>

  • 代码
  • 效果
<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script>
<script>var html = 'body{color:red}.news{font-size:12px;}#nav{color:blue;}';
 
xiyuetaCSS().parse(html); 
xiyuetaCSS().debug();
xiyuetaCSS().debug(true);
</script>
lv: 1 , label: body , upHtml: , downHtml: , html: body{color:red} , 0
lv: 1 , label: .news , upHtml: , downHtml: , html: .news{font-size:12px;} , 1
lv: 1 , label: #nav , upHtml: , downHtml: , html: #nav{color:blue;} , 2