Browse Source

ox-html.el: Use classList and put in the public domain

* lisp/ox-html.el (org-html-scripts): Fix a potential bug by using
the classList within the Javascript code, and put this new version
of the code in the public domain.

See <https://orgmode.org/list/20200617002335.l4lg3slfxm74vx3h@silver>

TINYCHANGE
Anthony Carrico 4 years ago
parent
commit
4710541365
1 changed files with 7 additions and 9 deletions
  1. 7 9
      lisp/ox-html.el

+ 7 - 9
lisp/ox-html.el

@@ -232,25 +232,23 @@ property on the headline itself.")
 
 (defconst org-html-scripts
   "<script type=\"text/javascript\">
-// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-v3-or-Later
+// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
 <!--/*--><![CDATA[/*><!--*/
      function CodeHighlightOn(elem, id)
      {
        var target = document.getElementById(id);
        if(null != target) {
-         elem.cacheClassElem = elem.className;
-         elem.cacheClassTarget = target.className;
-         target.className = \"code-highlighted\";
-         elem.className   = \"code-highlighted\";
+         elem.classList.add(\"code-highlighted\");
+         target.classList.add(\"code-highlighted\");
        }
      }
      function CodeHighlightOff(elem, id)
      {
        var target = document.getElementById(id);
-       if(elem.cacheClassElem)
-         elem.className = elem.cacheClassElem;
-       if(elem.cacheClassTarget)
-         target.className = elem.cacheClassTarget;
+       if(null != target) {
+         elem.classList.remove(\"code-highlighted\");
+         target.classList.remove(\"code-highlighted\");
+       }
      }
     /*]]>*///-->
 // @license-end