Merge pull request #26 from fsih/fixPaintTspans

Test for getAttribute before calling
This commit is contained in:
DD Liu 2019-07-29 11:21:04 -04:00 committed by GitHub
commit bd2252651b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -318,6 +318,10 @@ new function() {
var spacing = 1.2;
for (var i = 0; i < node.childNodes.length; i++) {
var child = node.childNodes[i];
// node.childNodes includes plaintext as well as elements.
// By checking for getAttribute, we ignore plaintext
// (node.children gets only elements but is not supported on Safari)
if (!child.getAttribute) continue;
lines.push(child.textContent);
var dyString = child.getAttribute('dy');
if (dyString) {