summaryrefslogtreecommitdiffstats
path: root/src/HtmlNode.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-25 23:28:12 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-25 23:28:12 +0200
commitcfdfcc529dedff770dc54e78d2900d9a790f5766 (patch)
tree7b59c282a7823ded1d182aca95da5d55815456b2 /src/HtmlNode.js
parent464af8b747389b7fdb569a933591c863b9be0f6b (diff)
downloadsvg.js-cfdfcc529dedff770dc54e78d2900d9a790f5766.tar.gz
svg.js-cfdfcc529dedff770dc54e78d2900d9a790f5766.zip
convert everything to es6 classes and imports
Diffstat (limited to 'src/HtmlNode.js')
-rw-r--r--src/HtmlNode.js40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/HtmlNode.js b/src/HtmlNode.js
index e04b731..4a12d3f 100644
--- a/src/HtmlNode.js
+++ b/src/HtmlNode.js
@@ -1,29 +1,27 @@
-/* global createElement */
+import {makeInstance} from './helpers.js'
+import EventTarget from './EventTarget.js'
-SVG.HtmlNode = SVG.invent({
- inherit: SVG.EventTarget,
- create: function (element) {
+export default class HtmlNode extends EventTarget {
+ constructor (element) {
this.node = element
- },
+ }
- extend: {
- add: function (element, i) {
- element = createElement(element)
+ add (element, i) {
+ element = makeInstance(element)
- if (element.node !== this.node.children[i]) {
- this.node.insertBefore(element.node, this.node.children[i] || null)
- }
+ if (element.node !== this.node.children[i]) {
+ this.node.insertBefore(element.node, this.node.children[i] || null)
+ }
- return this
- },
+ return this
+ }
- put: function (element, i) {
- this.add(element, i)
- return element
- },
+ put (element, i) {
+ this.add(element, i)
+ return element
+ }
- getEventTarget: function () {
- return this.node
- }
+ getEventTarget () {
+ return this.node
}
-})
+}