lol_html 1.2.1

Streaming HTML rewriter/parser with CSS selector-based API
Documentation
<html><head>
  <title>:nth-of-type() pseudo-class</title>
  <style type="text/css">.red { background-color : red }
p:nth-of-type(3) { background-color : lime }
dl > :nth-of-type(3n+1) { background-color : lime }
</style>
  <link rel="author" title="Daniel Glazman" href="http://glazman.org/">
  <link rel="help" href="https://www.w3.org/TR/css3-selectors/#selectors"> <!-- bogus link to make sure it gets found -->
  <meta name="flags" content="">
 </head>
 <body>
<p>This paragraph is here only to fill space in the DOM</p>
<address>And this address too..</address>
<p>So does this paragraph !</p>
<!--[ELEMENT('.red')]--><p class="red"><!--[TEXT('.red')]-->But this one should have green background<!--[/TEXT('.red')]--></p><!--[/ELEMENT('.red')]-->
<dl>
  <!--[ELEMENT('.red')]--><dt class="red"><!--[TEXT('.red')]-->First definition term that should have green background<!--[/TEXT('.red')]--></dt><!--[/ELEMENT('.red')]-->
    <!--[ELEMENT('.red')]--><dd class="red"><!--[TEXT('.red')]-->First definition that should have green background<!--[/TEXT('.red')]--></dd><!--[/ELEMENT('.red')]-->
  <dt>Second definition term</dt>
    <dd>Second definition</dd>
  <dt>Third definition term</dt>
    <dd>Third definition</dd>
  <!--[ELEMENT('.red')]--><dt class="red"><!--[TEXT('.red')]-->Fourth definition term that should have green background<!--[/TEXT('.red')]--></dt><!--[/ELEMENT('.red')]-->
    <!--[ELEMENT('.red')]--><dd class="red"><!--[TEXT('.red')]-->Fourth definition that should have green background<!--[/TEXT('.red')]--></dd><!--[/ELEMENT('.red')]-->
  <dt>Fifth definition term</dt>
    <dd>Fifth definition</dd>
  <dt>Sixth definition term</dt>
    <dd>Sixth definition</dd>
</dl>

</body></html>