From f047e3c3aad7920df978a2dbc758a961112c9d43 Mon Sep 17 00:00:00 2001 From: wout Date: Sat, 1 Feb 2014 14:27:31 +0100 Subject: Added index() method to SVG.Parent and SVG.Set --- src/set.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/set.js') diff --git a/src/set.js b/src/set.js index 3808a91..9a6addc 100755 --- a/src/set.js +++ b/src/set.js @@ -22,7 +22,7 @@ SVG.extend(SVG.Set, { } // Remove element from set , remove: function(element) { - var i = this.members.indexOf(element) + var i = this.index(element) /* remove given child */ if (i > -1) @@ -46,7 +46,11 @@ SVG.extend(SVG.Set, { } // Checks if a given element is present in set , has: function(element) { - return this.members.indexOf(element) >= 0 + return this.index(element) >= 0 + } + // retuns index of given element in set +, index: function(element) { + return this.members.indexOf(element) } // Get member at given index , get: function(i) { -- cgit v1.2.3