<分区>
我需要在服务器端处理“脏”html 数据。因为我在服务器端使用 Node.JS 和 jQuery,所以我能够使用 JS 和 jQuery DOM 解析器的所有功能来处理我的 html 内容。
“脏”数据意味着:
<br ><br />Home <a href="http://habrahabr.ru/post/169139/"> gamy code </ a>
<br>
Technique: <a href="http://habrahabr.ru/post/173903/"> Preparation methods </ a> <br>
<br>
In continuation, the technique based on the book Refactoring Refactoring <a href="http://www.ozon.ru/context/detail/id/1308678/">. Improvement of existing code by Martin Fowler. </ A> <br>
<a href="http://habrahabr.ru/post/174779/#habracut"> Read more → </ a>
因此,它可能在开头/中间有几个 br,空 p 等。我尝试使用
$('*:empty').remove();
但是,如果帖子开始形式
Home <a href="http://habrahabr.ru/post/169139/"> gamy code </ a> <br>