]> git.ardis.lu - static-encrypt/commitdiff
Replace <div> placeholder with <template>
authorArdis Lu <ardisglu@gmail.com>
Tue, 9 Jan 2024 06:38:49 +0000 (22:38 -0800)
committerArdis Lu <ardisglu@gmail.com>
Tue, 9 Jan 2024 06:38:49 +0000 (22:38 -0800)
<template> is more semantically correct and won't be confused for actual content.

index.html
template.html

index 8548f5de6a15acea63ccf9c350d06a7c0c94ce5a..aa1fc7ece86b989e293d979958f31dcddcfc5377 100644 (file)
       e.preventDefault();
       const encrypted = document.querySelector('#ciphertext').textContent;
       const scriptInjection = `<script>const content = '${encrypted}'; ${decrypt.toString()}<\/script>`;
-      const output = template.replace('<div>SCRIPT INJECTION</div>', scriptInjection);
+      const output = template.replace('<template id="script-injection"></template>', scriptInjection);
       downloadHtml(output, `${Date.now()}.html`);
     })
 
index 95dc4b76584bb75b532175dcce6db9fbf5a42ded..a896ad35f23ade81a62ab9274cd1dc0ec30c0a66 100644 (file)
@@ -54,7 +54,7 @@
     </form>
   </main>
 
-  <div>SCRIPT INJECTION</div>
+  <template id="script-injection"></template>
   <script>
     const input = document.querySelector('input');
 
This page took 0.040547 seconds and 4 git commands to generate.