Closed bradbeattie closed 6 years ago
I use bs3 myself, so I am not particularly familiar with bs4, but doing:
python3 -c "import bs4; print(bs4.Tag(name='x', attrs={'class':'a b'}).attrs)"
{'class': 'a b'}
Doesn't give a list either. Which is the expected behavior from bs3. So I'm not sure what html5-parser is doing wrong here, if anything.
It might well be that the expected use of the Tag constructor is python3 -c "import bs4; print(bs4.Tag(name='x', attrs={'class':['a', 'b']}).attrs)"
, but not being at my terminal at the moment, I can't verify this suspicion.
Already fixed.
Maybe I'm mistaken in that I can't use html-parser as a faster drop-in replacement for bs4. Two test cases fail:
First,
soup.select("table.table_class")
doesn't find anything with html5-parser. Further, when searching with justsoup.select("table")
, the class attribute isn't a list, but is instead a space-delimited string.