title: selector for absence of class in element or its parents
body: <p>I am trying to alter MediaWiki's hideous default color for visited links and keep the red color for new links. New links have class <em>new</em> or their parents have this class set. So I tried</p>
  <pre><code>:not(.new) a:not(.new) { color: #0074D9 !important; }
  </code></pre>
  <p>But as I inspected in the browser console, this rule overwrites <code>li.new a</code> - which it should not. Experimenting a bit,</p>
  <ul>
  <li><code>li:not(.new) a:not(.new)</code> keeps the red color for <code>li.new a</code>,</li>
  <li><code>*:not(.new) a:not(.new)</code> overwrites the red color</li>
  </ul>
  <p>Can you explain this behavior and recommend a CSS rule forcing blue color for all links but the new ones?</p>
  <p><a href="https://i.stack.imgur.com/eVIn1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eVIn1.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/K3ghz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K3ghz.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/VIbdh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VIbdh.png" alt="enter image description here" /></a></p>