diff options
author | wout <wout@impinc.co.uk> | 2014-01-25 15:19:44 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-01-25 15:19:44 +0100 |
commit | 4eb82d6002258266717ab2edf1a686c3e2fb31fd (patch) | |
tree | fd37e96128482f04be7ed30ad58998b6df76aa6b | |
parent | b48f03348ba04fb875c193f7e630fb35601bd9fe (diff) | |
download | svg.js-4eb82d6002258266717ab2edf1a686c3e2fb31fd.tar.gz svg.js-4eb82d6002258266717ab2edf1a686c3e2fb31fd.zip |
Updated README and version references
-rw-r--r-- | README.md | 38 | ||||
-rw-r--r-- | component.json | 2 | ||||
-rw-r--r-- | package.json | 2 |
3 files changed, 40 insertions, 2 deletions
@@ -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 diff --git a/component.json b/component.json index e8d28b8..0ac7476 100644 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "svg.js", "repo": "wout/svg.js", "description": "A lightweight library for manipulating and animating SVG", - "version": "0.35", + "version": "0.36", "keywords": ["svg"], "author": "Wout Fierens <wout@impinc.co.uk>", "main": "dist/svg.js", diff --git a/package.json b/package.json index ee58209..c7a9e7f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ , "keywords": ["svg", "vector", "graphics", "animation"] , "author": "Wout Fierens <wout@impinc.co.uk>" , "main": "dist/svg.js" -, "version": "v0.34" +, "version": "v0.36" , "jam": { "include": [ "dist/svg.js" |