From 024c498beeb7d49dd65babbcb498abee03346c19 Mon Sep 17 00:00:00 2001 From: constraintAutomaton Date: Tue, 8 Apr 2025 20:13:02 +0200 Subject: [PATCH] Fix DOM manipulation to avoid deprecated functions in Sudoku solver example. --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2cd8be48..68a4cec8 100644 --- a/README.md +++ b/README.md @@ -266,17 +266,24 @@ Then a `pkg` directory will be created, containing everything you need for a web } // Output results - document.write(`

Sudoku solver returns:

`); + const solutionDiv = document.querySelector("#soduku-solution"); for (const solution of formattedSolutions) { - document.write(`
${solution}
`); + const newPre = document.createElement("pre"); + newPre.textContent = solution; + solutionDiv.appendChild(newPre); } - - + +

Sudoku solver returns:

+
+ +
+ + ``` Then you can serve it with your favorite http server like `python -m http.server` or `npx serve`, and access the page with your browser. -- 2.54.0