question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

the :not selector don't work as expected.

See original GitHub issue

the 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:closed
  • Created 3 years ago
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
facelessusercommented, Feb 13, 2021

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.

1reaction
facelessusercommented, Feb 11, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found