Added abillity to count children with matching properties

This commit is contained in:
Richard Davey 2017-10-25 16:07:08 +01:00
parent ca7acdc3bd
commit e0adac3ced

View file

@ -223,6 +223,23 @@ var List = new Class({
return output;
},
count: function (property, value)
{
var total = 0;
for (var i = 0; i < this.list.length; i++)
{
var child = this.list[i];
if (child[property] === value)
{
total++;
}
}
return total;
},
swap: function (child1, child2)
{
if (child1 === child2)