diff options
author | wout <wout@impinc.co.uk> | 2013-02-27 20:36:17 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-02-27 20:36:17 +0100 |
commit | e9fa07a7b33b8f19c0690b0fc3df2f57a404d224 (patch) | |
tree | fe7af0f65d7a0b4b1177a225e3ac885c62fa4bca /src/svg.js | |
parent | 968406ea2f45e756f081268370703c522a929cfb (diff) | |
download | svg.js-e9fa07a7b33b8f19c0690b0fc3df2f57a404d224.tar.gz svg.js-e9fa07a7b33b8f19c0690b0fc3df2f57a404d224.zip |
Bumped to v0.7 with reworked id sequence, attr nullifier, and various other fixes
Diffstat (limited to 'src/svg.js')
-rw-r--r-- | src/svg.js | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -18,12 +18,22 @@ this.SVG = { ns: 'http://www.w3.org/2000/svg' , xlink: 'http://www.w3.org/1999/xlink' - /* defs id sequence */ -, did: 0 - + /* element id sequence */ +, did: 1000 + + // Get next named element id +, eid: function(name) { + return 'Svgjs' + name.charAt(0).toUpperCase() + name.slice(1) + 'Element' + (SVG.did++) + } // Method for element creation -, create: function(element) { - return document.createElementNS(this.ns, element) +, create: function(name) { + /* create element */ + var element = document.createElementNS(this.ns, name) + + /* apply unique id */ + element.setAttribute('id', this.eid(name)) + + return element } // Method for extending objects , extend: function(object, module) { |