Commit 47addb3c by Dmitry Baranovskiy

Fixed plugins.

parent b600ebcb
...@@ -591,13 +591,16 @@ window.Raphael = (function () { ...@@ -591,13 +591,16 @@ window.Raphael = (function () {
} }
}, },
plugins = function (con, add) { plugins = function (con, add) {
var that = this;
for (var prop in add) if (add.hasOwnProperty(prop) && !(prop in con)) { for (var prop in add) if (add.hasOwnProperty(prop) && !(prop in con)) {
switch (typeof add[prop]) { switch (typeof add[prop]) {
case "function": case "function":
con[prop] = con === this ? add[prop] : function () { return add[prop].apply(this, arguments); }; (function (f) {
con[prop] = con === that ? f : function () { return f.apply(that, arguments); };
})(add[prop]);
break; break;
case "object": case "object":
con[prop] = {}; con[prop] = con[prop] || {};
plugins.call(this, con[prop], add[prop]); plugins.call(this, con[prop], add[prop]);
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment