Skip to content

Commit

Permalink
handle empty code
Browse files Browse the repository at this point in the history
Co-authored-by: lwlinux <[email protected]>
  • Loading branch information
soyuka and lwlwilliam authored Oct 25, 2024
1 parent 6e65750 commit 2e50fbc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/interactive-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ class PHP {
async function main() {
let lastOutput = null;

document.querySelectorAll(".example").forEach((example) => {
document.querySelectorAll(".example .example-contents").forEach((example) => {
const button = document.createElement("button");
button.setAttribute("type", "button");
const phpcode = example.querySelector(".phpcode");
if (phpcode === null) {
return;
}

const code = phpcode.querySelector("code");
code.setAttribute("contentEditable", true);
Expand Down

0 comments on commit 2e50fbc

Please sign in to comment.