aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-01-25 15:19:44 +0100
committerwout <wout@impinc.co.uk>2014-01-25 15:19:44 +0100
commit4eb82d6002258266717ab2edf1a686c3e2fb31fd (patch)
treefd37e96128482f04be7ed30ad58998b6df76aa6b /README.md
parentb48f03348ba04fb875c193f7e630fb35601bd9fe (diff)
downloadsvg.js-4eb82d6002258266717ab2edf1a686c3e2fb31fd.tar.gz
svg.js-4eb82d6002258266717ab2edf1a686c3e2fb31fd.zip
Updated README and version references
Diffstat (limited to 'README.md')
-rw-r--r--README.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/README.md b/README.md
index ce89c2e..2c1507a 100644
--- a/README.md
+++ b/README.md
@@ -456,6 +456,44 @@ Similarly, the node carries a reference to the svg.js `instance`:
node.instance
```
+### Parent reference
+Every element has a reference to its parent:
+
+```javascript
+element.parent
+```
+
+Even the main svg document:
+
+```javascript
+var draw = SVG('drawing')
+
+draw.parent //-> returns the wrappig html element with id 'drawing'
+```
+
+For more specific parent filtering the `doc()` method can be used:
+
+```javascript
+var draw = SVG('drawing')
+var rect = draw.rect(100, 100)
+
+rect.doc() //-> returns draw
+```
+
+Alternatively a class can be passed as the first argument:
+
+```javascript
+var draw = SVG('drawing')
+var nested = draw.nested()
+var group = nested.group()
+var rect = group.rect(100, 100)
+
+rect.doc() //-> returns draw
+rect.doc(SVG.Doc) //-> returns draw
+rect.doc(SVG.Nested) //-> returns nested
+rect.doc(SVG.G) //-> returns group
+```
+
## Manipulating elements