Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html4 macro incorrectly leaves script tags unclosed #126

Open
pkalliok opened this issue Jan 13, 2016 · 1 comment
Open

html4 macro incorrectly leaves script tags unclosed #126

pkalliok opened this issue Jan 13, 2016 · 1 comment

Comments

@pkalliok
Copy link

When I write HTML4 templates, Hiccup produces markup without closing tags for <script>:

user=> (require '[hiccup.page :refer [html4]])
nil
user=> (html4 [:head [:script {:src "foo.js" :type "text/javascript"}]])
"\n<script src="foo.js" type="text/javascript">"

However, the HTML 4.01 specification clearly requires end tags for <script>:
http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.1

This bug breaks HTML4 markup massively for e.g. Firefox (nothing after first script element ever gets parsed because it's all taken to be part of the script).

@zerg000000
Copy link

It seems because the html4 macro set html-mode as :sgml, which have no handling is defined. The default rendering would render all empty tag with no end tag.

Solution 1

consider :sgml as html, share the void tags with :html, :xhtml

(defn- html-mode? []
  (#{:html :xhtml :sgml} util/*html-mode*))

Solution 2

define a separate void-tags for :sgml, for html4,

BR AREA LINK IMG PARAM HR INPUT COL BASE META

https://www.w3.org/TR/REC-html40/sgml/dtd.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants