aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-03-02 13:23:18 +0100
committerwout <wout@impinc.co.uk>2013-03-02 13:23:18 +0100
commit028bf91551d01567b4cb3d971ba51fa57c4a81ef (patch)
treeaff2f760942f61f2541317a3cf91edcfc15ae077 /README.md
parente9fa07a7b33b8f19c0690b0fc3df2f57a404d224 (diff)
downloadsvg.js-028bf91551d01567b4cb3d971ba51fa57c4a81ef.tar.gz
svg.js-028bf91551d01567b4cb3d971ba51fa57c4a81ef.zip
Code refactoring on element
Diffstat (limited to 'README.md')
-rw-r--r--README.md22
1 files changed, 17 insertions, 5 deletions
diff --git a/README.md b/README.md
index a537d39..34e97dd 100644
--- a/README.md
+++ b/README.md
@@ -176,27 +176,39 @@ text.font({
## Manipulating elements
### Attributes
-You can get and set an element's attributes directly using `attr()`:
+You can get and set an element's attributes directly using `attr()`.
+Get a single attribute:
```javascript
-// get a single attribute
rect.attr('x')
+```
-// set a single attribute
+Set a single attribute:
+```javascript
rect.attr('x', 50)
+```
-// set multiple attributes at once
+Set multiple attributes at once:
+```javascript
rect.attr({
fill: '#f06'
, 'fill-opacity': 0.5
, stroke: '#000'
, 'stroke-width': 10
})
+```
-// set an attribute with a namespace
+Set an attribute with a namespace:
+```javascript
rect.attr('x', 50, 'http://www.w3.org/2000/svg')
```
+Explicitly remove an attribute:
+```javascript
+rect.attr('fill', null)
+```
+
+
### Transform
With the `transform()` method elements can be scaled, rotated, translated and skewed: