mhemesath/r2d3 — pull request #33 by mbecica (2012-10-31 00:55:58+00:00)
Title: Groups.extend

Hey @mhemesath -

This is sadly not working yet in ie7 / ie8, so its not ready for merging, but wanted to get your opinion.

My approach: I mimicked raphael as much as possible to define the group elements as raphael objects (the only thing I duplicated is the `$` function, but I can cut that back even more I think).

Everything is working as expected in svg.

In vml, the transform is simply not happening to the group element. Here's what I've debugged so far:
* Attributes are being set and removed to the group correctly in the data layer as well as the dom.
For example: `svg.append("g").attr("transform", "translate(10,10")` sets the matrix attribute of the group's skew element and `svg.selectAll("g").attr("transform")` returns the correct value. So setting and getting of attributes seems to be working correctly.
* For a while, I suspected it was the render order - that doing `g` then `transform` then `appendChild` would not affect the children. Or perhaps that the group would have to be rerendered after transform was set? This didn't go anywhere - doesn't matter when the transform is applied.

I'm starting to hit walls with this, and I'm thinking that transforming a `group` element doesn't make sense in vml. The vml html generated from my implementation, when appending a shape to a group, is:

```html

```

The `fill` `stroke` and `skew` elements within the `shape` are straight from raphael - these are subelements in vml and are generating what the element looks like.

On going back to the vml docs, [looking at how matrix works on a skew element](http://msdn.microsoft.com/en-us/library/hh846327.aspx#skew_element), it says "The skew is applied to vector graphic data, not image data." With a group, there is no vector graphic data. With a shape in vml there is always a path defined, and from what I understand, the skew gets applied to that path, not the shape element.

I'm now trying to solve this with a solution closer to raphael's sets - everytime an appendChild happens, I apply the parent transform to the child shape. I haven't gotten it working correctly yet but I'm close.