Skip to content

Commit

Permalink
Fixed tts:rubyReserve on lines starting with a ruby container (sandfl…
Browse files Browse the repository at this point in the history
  • Loading branch information
palemieux authored and nigelmegitt committed Dec 11, 2020
1 parent 0917316 commit 75989e2
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/main/js/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,34 @@

}

var e = lineList[i].elements[0].node.parentElement.insertBefore(
ruby,
lineList[i].elements[0].node
);
/* add in front of the first ruby element of the line, if it exists */

var sib = null;

for (var j = 0; j < lineList[i].rbc.length; j++) {

if (lineList[i].rbc[j].localName === 'ruby') {

sib = lineList[i].rbc[j];

/* copy specified style properties from the sibling ruby container */

for(var k = 0; k < sib.style.length; k++) {

ruby.style.setProperty(sib.style.item(k), sib.style.getPropertyValue(sib.style.item(k)));

}

break;
}

}

/* otherwise add before first span */

sib = sib || lineList[i].elements[0].node;

sib.parentElement.insertBefore(ruby, sib);

}

Expand Down

0 comments on commit 75989e2

Please sign in to comment.