anaskhan96 / soup

Web Scraper in Go, similar to BeautifulSoup
MIT License
2.18k stars 168 forks source link

Find/FindAll with an empty string will match any tag #33

Closed dustmop closed 5 years ago

anaskhan96 commented 5 years ago

Why would there be a reason to make Find/FindAll match the first tag they come across? What would this achieve?

dustmop commented 5 years ago

The primary purpose is allowing Find("", "id", "content") to match a tag with a specific attribute regardless of the tag name. Yes, using just Find("") is less useful, but it's just a natural consequence of the semantic change.

anaskhan96 commented 5 years ago

Alright. Looks nothing but helpful to me. Maybe will move from string matching to regex in a later iteration across everywhere, will provide more flexibility. Merged for now @dustmop , thank you!