Feature Request: Support for the ':not' pseudo-class selector.

Bug #1607476 reported by gwelch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Confirmed
Wishlist
Unassigned

Bug Description

The ':not(css_selector)' pseudo-selector class should be fairly simple feature to add. It is simply a negation on the contained 'css_selector'.

External Documentation:

W3: https://www.w3.org/TR/selectors/#negation
MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/:not
CSS-Tricks: https://css-tricks.com/almanac/selectors/n/not/

Tags: css feature
Revision history for this message
Leonard Richardson (leonardr) wrote :

This is a reasonable request, but the CSS selector system is contributed code, and I only add to it when a patch and test are contributed. I'm going to leave this issue open in a 'confirmed' state and if someone provides a patch I'll apply it.

Changed in beautifulsoup:
status: New → Confirmed
Revision history for this message
gwelch (gwelch925) wrote :

TBH, I forgot about this request (mostly) due to a change in my work dynamic, however this feature could be very useful to me and the other QA that I work with. I checked out the source code and identified the function that would need to be modified (link below). Assuming I get a couple projects done, I should have some free time around the holidays. IMO, I would extract all the logic from the select() function and create CssSelector class following the Specification\Filter Pattern.

http://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/bs4/element.py#L1331

Revision history for this message
Leonard Richardson (leonardr) wrote :

As long as the tests pass, feel free to refactor select() however you want.

Revision history for this message
Leonard Richardson (leonardr) wrote :

In fact, a refactoring should make it easy to fix https://bugs.launchpad.net/beautifulsoup/+bug/1507608

tags: added: css feature
Changed in beautifulsoup:
importance: Undecided → Wishlist
Revision history for this message
Leonard Richardson (leonardr) wrote :

Replacing the current select() implementation with SoupSieve (see issue #1809035) will add support for the :not pseudo-class.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.