]> Repositorios git - scryer-prolog.git/commitdiff
Fix DOM manipulation to avoid deprecated functions in Sudoku solver example.
authorconstraintAutomaton <[email protected]>
Tue, 8 Apr 2025 18:13:02 +0000 (20:13 +0200)
committerconstraintAutomaton <[email protected]>
Tue, 8 Apr 2025 18:13:02 +0000 (20:13 +0200)
README.md

index 2cd8be486408b05bcd30fd0c173c357759523033..68a4cec8843a7e31f391378bfd288b635b9e31fd 100644 (file)
--- 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(`<p>Sudoku solver returns:</p>`);
+        const solutionDiv = document.querySelector("#soduku-solution");
         for (const solution of formattedSolutions) {
-            document.write(`<pre>${solution}</pre>`);
+            const newPre = document.createElement("pre");
+            newPre.textContent = solution;
+            solutionDiv.appendChild(newPre);
         }
-
     </script>
 </head>
 
-<body></body>
+<body>
+    <p>Sudoku solver returns:</p>
+    <div id="soduku-solution">
+
+    </div>
+</body>
 
 </html>
+
 ```
 
 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.