diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
commit | 03322672782a6318b019eff33fe44ec800d6f12c (patch) | |
tree | 9d807e1585cf28a1ea98e87b855932dba00f1880 /src/elements/A.js | |
parent | 8e18b4698edd00f83af0be05bb3374f92fecaeb9 (diff) | |
download | svg.js-03322672782a6318b019eff33fe44ec800d6f12c.tar.gz svg.js-03322672782a6318b019eff33fe44ec800d6f12c.zip |
dependency updates, easier formatting
Diffstat (limited to 'src/elements/A.js')
-rw-r--r-- | src/elements/A.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/elements/A.js b/src/elements/A.js index 173fc92..231954f 100644 --- a/src/elements/A.js +++ b/src/elements/A.js @@ -1,24 +1,28 @@ -import { nodeOrNew, register, wrapWithAttrCheck, extend } from '../utils/adopter.js' +import { + nodeOrNew, + register, + wrapWithAttrCheck, + extend +} from '../utils/adopter.js' import { registerMethods } from '../utils/methods.js' import { xlink } from '../modules/core/namespaces.js' import Container from './Container.js' import * as containerGeometry from '../modules/core/containerGeometry.js' export default class A extends Container { - constructor (node, attrs = node) { + constructor(node, attrs = node) { super(nodeOrNew('a', node), attrs) } // Link target attribute - target (target) { + target(target) { return this.attr('target', target) } // Link url - to (url) { + to(url) { return this.attr('href', url, xlink) } - } extend(A, containerGeometry) @@ -31,7 +35,7 @@ registerMethods({ }) }, Element: { - unlink () { + unlink() { const link = this.linker() if (!link) return this @@ -48,7 +52,7 @@ registerMethods({ link.remove() return this }, - linkTo (url) { + linkTo(url) { // reuse old link if possible let link = this.linker() @@ -65,7 +69,7 @@ registerMethods({ return this }, - linker () { + linker() { const link = this.parent() if (link && link.node.nodeName.toLowerCase() === 'a') { return link |