From 8a6b109353d1e3ff24b996ffa3f412fb2f94de90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulrich-Matthias=20Sch=C3=A4fer?= Date: Sat, 4 Apr 2020 21:25:32 +1000 Subject: [PATCH] renamed removeNamespace() --- CHANGELOG.md | 4 ++-- spec/spec/elements/Svg.js | 6 +++--- src/elements/Dom.js | 4 ++-- src/elements/Svg.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e39de5e..1152156 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,8 +20,8 @@ The document follows the conventions described in [“Keep a CHANGELOG”](http: - fixed adopter when adopting an svg/html string. It had still its wrapper as parentNode attached - fixed `put()` which correctly creates an svgjs object from the passed element now before returning - fixed `parent()` which correctly returns null if direct parent is the document or a document-fragment - - fixed `add()` which correctly removes namespaces of non-root svg elements now when added to another svg element - - fixed `isRoot()` which correctly returns false, if the element is in a document-fragment (#1081) + - fixed `add()` which correctly removes namespaces of non-root svg elements now when added to another svg element (#1086) + - fixed `isRoot()` which correctly returns false, if the element is in a document-fragment ### Added - added second Parameter to `SVG(el, isHTML)` which allows to explicitely create elements in the HTML namespace (#1058) diff --git a/spec/spec/elements/Svg.js b/spec/spec/elements/Svg.js index 804bdfd..f561366 100644 --- a/spec/spec/elements/Svg.js +++ b/spec/spec/elements/Svg.js @@ -100,10 +100,10 @@ describe('Svg.js', () => { }) }) - describe('removeNamespaces()', () => { + describe('removeNamespace()', () => { it('returns itself', () => { const svg = new Svg() - expect(svg.removeNamespaces()).toBe(svg) + expect(svg.removeNamespace()).toBe(svg) }) it('removes the namespace attributes from the svg element', () => { @@ -111,7 +111,7 @@ describe('Svg.js', () => { expect(svg.attr('xmlns')).toBe(ns) - svg.removeNamespaces() + svg.removeNamespace() expect(svg.attr('xmlns')).toBe(undefined) expect(svg.attr('version')).toBe(undefined) diff --git a/src/elements/Dom.js b/src/elements/Dom.js index ef51ad6..c523687 100644 --- a/src/elements/Dom.js +++ b/src/elements/Dom.js @@ -31,8 +31,8 @@ export default class Dom extends EventTarget { element = makeInstance(element) // If non-root svg nodes are added we have to remove their namespaces - if (element.removeNamespaces && this.node instanceof globals.window.SVGElement) { - element.removeNamespaces() + if (element.removeNamespace && this.node instanceof globals.window.SVGElement) { + element.removeNamespace() } if (i == null) { diff --git a/src/elements/Svg.js b/src/elements/Svg.js index 6672919..8699327 100644 --- a/src/elements/Svg.js +++ b/src/elements/Svg.js @@ -40,7 +40,7 @@ export default class Svg extends Container { .attr('xmlns:svgjs', svgjs, xmlns) } - removeNamespaces () { + removeNamespace () { return this.attr({ xmlns: null, version: null }) .attr('xmlns:xlink', null, xmlns) .attr('xmlns:svgjs', null, xmlns) -- 2.39.5