diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-12-01 15:57:06 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-12-01 15:57:06 +0100 |
commit | 9546418c5ed9b1876132b43dff1ae690c3ec4e24 (patch) | |
tree | e291fe6c2443aeaaef99edf5fbc5cd1af336f43e /src/elements | |
parent | dbe9c376fd76dd4e4777281888f4092e38512c18 (diff) | |
parent | 947964e4a257b1b1fcc9b115a218a9d8dde7513f (diff) | |
download | svg.js-9546418c5ed9b1876132b43dff1ae690c3ec4e24.tar.gz svg.js-9546418c5ed9b1876132b43dff1ae690c3ec4e24.zip |
Merge branch '790-color-spaces' into 3.0.0
Diffstat (limited to 'src/elements')
-rw-r--r-- | src/elements/A.js | 4 | ||||
-rw-r--r-- | src/elements/Defs.js | 8 | ||||
-rw-r--r-- | src/elements/Dom.js | 4 | ||||
-rw-r--r-- | src/elements/Element.js | 14 | ||||
-rw-r--r-- | src/elements/Line.js | 2 | ||||
-rw-r--r-- | src/elements/Marker.js | 6 | ||||
-rw-r--r-- | src/elements/Svg.js | 10 |
7 files changed, 28 insertions, 20 deletions
diff --git a/src/elements/A.js b/src/elements/A.js index 722deed..ef047a2 100644 --- a/src/elements/A.js +++ b/src/elements/A.js @@ -31,7 +31,9 @@ registerMethods({ linkTo: function (url) { var link = new A() - if (typeof url === 'function') { url.call(link, link) } else { + if (typeof url === 'function') { + url.call(link, link) + } else { link.to(url) } diff --git a/src/elements/Defs.js b/src/elements/Defs.js index 2826611..6b486ca 100644 --- a/src/elements/Defs.js +++ b/src/elements/Defs.js @@ -6,8 +6,12 @@ export default class Defs extends Container { super(nodeOrNew('defs', node), node) } - flatten () { return this } - ungroup () { return this } + flatten () { + return this + } + ungroup () { + return this + } } register(Defs) diff --git a/src/elements/Dom.js b/src/elements/Dom.js index fa4ed08..ff33d46 100644 --- a/src/elements/Dom.js +++ b/src/elements/Dom.js @@ -79,7 +79,7 @@ export default class Dom extends EventTarget { var i, il for (i = 0, il = children.length; i < il; i++) { - block.apply(children[i], [i, children]) + block.apply(children[i], [ i, children ]) if (deep) { children[i].each(block, deep) @@ -260,7 +260,7 @@ export default class Dom extends EventTarget { if (result === false) { this.remove() - // If modifier returns new node, use it + // If modifier returns new node, use it } else if (result && this !== _this) { this.replace(_this) } diff --git a/src/elements/Element.js b/src/elements/Element.js index 91aa3e0..594daa1 100644 --- a/src/elements/Element.js +++ b/src/elements/Element.js @@ -74,10 +74,10 @@ export default class Element extends Dom { inside (x, y) { let box = this.bbox() - return x > box.x && - y > box.y && - x < box.x + box.width && - y < box.y + box.height + return x > box.x + && y > box.y + && x < box.x + box.width + && y < box.y + box.height } // Move element to given x and y values @@ -92,9 +92,9 @@ export default class Element extends Dom { let parent = this while ( - (parent = parent.parent()) && - parent.node !== until.node && - parent.node !== globals.document + (parent = parent.parent()) + && parent.node !== until.node + && parent.node !== globals.document ) { parents.push(parent) } diff --git a/src/elements/Line.js b/src/elements/Line.js index 99e7497..edf10e7 100644 --- a/src/elements/Line.js +++ b/src/elements/Line.js @@ -59,7 +59,7 @@ registerMethods({ // x1 is not necessarily a number, it can also be an array, a string and a PointArray return Line.prototype.plot.apply( this.put(new Line()) - , args[0] != null ? args : [0, 0, 0, 0] + , args[0] != null ? args : [ 0, 0, 0, 0 ] ) }) } diff --git a/src/elements/Marker.js b/src/elements/Marker.js index d40d13b..238f559 100644 --- a/src/elements/Marker.js +++ b/src/elements/Marker.js @@ -29,7 +29,9 @@ export default class Marker extends Container { this.clear() // invoke passed block - if (typeof block === 'function') { block.call(this, this) } + if (typeof block === 'function') { + block.call(this, this) + } return this } @@ -62,7 +64,7 @@ registerMethods({ marker: { // Create and attach markers marker (marker, width, height, block) { - var attr = ['marker'] + var attr = [ 'marker' ] // Build attribute name if (marker !== 'all') attr.push(marker) diff --git a/src/elements/Svg.js b/src/elements/Svg.js index 6172454..ab7d89f 100644 --- a/src/elements/Svg.js +++ b/src/elements/Svg.js @@ -17,9 +17,9 @@ export default class Svg extends Container { } isRoot () { - return !this.node.parentNode || - !(this.node.parentNode instanceof globals.window.SVGElement) || - this.node.parentNode.nodeName === '#document' + return !this.node.parentNode + || !(this.node.parentNode instanceof globals.window.SVGElement) + || this.node.parentNode.nodeName === '#document' } // Check if this is a root svg @@ -42,8 +42,8 @@ export default class Svg extends Container { defs () { if (!this.isRoot()) return this.root().defs() - return adopt(this.node.getElementsByTagName('defs')[0]) || - this.put(new Defs()) + return adopt(this.node.getElementsByTagName('defs')[0]) + || this.put(new Defs()) } // custom parent method |