aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
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 /README.md
parent745a0148c9de8c14367507eb21355604a42e84d5 (diff)
downloadsvg.js-f047e3c3aad7920df978a2dbc758a961112c9d43.tar.gz
svg.js-f047e3c3aad7920df978a2dbc758a961112c9d43.zip
Added index() method to SVG.Parent and SVG.Set
Diffstat (limited to 'README.md')
-rw-r--r--README.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/README.md b/README.md
index 69842b1..c20c268 100644
--- a/README.md
+++ b/README.md
@@ -551,6 +551,17 @@ draw.has(rect) //-> returns true
group.has(rect) //-> returns false
```
+### index()
+Returns the index of given element and retuns -1 when it is not a child:
+
+```javascript
+var rect = draw.rect(100, 50)
+var group = draw.group()
+
+draw.index(rect) //-> returns 0
+group.index(rect) //-> returns -1
+```
+
### get()
Get an element on a given position in the children array:
@@ -1513,6 +1524,13 @@ Determine if an element is member of the set:
set.has(rect) //-> returns true of false
```
+### index()
+Returns the index of a given element in the set.
+
+```javascript
+set.index(rect) //-> -1 if element is not a member
+```
+
### get()
Get the element at a given index: