cgrand/enlive

[BUG] Some tags are loosing part of their content when selected.

happyboy2k opened this issue · 1 comments

Hi,
I really like your library and use it quite frequently. So I think I found a bug:

(-> "<td><div>hello</div><h1>hi</h1></td>" html/html-snippet (html/select [:div]))

({:tag :div, :attrs nil, :content ("hello")})
I was expecting the h1 tag to be returned too since it's also content of the td tag.

Greetings

I am having similar issues:

(def input-html "<div><h1><p>A title</p></h1><h2><p>A subtitle</p></h2></div>")


(let [parsed-html (html/html-snippet input-html)]
  (html/select parsed-html [:h1]))

Returns only ({:tag :h1, :attrs nil, :content nil}) and then, when I look into the node:

(let [parsed-html (html/html-snippet input-html)]
  parsed-html)

;; Returns
({:tag :div,
  :attrs nil,
  :content
  ({:tag :h1, :attrs nil, :content nil}
   {:tag :p, :attrs nil, :content ("A title")}
   {:tag :h2, :attrs nil, :content nil}
   {:tag :p, :attrs nil, :content ("A subtitle")})})

I would expect to have the p tags inside the header sections.