diff options
Diffstat (limited to 'src/elements/Use.js')
-rw-r--r-- | src/elements/Use.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/elements/Use.js b/src/elements/Use.js index 7921461..9237e08 100644 --- a/src/elements/Use.js +++ b/src/elements/Use.js @@ -4,24 +4,32 @@ import { xlink } from '../modules/core/namespaces.js' import Shape from './Shape.js' export default class Use extends Shape { - constructor (node) { - super(nodeOrNew('use', node), node) + + constructor ( node ) { + + super( nodeOrNew( 'use', node ), node ) + } // Use element as a reference - element (element, file) { + element ( element, file ) { + // Set lined element - return this.attr('href', (file || '') + '#' + element, xlink) + return this.attr( 'href', ( file || '' ) + '#' + element, xlink ) + } + } -registerMethods({ +registerMethods( { Container: { // Create a use element - use: wrapWithAttrCheck(function (element, file) { - return this.put(new Use()).element(element, file) - }) + use: wrapWithAttrCheck( function ( element, file ) { + + return this.put( new Use() ).element( element, file ) + + } ) } -}) +} ) -register(Use) +register( Use ) |