Skip to content

Commit 2e50fbc

Browse files
soyukalwlwilliam
andauthored
handle empty code
Co-authored-by: lwlinux <1053317536@qq.com>
1 parent 6e65750 commit 2e50fbc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

js/interactive-examples.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ class PHP {
4848
async function main() {
4949
let lastOutput = null;
5050

51-
document.querySelectorAll(".example").forEach((example) => {
51+
document.querySelectorAll(".example .example-contents").forEach((example) => {
5252
const button = document.createElement("button");
5353
button.setAttribute("type", "button");
5454
const phpcode = example.querySelector(".phpcode");
55+
if (phpcode === null) {
56+
return;
57+
}
5558

5659
const code = phpcode.querySelector("code");
5760
code.setAttribute("contentEditable", true);

0 commit comments

Comments
 (0)