Skip to content

Commit

Permalink
Fixes linePadding as applied to ruby elements (#237)
Browse files Browse the repository at this point in the history
* Create `span` instead of `rb` elements, which are currently deprecated in HTML
* Correctly puts the background-color attribute on merged spans

Co-authored-by: Pierre-Anthony Lemieux <pal@sandflow.com>
  • Loading branch information
nigelmegitt and palemieux authored Nov 21, 2022
1 parent ce3b1f4 commit 7716bcc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/js/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@

} else if (isd_element.styleAttrs[imscStyles.byName.ruby.qname] === "base") {

e = document.createElement("rb");
e = document.createElement("span"); // rb element is deprecated in HTML

} else if (isd_element.styleAttrs[imscStyles.byName.ruby.qname] === "text") {

Expand Down Expand Up @@ -649,7 +649,11 @@

} else {

if (element.parentElement.nodeName === "SPAN") {
if (element.parentElement.nodeName === "SPAN" ||
element.parentElement.nodeName === "RUBY" ||
element.parentElement.nodeName === "RBC" ||
element.parentElement.nodeName === "RTC" ||
element.parentElement.nodeName === "RT") {

return getSpanAncestorColor(element.parentElement, ancestorList, true);

Expand Down Expand Up @@ -882,7 +886,7 @@

var ruby = document.createElement("ruby");

var rb = document.createElement("rb");
var rb = document.createElement("span"); // rb element is deprecated in HTML
rb.textContent = "\u200B";

ruby.appendChild(rb);
Expand Down

0 comments on commit 7716bcc

Please sign in to comment.