title: Detecting if HTML string contains visible text in C#
body: <p>I'm looking for a way to check a string containing html and decide if it contains any text that should be visible, not counting whitespaces.</p>
  
  <p>Basically anything should count as visible if it shows up as visible text upon rendering it as the <code>innerHTML</code> of a <code>&lt;div&gt;</code>.</p>
  
  <p>For example </p>
  
  <ul>
  <li><code>&lt;div&gt;hello&lt;/div&gt;</code> is visible, as "hello" is shown in the browser. </li>
  <li><code>&lt;div&gt;&lt;p&gt; &lt;br/&gt;&lt;/div&gt;&amp;nbsp;</code> is not visible.</li>
  <li><code>&lt;script&gt;alert('asdf')&lt;/script&gt;</code> is not visible. </li>
  <li><code>plain text</code> is visible, although it does not contain any html tags.</li>
  </ul>
  
  <p>There are a lot of cases where I'm not sure (any result would be acceptable):</p>
  
  <ul>
  <li><code>&lt;div style="display: none"&gt;this is tricky&lt;/div&gt;</code> is not visible, but since css adds an other layer of complexity to the question, it might be a good idea not to bother with it.</li>
  <li><code>&lt;script&gt;document.write('What is this, I don't even-')&lt;/script&gt;</code> should be outside the scope of this question.</li>
  <li><code>&lt;input value="Read this"&gt;</code> is visible, but I don't care about form elements at the moment, so this might as well be not visible.</li>
  </ul>
  
  <p>I want to decide this server-side and deal with the situation accordingly.</p>
  
  <p>Is there a good way to decide this in C#? Writing my own solution seems tedious, and I was wondering if someone already did this (or something similar).</p>
  
  <p>EDIT:</p>
  
  <p>Is the question this incomprehensible? I already stated that I want to do it on the server, not in a browser environment. jQuery and jsfiddle have little relevance here.</p>