解析标签属性到数组
xiyueta().parseattr()属性方法,一种调用方式:
1、xiyueta().parseattr(); //打印标签属性结构
总结:打印标签属性结构,以数组方法显示
尝试一下>>
<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script> <script>
var html=['<div id="nav" aa= class=\'wrap\' style=color:red display>', ' <ul>', ' <li></li>', ' <li></li>', ' <li></li>', ' </ul>', '</div>'].join("\n"); xiyueta.load(html); xiyueta.log( xiyueta("*").parseattr() )
</script>
0:
0:
1:
2: <div
length: 3
1:
0: id
1: nav
2: id="nav"
3: "
4: 4
length: 5
2:
0: aa
1: class='wrap'
2: aa= class='wrap'
3:
4: 5
length: 5
3:
0: style
1: color:red
2: style=color:red
3:
4: 6
length: 5
4:
0: display
1: undefined
2: display
3:
length: 4
5:
0:
1:
2: >
length: 3
length: 6