diff options
author | wout <wout@impinc.co.uk> | 2013-01-29 11:49:38 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-01-29 11:49:38 +0100 |
commit | 293ef89f8d00d1623d8d2edd79d3af7bc765c002 (patch) | |
tree | ba11157a9fd336033d6123712fd387d9461fdbf5 /src/svg.js | |
parent | 66d7cb4377cd5dd6363fc1a7f8f62552f85d70c0 (diff) | |
download | svg.js-293ef89f8d00d1623d8d2edd79d3af7bc765c002.tar.gz svg.js-293ef89f8d00d1623d8d2edd79d3af7bc765c002.zip |
Modified extension method to include all SVG.Container elements
Diffstat (limited to 'src/svg.js')
-rw-r--r-- | src/svg.js | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -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 |