d3.selectAll to change styles by class in v4
<p>I'm transitioning from d3 v3 to d3 v4. I've looked through the documentation on what's changed, and I know that styles and selectors work a little differently now. I'm having an issue finding the right way to get what I need done. </p>

<p>In v3 I could do this:</p>

<pre><code>d3.selectAll(".myRectangle").style({'fill':'rgb(255,100,100)', 'stroke':'#000', 'stroke-width':'0.3'});
</code></pre>

<p>at the bottom of my code and everything that was classed as "myRectangle" that had been drawn would get the specified style applied to it.</p>

<p>Also, it would act as a placeholder in case anything dynamically got the myRectangle class added to them (say with a mouseover).</p>

<p>Now, the same code not only doesn't apply the styles, it returns an error if no element with the specified class exists.</p>

<p>I haven't been able to find an example of how to properly achieve this, which, might mean that I've been doing it poorly all along. Can anyone here point me in the right direction? </p>