ElbertF/Raphael.JSON — pull request #8 by WebSeed (2012-02-19 16:50:25+00:00)
Title: Element filtering

Enables optional filtering of the serialised JSON elements. An example use case is when serialising elements with Raphael.FreeTransform applied - you may not want to serialise the FT handles etc. in which case you could check if the element itself had a 'freeTransform' property (in which case allow it to be serialised by returning true from the filter function).

Trivial example:

```javascript

var paper = Raphael(0, 0, 400, 400);

var circle = paper.circle(50, 50, 50).attr('fill', '#0f0');

var filter = function (el) {
return el.type === "circle"; // Only allow 'circles' to be serialised
};

paper.toJSON(filter);
```