This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 46c85ec11d Do not use template literals to construct html elements 
(#30447)
46c85ec11d is described below

commit 46c85ec11d224c133da6c45c1186c9aa498a7e75
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Fri Apr 7 15:18:58 2023 +0200

    Do not use template literals to construct html elements (#30447)
---
 airflow/www/static/js/task.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/airflow/www/static/js/task.js b/airflow/www/static/js/task.js
index e3c8c6e608..349e4b5317 100644
--- a/airflow/www/static/js/task.js
+++ b/airflow/www/static/js/task.js
@@ -25,10 +25,20 @@ document.addEventListener("DOMContentLoaded", () => {
     const value = attr.innerHTML;
     if (value.length === 32 && moment(value, "YYYY-MM-DD").isValid()) {
       // 32 is the length of our timestamps
-      attr.innerHTML = `<time datetime="${value}">${value}</time>`;
+      attr.innerHTML = "";
+      const timeElement = document.createElement("time");
+      timeElement.setAttribute("datetime", value);
+      const textNode = document.createTextNode(value);
+      timeElement.appendChild(textNode);
+      attr.appendChild(timeElement);
     } else if (value.includes("http")) {
       // very basic url detection
-      attr.innerHTML = `<a href=${value}>${value}</a>`;
+      attr.innerHTML = "";
+      const linkElement = document.createElement("a");
+      linkElement.setAttribute("href", value);
+      const textNode = document.createTextNode(value);
+      linkElement.appendChild(textNode);
+      attr.appendChild(linkElement);
     }
   });
 });

Reply via email to