Dealing with a colon in BeautifulSoup CSS selectors

Bug #1540588 reported by Alexander Afanasyev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Fix Released
Undecided
Unassigned

Bug Description

Referencing this StackOverflow post: http://stackoverflow.com/questions/34553622/dealing-with-a-colon-in-beautifulsoup-css-selectors

Input HTML:

    <div style="display: flex">
        <div class="half" style="font-size: 0.8em;width: 33%;"> apple </div>
        <div class="half" style="font-size: 0.8em;text-align: center;width: 28%;"> peach </div>
        <div class="half" style="font-size: 0.8em;text-align: right;width: 33%;" title="nofruit"> cucumber </div>
    </div>

Trying to use the following CSS selector:

    div[style="display: flex"]

But getting:

    NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.

Tried to escape it with a backslash or use \3A instead - nothing worked

----

What is the correct way to use/escape a colon in attribute values in BeautifulSoup CSS selectors?

Thank you.

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

Fixed in revision 415.

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

For the record, the issue was the space in the selector, not the colon.

Changed in beautifulsoup:
status: New → Fix Committed
Changed in beautifulsoup:
status: Fix Committed → Fix Released
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.