Hi again,

*blush* Those same docs tell us that != is also supported by Sizzle.
Note, though, that:

    a[class!=whatever]

...is the same as

    a:not([class=whatever])

...which is *not* the same as

    a:not(.whatever)

...because of multiple class names.  Example:  With these links:

<a id='a' href='#'>one</a>
<a id='b' href='#' class='whatever'>two</a>
<a id='c' href='#' class='whatever blarg'>three</a>
<a id='d' href='#' class'blarg'>one</a>

"a:not(.whatever)" gives you a,d, but "a[class!=whatever]" and "a:not
([class=whatever])" give you a,c,d.  c is on the list because its
value ("whatever blarg") does not *exactly* match "whatever".

Perhaps that relates to why your 1.2.6 code doesn't quite work in 1.3?

HTH, sorry for missing != support earlier.
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Mar 18, 10:59 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
> Hi,
>
> Is there a != attribute operator?  I don't see it in either the CSS2
> or CSS3 specs.[1][2]  So I'm thinking that since jQuery 1.3 completely
> replaced the selector engine[3], there was a non-standard (but
> useful!) extension to the syntax in v1.2 that didn't get carried
> forward.
>
> The good news is that the docs[4] for the new selector engine, Sizzle,
> tell us it supports the ":not" pseudo-class, so you can use:
>
> $('a:not(.whatever)').click(...);
>
> ...to get the same effect that (I assume, never having used v1.2) the !
> = used to give you.
>
> [1]http://www.w3.org/TR/CSS2/selector.html
> [2]http://www.w3.org/TR/css3-selectors
> [3]http://docs.jquery.com/Release:jQuery_1.3
> [4]http://wiki.github.com/jeresig/sizzle
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
> Independent Software Engineer, consulting services available
>
> On Mar 18, 10:21 am, will <mac.tas...@gmail.com> wrote:
>
> > I'm working on a project at the moment and this [class!=whatever] has
> > stopped working.
> > In 1.2.6 I could use this fine, but in 1.3 it doesn't work.
>
> > For example, if I have two links:
>
> > <a href="#">Link</a>
>
> > and
>
> > <a href="#" class="whatever">Link</a>
>
> > Using a click function like this:
>
> > $('a[class!=whatever]').click(function(){ //do something });
>
> > Doesn't work. The function wont fire on either.
>
> > Is this just a slip up or is it for an actual reason?
>
> > Cheers,
> > Will
>
>

Reply via email to