cgrand/enlive

html a element is parsed incorrectly in snippet

deniskr opened this issue · 2 comments

When I created a snipped from html file with the following construct:

<a href="http://www.privet.com"><h1>ff</h1></a>

the "h1" element becomes a sibling of "a" element, instead of being its child.

To reproduce this bug use this closure source:

(ns com.ddkmobile.cl3
  (:require [net.cgrand.enlive-html :as html]))

(html/defsnippet snip1 "com/ddkmobile/index.html"
                 [:body]
                 []
                 )
(println (snip1))

And this html file:

<html>
    <body>
        <a href="http://www.privet.com"><h1>ff</h1></a>
    </body>
</html>

Hi,

It's Tagsoup way of fixing HTML but some things such are your example is now valid HTML5 so you should tell Enlive to use jsoup instead of Tagsoup.

(e/set-ns-parser! net.cgrand.jsoup/parser)

Got it. Thanks a lot for your answer.