CSS Selector :nth-of-type and :nth-of-child only work up to 9

Bug #1811206 reported by Marcus Näslund
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Beautiful Soup
Won't Fix
Undecided
Unassigned

Bug Description

Using BS4 4.7.1 (Soupsieve 1.6.2) on Python 3.6.

When using the nth-of-type or nth-child pseudo classes in CSS selectors (soup.select()), they only work up to 9, and from 10 upwards either return nothing or the wrong element, depending on the document. I.e. div:nth-of-type(9) always works, div:nth-of-type(10) never(?) works. I've attached a simple example.

However, formulas like :nth-child(9+n) seem to work well and returns all elements from the 9th onwards.

I don't know if this bug goes here or to Soupsieve.

Revision history for this message
Marcus Näslund (naslundx) wrote :
Revision history for this message
Marcus Näslund (naslundx) wrote :

Oops, the attached document always says "expect 9" when of course sometimes expected element is 10 or 11, but should be obvious what was meant.

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

This does belong on soupsieve; thanks for filing it over there (https://github.com/facelessuser/soupsieve/issues/78).

Changed in beautifulsoup:
status: New → Won't Fix
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.