javascriptの基本を理解していないようですが、
私は次のコードを持っています:
Raphael.fn.group = function() {
var out = Raphael._engine.group(this);
this.__set__ && this.__set__.push(out);
return out;
};
(window.Raphael.svg &&
function(e) {
e.group = function(svg) {
//Want this to be called $ function defined in Raphael._engine
// as var $=function(..){..}
// line 3780
var el = $("g");
svg.canvas && svg.canvas.appendChild(el);
var res = new Element(el, svg);
res.type = "group";
return res;
}
})(window.Raphael._engine);
var paper = Raphael("out", 800, 600);
//test with circle;
paper.circle(100, 100, 50);
//test with new method;
paper.group();
だから私は、コメントされた行に近い$がRaphael._engineスコープからではなく、グローバルスコープから取得されていることを発見しました。これは、_engineを拡張する方法です。