我找不到与我的场景匹配的问题,并且由于某种原因无法弄清楚这个问题... jQuery没问题,但本机(或angularJS/jQuery Lite) 。去除特定标记除外的标记
我有几个自定义标记的HTML。我想保留一些标签(它们是空的),但只保留所有其他标签的文字。我没有直接操纵DOM - 我放入了一个HTML,并且需要退出HTML。例如: -
<span class="ng-scope">CTAGCTCTCTGGAGATTAACGAGGAGAAATACTAGAtTGGTTCAT</span><start feat="1" class="ng-scope"></start><annotation index="1" class="ng-isolate-scope ng-scope" style="background-color: rgb(238, 153, 238); background-position: initial initial; background-repeat: initial initial;"><span tooltip="Another Promoter" tooltip-placement="mouse" tooltip-append-to-body="true" ng-transclude="" class="ng-scope"><span class="ng-scope">GATCATAAgcttgaat</span></span></annotation><end feat="1" class="ng-scope"></end><span class="ng-scope">tagccaaacttatt</span>
到
CTAGCTCTCTGGAGATTAACGAGGAGAAATACTAGAtTGGTTCAT <start feat="1"></start> GATCATAAgcttgaat <end feat="1"></end> tagccaaacttatt
空白并不重要。最后,我会拉出的开始和结束也,故其形式是不是太重要了(例如,可能是< 1> XX)
感谢
为什么不操纵* A * DOM?应该可以将HTML解析为DOM片段,并用它们的'innerText'替换不需要的节点。 – millimoose