From: Ulrich-Matthias Schäfer Date: Fri, 10 Apr 2020 05:50:36 +0000 (+1000) Subject: remove targets from Path because its in TextPath already X-Git-Tag: 3.1.0~56 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=707098f081c5821af6173508a966a158d84bc741;p=svg.js.git remove targets from Path because its in TextPath already --- diff --git a/spec/spec/elements/Path.js b/spec/spec/elements/Path.js index e388fdb..d43857e 100644 --- a/spec/spec/elements/Path.js +++ b/spec/spec/elements/Path.js @@ -132,15 +132,6 @@ describe('Path.js', () => { }) }) - describe('targets()', () => { - it('gets all targets of this path', () => { - const canvas = SVG().addTo(container) - const path = canvas.path('M0 0 50, 50') - const textPath = canvas.text('Hello World').path(path) - expect(path.targets()).toEqual([ textPath ]) - }) - }) - describe('width()', () => { it('gets the width of the path', () => { const canvas = SVG().addTo(container) diff --git a/src/elements/Path.js b/src/elements/Path.js index 018a8c6..ae2fac6 100644 --- a/src/elements/Path.js +++ b/src/elements/Path.js @@ -3,7 +3,6 @@ import { proportionalSize } from '../utils/utils.js' import { registerMethods } from '../utils/methods.js' import PathArray from '../types/PathArray.js' import Shape from './Shape.js' -import baseFind from '../modules/core/selector.js' export default class Path extends Shape { // Initialize node @@ -44,10 +43,6 @@ export default class Path extends Shape { return this.attr('d', this.array().size(p.width, p.height)) } - targets () { - return baseFind('svg textpath [href*="' + this.id() + '"]') - } - // Set width of element width (width) { return width == null ? this.bbox().width : this.size(width, this.bbox().height) diff --git a/src/elements/TextPath.js b/src/elements/TextPath.js index fde8131..e4208c2 100644 --- a/src/elements/TextPath.js +++ b/src/elements/TextPath.js @@ -92,7 +92,7 @@ registerMethods({ }), targets () { - return baseFind('svg [*|href*="' + this.id() + '"]') + return baseFind('svg textPath[*|href*="' + this.id() + '"]') } } })