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

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

Open
happyboy2k opened this issue Jun 20, 2024 · 1 comment
Open

Comments

@happyboy2k
Copy link

happyboy2k commented Jun 20, 2024

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

@teotenn
Copy link

teotenn commented Sep 16, 2024

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.

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