summaryrefslogtreecommitdiffstats
path: root/src/set.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-02-01 14:27:31 +0100
committerwout <wout@impinc.co.uk>2014-02-01 14:27:31 +0100
commitf047e3c3aad7920df978a2dbc758a961112c9d43 (patch)
treed97689f6563aebd823d1190cc76809073da3a449 /src/set.js
parent745a0148c9de8c14367507eb21355604a42e84d5 (diff)
downloadsvg.js-f047e3c3aad7920df978a2dbc758a961112c9d43.tar.gz
svg.js-f047e3c3aad7920df978a2dbc758a961112c9d43.zip
Added index() method to SVG.Parent and SVG.Set
Diffstat (limited to 'src/set.js')
-rwxr-xr-xsrc/set.js8
1 files changed, 6 insertions, 2 deletions
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) {