diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-10-25 23:03:47 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-10-25 23:03:47 +0100 |
commit | 81917ee7c714d0d7e3db4ec6471b734b62c63bfe (patch) | |
tree | 3f189d286493f9a72d6d890e6434e47de397d157 | |
parent | f72c867e7e3da9d8939ab67afaddee0755678ba4 (diff) | |
download | svg.js-81917ee7c714d0d7e3db4ec6471b734b62c63bfe.tar.gz svg.js-81917ee7c714d0d7e3db4ec6471b734b62c63bfe.zip |
updated docs
-rw-r--r-- | README.md | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -936,6 +936,23 @@ element.parent() __`returns`: `element`__ +Alternatively a class or css selector can be passed as the first argument: + +```javascript +var draw = SVG('drawing') +var nested = draw.nested().addClass('test') +var group = nested.group() +var rect = group.rect(100, 100) + +rect.parent() //-> returns group +rect.parent(SVG.Doc) //-> returns draw +rect.parent(SVG.Nested) //-> returns nested +rect.parent(SVG.G) //-> returns group +rect.parent('.test') //-> returns nested +``` + +__`returns`: `element`__ + Even the main svg document: ```javascript @@ -948,7 +965,7 @@ __`returns`: `HTMLNode`__ ### doc() -For more specific parent filtering the `doc()` method can be used: +For retrieving the root svg you can use `doc()` ```javascript var draw = SVG('drawing') @@ -957,21 +974,6 @@ 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 -``` -__`returns`: `element`__ - ## Child references ### first() |