I have a situation in Google Chrome where the element's innerText is getting directly changed by my css's text-transform: uppercase
. The mutation event is set off by a switch to and from contenteditable
on a parent div.
innerText is initially "xyz", but after the switching, element.innerText
is returning "XYZ" (still xyz in innerHTML).
let doct = document.getElementById("docTitle");
var changeDocumentTitle = function(e) {
console.log('changeDocumentTitle: ' + document.getElementById("docTitle").innerText);
};
// TODO: code for using mutation observer. Works in Firefox, ends up capitalizing the title in google
var observer = new MutationObserver(changeDocumentTitle);
var config = {
attributes: true,
childList: true,
subtree: true
};
observer.observe(doct, config);
#docTitle {
display: block;
font-size: 32px;
font-weight: 900;
color: inherit;
margin: 0.67em 0;
page-break-after: avoid font-family: Arial, sans-serif;
text-align: center;
text-transform: uppercase;
}
<h1 id="docTitle">xyz</h1>
I am seeing this in Chrome, but not in Firefox. Is this a bug in chrome? Is there a workaround? I thought of just trying to strip the html tag parts out of .innerHTML... Is that my best bet?