title: How to remove all pseudo selectors from a CSS selector string using Javascript?
body: <p>For a script I'm doing I need to verify a CSS selector exists in the DOM. I'm wondering how to handle multiple <code>:pseudo</code> selectors with a generic rule.</p>
  
  <p>Something like this is simple:</p>
  
  <pre><code>var selector = "div.foo div.bar:active"
  </code></pre>
  
  <p>which could be handled by</p>
  
  <pre><code>selector.split(":").shift(); // &gt; div.foo div.bar
  </code></pre>
  
  <p>but when I have multiple selectors, I'm don't know how I could remove them. Something like this:</p>
  
  <pre><code>var selector = "div.foo:hover div.bar:after"
  </code></pre>
  
  <p><strong>Question:</strong><br>
  How would I remove all CSS pseudo selectors (<code>":something"</code>) from a string?</p>