mhemesath/r2d3 — pull request #51 by cronco (2012-12-06 14:29:40+00:00)
Title: Add insertBefore on Raphael Sets to correspond to specs.

The spec for [document.insertBefore](https://developer.mozilla.org/en-US/docs/DOM/Node.insertBefore) says that if you can't find the element you want to insert before, you just append the new element and return it.

Raphael sets don't have an insertBefore method, only elements, so Raphael falls back to

```javascript
var setproto = R.st;
for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) {
setproto[method] = (function (methodname) {
return function () {
var arg = arguments;
return this.forEach(function (el) {
el[methodname].apply(el, arg);
});
};
})(method);
```

which doesn't have the edge case of an empty set.

Adding this fixes axes, at least in the cases I've tested.