diff options
author | wout <wout@impinc.co.uk> | 2014-02-01 14:27:31 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-02-01 14:27:31 +0100 |
commit | f047e3c3aad7920df978a2dbc758a961112c9d43 (patch) | |
tree | d97689f6563aebd823d1190cc76809073da3a449 /README.md | |
parent | 745a0148c9de8c14367507eb21355604a42e84d5 (diff) | |
download | svg.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.md | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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: |