diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-01 15:04:55 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-01 15:04:55 +0100 |
commit | ac84c9be8051567cfcb28ccd7ea2652524bb8a6f (patch) | |
tree | 26c4e1d5a21e5c9a7ed492291bee26a2ecc4f9b0 /src/Element.js | |
parent | 4eba4508e4b9fd3a808e2d52f5c4d26af73becdd (diff) | |
download | svg.js-ac84c9be8051567cfcb28ccd7ea2652524bb8a6f.tar.gz svg.js-ac84c9be8051567cfcb28ccd7ea2652524bb8a6f.zip |
introduce register and registerMethod method to get rid of dependency problems
Diffstat (limited to 'src/Element.js')
-rw-r--r-- | src/Element.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/Element.js b/src/Element.js index 2b57af8..71b158b 100644 --- a/src/Element.js +++ b/src/Element.js @@ -1,9 +1,12 @@ import {proportionalSize, matcher} from './helpers.js' -import {makeInstance, adopt, assignNewId, eid} from './adopter.js' +import {makeInstance, adopt, assignNewId, eid, root, getClass} from './adopter.js' import {delimiter} from './regex.js' import {ns} from './namespaces.js' -import Doc from './Doc.js' import SVGNumber from './SVGNumber.js' +import {registerMethods} from './methods.js' +import {registerConstructor} from './methods.js' + +const Doc = getClass(root) export const name = 'Element' @@ -202,7 +205,7 @@ export function parent (type) { } } - // Get parent document +// Get parent document export function doc () { let p = this.parent(Doc) return p && p.doc() @@ -267,4 +270,11 @@ export function getEventTarget () { return this.node } -export {default as attr} from './attr.js' +registerMethods('Element', { + x, y, cx, cy, move, center, width, height, size, clone, remove, replace, + putIn, id, inside, toString, classes, hasClass, addClass, removeClass, + toggleClass, reference, doc, defs, parents, matches, native, svg, + writeDataToDom, setData, getEventTarget +}) + +registerConstructor('Element', setup) |