On Tue, May 29, 2012 at 10:30:57AM -0700, Andrew Bucin wrote:
> I was wondering if there is a way to select anything BUT a certain element.
> The documentation on GitHub contains information about logical OR and
> logical AND but no info on logical NOT selections. I've looked into filters
> but I can't seem to wrap my mind around how to target a specific class
> (from within the filter). Back to my problem, say that I have the following:
>
> *<svg>
> <child class='a_class'></child>
> <child class='b_class'></child>
> <child class='c_class'></child>
> </svg>*
>
> The idea is I want to select all of *svg's* children, *except* the one with
> the class *b_class*. How can I achieve that using d3.selectAll() ?
Use the CSS3 :not pseudo-class [1]:
d3.select("svg").selectAll("*:not(.b_class)");
[1]:
http://www.w3.org/TR/selectors/#negation
--
Jason Davies,
http://www.jasondavies.com/