Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28701
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2015-09-20 10:11 -0700 |
| Message-ID | <43eec4db-3acf-4840-bfd0-af2ea843a69d@googlegroups.com> (permalink) |
| Subject | setting attributes from a namespace |
| From | Jay Braun <lyngwyst@gmail.com> |
I have a Javascript application where images are being displayed using SVG. The following works: I define the namespace, e.g.: var xmlns = "http://www.w3.org/2000/svg"; I create each element with a reference to the namespace, e.g.: var elem = document.createElementNS (xmlns, "path"); And then I assign attributes in this manner: elem.setAttributeNS(null, "fill", fillcolor); //fillcolor has been assigned This all works great. I wanted to see if my app would execute faster if I replaced the attribute assignment with something like: elem.fill = fillcolor; In other words, perhaps reducing the amount of text that the interpreter has to process, as well as reducing the number of function calls, might speed things up. But the elements are not drawn. The browser console indicates no syntax errors. Must I use setAttributeNS to make use of the SVG specification? Jay
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
setting attributes from a namespace Jay Braun <lyngwyst@gmail.com> - 2015-09-20 10:11 -0700
Re: setting attributes from a namespace Martin Honnen <mahotrash@yahoo.de> - 2015-09-20 20:44 +0200
Re: setting attributes from a namespace Jay Braun <lyngwyst@gmail.com> - 2015-09-20 13:49 -0700
Re: setting attributes from a namespace Martin Honnen <mahotrash@yahoo.de> - 2015-09-21 11:18 +0200
csiph-web