Skip to content

Commit 44ff314

Browse files
committed
fix(core/hightlight): fall back to textContent for Safari
1 parent 9c2bda9 commit 44ff314

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/highlight.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ async function highlightElement(elem) {
3333
const languages = getLanguageHint(elem.classList);
3434
let response;
3535
try {
36-
response = await sendHighlightRequest(elem.innerText, languages);
36+
// Safari return "" for innerText when the document is hidden
37+
const code = elem.innerText ? elem.innerText : elem.textContent;
38+
response = await sendHighlightRequest(code, languages);
3739
} catch (err) {
3840
console.error(err);
3941
return;

0 commit comments

Comments
 (0)