title: Filter based on the text content of elements
body: <p>I'm fairly new to d3 and I'm trying to tweak Mike Bostock's Treemap example (<a href="http://bl.ocks.org/mbostock/4063582" rel="nofollow">http://bl.ocks.org/mbostock/4063582</a>). Below is what I want to achieve:</p>
  
  <p>1) take text inputs from user via submit button;</p>
  
  <p>2) find nodes (from the tree) that contain the text inputs;</p>
  
  <p>3) change the background attributes of those nodes.</p>
  
  <p>To make my questions simpler, is there a way to filter (subset) elements based on the text content of elements?</p>
  
  <p>For example, if I have the following four p elements, can I do something like below to change the name Cathy to red?</p>
  
  <pre><code>d3.selectAll("p")
      .filter(function(d) { return d.text === Cathy; })
      .attr("color", "red");
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;p&gt;Alice&lt;/p&gt;
  &lt;p&gt;Ben&lt;/p&gt;
  &lt;p&gt;Cathy&lt;/p&gt;
  &lt;p&gt;Daniel&lt;/p&gt;
  </code></pre>
  
  <p>Any comments will be appreciated.</p>