aboutsummaryrefslogtreecommitdiffstats
path: root/src/svg.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-02-27 20:36:17 +0100
committerwout <wout@impinc.co.uk>2013-02-27 20:36:17 +0100
commite9fa07a7b33b8f19c0690b0fc3df2f57a404d224 (patch)
treefe7af0f65d7a0b4b1177a225e3ac885c62fa4bca /src/svg.js
parent968406ea2f45e756f081268370703c522a929cfb (diff)
downloadsvg.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.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/svg.js b/src/svg.js
index f017e77..e56086b 100644
--- a/src/svg.js
+++ b/src/svg.js
@@ -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) {