the :not selector don't work as expected.
See original GitHub issuethe minimal code which can reproduce the bug lists below
import bs4
b = bs4.BeautifulSoup("<a href=\"http://www.example.com\"></a>")
b.body.a['foo'] = None # str(b) -> <html><body><a foo href="http://www.example.com"></a></body></html>
b.select("a:not([foo])") # -> [<a foo href="http://www.example.com"></a>]
in this case, the tag a
shouldn’t be selected.
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (13 by maintainers)
Top Results From Across the Web
css - :not selector doesn't work as expected - Stack Overflow
The revised selector is saying: Target h3 elements that are children of any element, unless that parent has a class of alert-danger ....
Read more >not - CSS-Tricks
The :not () property in CSS is a negation pseudo class and accepts a simple selector or a selector list as an argument....
Read more >How and when to use the CSS :has selector - LogRocket Blog
The CSS :has() selector allows us to style an element based on its descendants or any succeeding elements.
Read more >text selector doesn't work · Issue #4865 · microsoft/playwright
It seems that await page.click('div[role="radiogroup"] >> text=No') works because it is not case sensitive. Is this to be expected?
Read more >Handling common HTML and CSS problems - MDN Web Docs
Of course, no CSS features will apply at all if you don't use the right selectors to select the element you want to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sounds like he’s open to trying this out on the default HTML5 formatter, so that is a start. I’ll try to get a pull in there so at least on the HTML5 formatter, empty strings should output as bare attributes.
In general, I guess now None will work, so you can keep doing that. Generally, I don’t think people should use
None
and this should be changed in the HTML formatter to output bare attributes. I think overriding the HTML formatter is probably a cleaner option to do this on output, especially if the author doesn’t want to change the output in HTML moving forward (XML should not do this though).I guess we’ll see what he decides. But I guess you have options now.