summaryrefslogtreecommitdiffstats
path: root/src/svg.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/svg.js')
-rw-r--r--src/svg.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/svg.js b/src/svg.js
index eb5f348..d0e4188 100644
--- a/src/svg.js
+++ b/src/svg.js
@@ -13,19 +13,29 @@ this.svg = function(element) {
// The main wrapping element
this.SVG = {
- // Default namespaces
+ /* default namespaces */
ns: 'http://www.w3.org/2000/svg',
xlink: 'http://www.w3.org/1999/xlink',
- // Defs id sequence
+
+ /* defs id sequence */
did: 0,
+
// Method for element creation
create: function(element) {
return document.createElementNS(this.ns, element);
},
// Method for extending objects
extend: function(object, module) {
- for (var key in module)
- object.prototype[key] = module[key];
+ /* extend all container modules */
+ if (object === SVG.Container)
+ ('Clip Defs Doc Gradient Group Mask Nested Pattern').split(' ').forEach(function(m) {
+ if (SVG[m])
+ SVG.extend(SVG[m], module);
+ });
+ /* extend given module */
+ else
+ for (var key in module)
+ object.prototype[key] = module[key];
}
}; \ No newline at end of file