1
0
Fork 0

Now with tests!

This commit is contained in:
Wouter van Wageningen 2023-04-20 18:30:40 +00:00
parent f47e09768e
commit 9ed72e9f45
3 changed files with 39 additions and 4 deletions

View file

@ -61,7 +61,7 @@ Defs.prototype.remove = function (name) {
Defs.prototype.render = function () {
let svg = ''
for (let key in this.list) {
svg += ` ${key}="${this.list[key].join('')}"`
svg += ` ${key}="${this.list[key]}"`
}
return svg
@ -75,7 +75,7 @@ Defs.prototype.render = function () {
* @return {Defs} this - The Defs instance
*/
Defs.prototype.set = function (name, value) {
this.list[name] = [value]
this.list[name] = value
return this
}
@ -88,6 +88,6 @@ Defs.prototype.set = function (name, value) {
* @return {Defs} this - The Defs instance
*/
Defs.prototype.setIfUnset = function (name, value) {
if (typeof this.list[name] === 'undefined') this.list[name] = [value]
if (typeof this.list[name] === 'undefined') this.list[name] = value
return this
}