Back
javascript-tag (clj)
(source)function
(javascript-tag script)
Wrap the supplied javascript up in script tags and a CDATA section.
Examples
hiccup
(ns hiccup.element_test
(:require [clojure.test :refer :all]
[hiccup.element :refer :all])
(:import java.net.URI))
(deftest javascript-tag-test
(is (= (javascript-tag "alert('hello');")
[:script {:type "text/javascript"}
"//<![CDATA[\nalert('hello');\n//]]>"])))
weavejester/hiccup
(ns hiccup.element_test
(:require [clojure.test :refer :all]
[hiccup.element :refer :all])
(:import java.net.URI))
(deftest javascript-tag-test
(is (= (javascript-tag "alert('hello');")
[:script {:type "text/javascript"}
"//<![CDATA[\nalert('hello');\n//]]>"])))
robert-stuttaford/demo-enfocus-pubsub-remote
(ns depr.views.main
(:require [noir.core :as noir]
[hiccup.page :as page]
[hiccup.element :as element]))
(noir/defpartial js-app
[js]
(list
;; avoid loading deps.js in whitespace mode
(if (re-find #"debug" js) (element/javascript-tag "var CLOSURE_NO_DEPS = true;"))
(page/include-js (str "/js/" js ".js"))
(element/javascript-tag "depr.app.run()")))