Skip to content

Commit 7cfae27

Browse files
committed
fix(custom.js): Fallback to innerHTML
1 parent e173476 commit 7cfae27

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

assets/js/custom.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,19 @@ function replaceDetailSections() {
160160

161161
// move all children of the detail tag to the new section tag, except the <summary> tag
162162
const children = Array.from(detailTag.children);
163-
children.forEach(function (child) {
164-
if (child.tagName.toLocaleUpperCase() === "SUMMARY") {
165-
return;
166-
}
167-
// only add the child if it has content
168-
if (child.innerHTML.trim()) {
169-
sectionTag.appendChild(child);
170-
}
171-
});
163+
if(children.length > 0) {
164+
children.forEach(function (child) {
165+
if (child.tagName.toLocaleUpperCase() === "SUMMARY") {
166+
return;
167+
}
168+
// only add the child if it has content
169+
if (child.innerHTML.trim()) {
170+
sectionTag.appendChild(child);
171+
}
172+
});
173+
} else {
174+
sectionTag.innerHTML = detailTag.innerHTML;
175+
}
172176

173177
// remove the detail tag
174178
detailTag.parentNode.removeChild(detailTag);

0 commit comments

Comments
 (0)