松散的css

    <style>
        <p>hello world</p>
        {}
        p {
            color: red;
        }
        {}
        <em style="padding: 4px; color: blue">hello ajanuw</em>
        {}
    </style>
<body>
    <div id="box"></div>
    <script>
        let tags = [];
        let box = document.getElementById('box');
        let sty = document.getElementsByTagName('style')[0]
        sty.innerHTML.replace(/(<.*|>\/>)/gm, $_ => tags.push($_) );
        box.innerHTML = tags.join(' ');
    </script>
</body>

posted @ 2018-07-25 23:57  Ajanuw  阅读(211)  评论(0编辑  收藏  举报