title: PHP, Simple HTML DOM - `outertext` returns only the opening tag
body: <p>Using <a href="http://simplehtmldom.sourceforge.net/manual_api.htm" rel="nofollow noreferrer">PHP Simple HTML DOM Parser</a>.</p>
  
  <p>I am trying to remove certain elements from the dom. Is is <a href="https://stackoverflow.com/questions/8227481/simple-html-dom-how-to-remove-elements">well documented</a> in many places that the procedure is to get the element, and then set the <code>outertext = ""</code>. Something like...</p>
  
  <pre><code>foreach ($html-&gt;find($selector) as $node)
  {
      $node-&gt;outertext = '';
  }
  </code></pre>
  
  <p>And then reload the dom afterwards...</p>
  
  <pre><code>$html-&gt;load($html-&gt;save());
  </code></pre>
  
  <p>But when I run this exact operation to remove all <code>link</code> elements...</p>
  
  <pre><code>$html = file_get_html($url);
  
  foreach ($html-&gt;find($nodeName) as $node) {
      $node-&gt;outertext = '';
  }
  
  $html-&gt;load($html-&gt;save());
  </code></pre>
  
  <p>The result is that all of the <code>link</code> elements only lose the opening tag, but the contend and closing tag remain...</p>
  
  <pre><code>&lt;link&gt;http://www.somelink.com&lt;/link&gt;
  
  // becomes...
  
  http://www.somelink.com&lt;/link&gt;
  </code></pre>
  
  <p>And if I print out the <code>outertext</code> (in a test-case), it only returns the opening tag...</p>
  
  <pre><code>echo $html-&gt;find('link')-&gt;outertext;
  
  // returns "&lt;link&gt;"
  </code></pre>
  
  <p>It works fine for self-closing tags (i.e. <code>&lt;link src="http://www.somelink.com" /&gt;</code>), but that's because there is no content or closing tag to deal with.</p>
  
  <p>I can't find any other cases of people having this issue, so am not sure what's going on.</p>