Selectors - avoid duplicates

0 views
Skip to first unread message

mmjaeger

unread,
Nov 7, 2009, 11:51:25 PM11/7/09
to MooTools Users
Hello
I'm having the following piece of code: $$('a[rel=external]','a
[target=_blank]')

this basically returns all links that have either or both of the rel/
target attributes - how do I avoid duplicates?

Is there a way just by the selector or some array mapping function?

thanks

Sanford Whiteman

unread,
Nov 8, 2009, 12:17:05 AM11/8/09
to mmjaeger
> this basically returns all links that have either or both of the rel/
> target attributes - how do I avoid duplicates?

What do you mean by "duplicates"? The same element should not be
returned twice even if it matches more than one of the passed
selectors.

-- Sandy


Oskar Krawczyk

unread,
Nov 8, 2009, 5:19:22 AM11/8/09
to mootool...@googlegroups.com
Have you even checked this code? It's not returning any duplicates: http://mooshell.net/yFUTA/

mmjaeger

unread,
Nov 8, 2009, 9:41:04 AM11/8/09
to MooTools Users
you guys are right - what confused me was that on a client site I all
the sudden saw two pictures on the link instead of one - my first
thought was that the picture gets applied to the link twice - however,
there were two links next to each other and one of them had no text.

thanks anyway
Reply all
Reply to author
Forward
0 new messages