Search the document for text to remove more than the tag it's found in
<p>Imagine you had html code like this:</p>

<pre><code>&lt;div id="2761421" class="..." data-attributionline="testtext wrote at..." data-created-at="1342689802000" data-updated-at="1342689802000" data-user-id="36847" &gt;                             
  &lt;div class="subject"&gt;    &lt;strong&gt;                                      
      &lt;a name="2761421" href="#2761421"&gt;wee&lt;/a&gt;&lt;/strong&gt;                             
  &lt;/div&gt;                                             
  &lt;div class="info"&gt;                                     
    &lt;div class="author"&gt;      author:                                              
      &lt;span class="name"&gt;        testtext         (                                             
        &lt;a href=""&gt;we&lt;/a&gt;)                                                                     
      &lt;/span&gt;                                     
    &lt;/div&gt;                                     
    &lt;div class="date"&gt;      date:                                        
      &lt;time datetime="dfgdf"&gt;dfgdfg                                      
      &lt;/time&gt;                                     
    &lt;/div&gt;                                
  &lt;/div&gt;                             
  &lt;hr style="clear: both;" /&gt;                             
  &lt;div class="text gainlayout"&gt;        some text                            
  &lt;/div&gt;                             
  &lt;div class="foot gainlayout unselectable"&gt;                                     
    &lt;span class="menuitem postmenuitem-report"&gt;                                      
      &lt;a href="dfgdfg" data-remote="true" class="nav" data-confirm="dgdfg" rel="nofollow"&gt;cvbcvb&lt;/a&gt;                                
    &lt;/span&gt;        
  &lt;/div&gt;                    
&lt;/div&gt;  
</code></pre>

<p>What would the javascript code look like that searches the whole document for parts where the div with data-attributionline= contains testtext to replace the whole cited div from start to finish with "Filtered"?</p>

<p><strong>or</strong></p>

<p>What would the javascript code look like that searches the whole document for </p>

<pre><code>&lt;span class="name"&gt; 
</code></pre>

<p>where the name contains testtext to replace the whole div starting from</p>

<pre><code>&lt;div id="&lt;someid&gt;" class="..." data-attributionline="testtext&lt;some text&gt;" data-created-at="&lt;somedate&gt;" data-updated-at="&lt;somedate&gt;" data-user-id="&lt;someid&gt;" &gt;                             
</code></pre>

<p>to the last div, ie</p>

<pre><code>    &lt;/span&gt;        
  &lt;/div&gt;                    
&lt;/div&gt; 
</code></pre>

<p>with "Filtered"?</p>
