JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<div rel="one"></div>
<div rel="one"></div>
<div rel="two"></div>
<div rel="one"></div>
<div rel="three"></div>
<div rel="three"></div>
<div rel="one"></div>
JavaScript
$.grep = function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
// added new Array as arg------------v
retVal = !!callback( elems[ i ], i, ret );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
};
var arr =
$.grep(
$('div').map(function() { return $(this).attr('rel'); } ).get(),
function( v, i, arr ) { return $.inArray( v, arr ) === -1; } // exclude dupes
);
document.write( arr );