Returns an array containing values for the given type of property for each element in the collection.
Values for type
are:
attr
an attribute on the elementcss
a css propertydata
a Pablo data propertyprop
a JavaScript property on the element object
Example: collection.pluck('css', 'color')
or collection.pluck('attr', 'height')
Plucking attributes:
var collection = Pablo();
collection.push(Pablo.rect({height:10}));
collection.push(Pablo.rect({height:70}));
collection.push(Pablo.rect({height:20}));
alert(collection.pluck('attr', 'height'))
Plucking data:
var collection = Pablo();
collection.push(Pablo.a());
collection.push(Pablo.a());
collection.push(Pablo.a());
collection.eq(0).data('numbers', 123);
collection.eq(1).data('numbers', 456);
collection.eq(2).data('numbers', 789);
alert(collection.pluck('data', 'numbers'));
Plucking DOM object properties:
var collection = Pablo();
collection.push(Pablo.a());
collection.push(Pablo.a());
collection.push(Pablo.a());
collection[0].myprop = 123;
collection[1].myprop = 456;
collection[2].myprop = 789;
alert(collection.pluck('prop', 'myprop'));