diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-07-10 13:51:06 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-07-10 13:51:06 +0200 |
commit | bc9bfb6025e826b0ee6c827f1a356995d7f05d4c (patch) | |
tree | 6362deae3c6347b97dc902acdad26e9cb6047946 /src/text.js | |
parent | 932969dca9e1ef1090304d6a77ac8dd92a42730f (diff) | |
download | svg.js-bc9bfb6025e826b0ee6c827f1a356995d7f05d4c.tar.gz svg.js-bc9bfb6025e826b0ee6c827f1a356995d7f05d4c.zip |
use `children` instead of `childNodes` (#710), renamed `previous()` to `prev()`
Diffstat (limited to 'src/text.js')
-rw-r--r-- | src/text.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/text.js b/src/text.js index 1e93db7..fa14894 100644 --- a/src/text.js +++ b/src/text.js @@ -46,10 +46,11 @@ SVG.Text = SVG.invent({ // Set the text content , text: function(text) { // act as getter - if (typeof text === 'undefined'){ + if (text === undefined){ var text = '' - var children = this.node.childNodes - var firstLine = 0 + , children = this.node.childNodes + , firstLine = 0 + for(var i = 0, len = children.length; i < len; ++i){ // skip textPaths - they are no lines if(children[i].nodeName == 'textPath') { @@ -114,11 +115,11 @@ SVG.Text = SVG.invent({ var self = this , blankLineOffset = 0 , dy = this.dom.leading * new SVG.Number(this.attr('font-size')) - + this.each(function() { if (this.dom.newLined) { this.attr('x', self.attr('x')) - + if(this.text() == '\n') { blankLineOffset += dy }else{ |