summaryrefslogtreecommitdiffstats
path: root/src/HtmlNode.js
diff options
context:
space:
mode:
authorSaivan <savian@me.com>2018-02-27 00:48:11 +1100
committerSaivan <savian@me.com>2018-02-27 00:48:11 +1100
commitbec7881979149425a9c1b894f4741413b28c8141 (patch)
tree3a496f834520925686af3a8059766b61b65be390 /src/HtmlNode.js
parentec0a8aee0e21a93b22c255dae6768a9ff7b09e73 (diff)
downloadsvg.js-bec7881979149425a9c1b894f4741413b28c8141.tar.gz
svg.js-bec7881979149425a9c1b894f4741413b28c8141.zip
The first half of the library complies with Standard linting
This commit reformats the code so that it complies with the standard linting style. Its currently a work in progress, but it is meant to pave the way for linting in the build process
Diffstat (limited to 'src/HtmlNode.js')
-rw-r--r--src/HtmlNode.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/HtmlNode.js b/src/HtmlNode.js
index 38309e3..37a231c 100644
--- a/src/HtmlNode.js
+++ b/src/HtmlNode.js
@@ -1,25 +1,24 @@
SVG.HtmlNode = SVG.invent({
- create: function(element) {
+ create: function (element) {
this.node = element
- }
+ },
-, extend: {
- add: function(element, i) {
+ extend: {
+ add: function (element, i) {
element = createElement(element)
- if(element instanceof SVG.Nested) {
+ if (element instanceof SVG.Nested) {
element = new SVG.Doc(element.node)
element.setData(JSON.parse(element.node.getAttribute('svgjs:data')) || {})
}
- if (i == null)
- this.node.appendChild(element.node)
- else if (element.node != this.node.children[i])
+ if (i === null) { this.node.appendChild(element.node) } else if (element.node !== this.node.children[i]) {
this.node.insertBefore(element.node, this.node.children[i])
+ }
return this
- }
+ },
- , put: function(element, i) {
+ put: function (element, i) {
this.add(element, i)
return element
}