Skip to content

Changelog

4.1.1

  • FIX: Improve performance of tag name matching, which runs for every element and selector.
  • FIX: Fix nth selectors taking polynomial time when nested inside the of S of other nth selectors, such as :nth-last-child(n of :nth-last-child(n of li)), as each level of nesting multiplied the work by the number of siblings. nth selectors inside :has() with a subsequent-sibling combinator, such as :has(~ :nth-child(n of li)), were also quadratic. Each sibling is now evaluated against an nth selector at most once per parent.
  • FIX: A range input's value is clamped to its minimum and maximum, 0 and 100 by default, so it now matches :out-of-range only when its maximum is less than its minimum, and :in-range otherwise, including without min or max. A range input that is disabled, readonly or in a datalist matches neither.
  • FIX: :in-range and :out-of-range no longer match an input of any type that is disabled, readonly or in a datalist, as it is barred from constraint validation.
  • FIX: :in-range and :out-of-range treat a date, month, week or datetime-local value after 275760-09-13T00:00:00Z as invalid, as browsers do.
  • FIX: :placeholder-shown sanitizes an input's value before checking it, as browsers do, so it matches when the value is only line breaks, only whitespace for url and email, or, for number, not a valid floating-point number or one that overflows a double, such as 1e9999.
  • FIX: Fix :placeholder-shown taking time quadratic in the depth of the document, as it got the text of every element before checking that it is a textarea.

4.1

  • NEW: Soup Sieve is now thread safe, and this is now tested, including on free-threaded Python. This is assuming read only operations on a document. Check out our documentation for more details.
  • FIX: Fix a race where compiling selectors in multiple threads at the same time could fail with a bogus syntax error or silently parse a selector incorrectly.
  • FIX: Fix issue where trailing whitespace and comments can sometimes fail to be consumed properly.
  • FIX: Fix a selector that starts with a comment followed by whitespace, such as /* comment */ div, failing with a syntax error.
  • FIX: Custom selector names should be checked with ASCII only lowercase.
  • FIX: Fix [attr=value], [attr$=value], [attr|=value], and [attr!=value] ignoring a trailing newline in the attribute value, so [type=hidden] no longer matches type="hidden
".
  • FIX: Cache the language, the contenteditable state, the select of an option, and the tree that an element is in, as found from its ancestors, when matching :lang(), :read-write, :read-only, :checked, :default, and :indeterminate to avoid quadratic time on deeply nested documents.
  • FIX: Fix :lang('') not matching every element without any language information, which per the HTML spec has an empty language tag. It missed the first such element checked, or all of them when there was no head.
  • FIX: :lang() no longer matches an element whose language tag is not well-formed BCP 47 syntax, such as -, en-, en_US, or a subtag longer than 8 characters, and a language range that is not well-formed matches nothing. Previously, lang="-" matched :lang(''), and ill-formed tags matched :lang('*').
  • FIX: Fix :lang() ranges that end in a wildcard, such as en-* or *-*, never matching. As RFC 4647 extended filtering specifies, wildcards after the first subtag are ignored, so en-* matches the same as en.
  • FIX: Fix [attr*=value] and [attr$=value] taking time quadratic in the length of the value when it nearly matches a long attribute value, including when matching case insensitive.

4.0.1

  • FIX: Cache whether an element is or has a matching descendant when matching :has() to avoid quadratic time on deeply nested documents.
  • FIX: Cache whether the parent matches when matching the child combinator (a > b) so it is matched once for all of its children, avoiding quadratic time when the parent is expensive, such as div:has(> p) > span.

4.0

  • BREAK: The contents of an HTML template are no longer treated as part of the document. Selectors do not descend into a template, and elements inside one can't see beyond it, which also applies to pseudo-classes such as :lang(), :disabled, and :default. select and filter will still reach the contents of a template when they are called on the template itself, for example soup.template.select('p'). See the FAQ for more information.
  • BREAK: The contents of an iframe are no longer treated as a separate document, as they are not one in a browser. Elements in an iframe are normal children, so :root does not match them, and :default, :indeterminate, :checked, :dir(), :lang(), and :read-write treat them like any other element. Recent versions of html.parser, lxml, and html5lib all escape the contents of an iframe like a browser does, so this mostly affects XHTML, Python versions that still don't escape such content in their specific html.parser, and elements added to an iframe by hand. :-soup-contains() now also includes the escaped text in an iframe. See the FAQ for more information.
  • NEW: Update :disabled and :enabled to treat option and optgroup elements inside a disabled select as disabled, following a recent HTML specification update.
  • FIX: Fix the subsequent-sibling combinator and :has(~ ...) never matching top level elements of a fragment that has no root element, unless caching was disabled.
  • FIX: :indeterminate now treats a radio button group without a form as extending across the whole document instead of the top level element that contains it, and it no longer ignores radio buttons at the top level.
  • FIX: Fix :default to treat a button with a missing or invalid type, and an input with type="image", as submit buttons.
  • FIX: Fix :in-range and :out-of-range raising TypeError when the document contains an input without a type attribute.
  • FIX: :read-write (and :read-only) now treat contenteditable="plaintext-only" elements as editing hosts and match the editable elements inside an editing host, following the nearest contenteditable state.
  • FIX: :read-write (and :read-only) now ignore contenteditable on non-HTML elements, such as an SVG foreignObject, as the attribute only applies to HTML elements. Such elements inherit the state of their parent.
  • FIX: :checked now only matches the last radio button with a checked attribute in a radio button group, as in a browser, where a group is the radio buttons with the same name and form, including the form attribute. :default still matches all of them, and the contents of a template are unaffected as they are not connected.
  • FIX: :dir() and :defined no longer affect the rest of the selector list they are in. Previously, a selector list that used either of them could not have its combinators cross an iframe, ignored the specified namespaces, and matched nothing in XML, not even the parts that didn't use them. They still do not match in XML, but :not(:dir(ltr)) and :not(:defined) now do.
  • FIX: :default and :indeterminate now honor the form attribute, which can associate a submit button or radio button with a form it is not in, or leave it without a form. It is ignored in a template, as in the HTML specification. Submit buttons outside of a form can now be its default button.
  • FIX: :default, :checked, and :indeterminate now handle a form inside a form like a browser. In HTML, a browser ignores the nested form and takes its end tag for that of the parent, which matters for parsers that keep the nested form, such as html.parser. In XHTML and in a template, nested forms are real forms.
  • FIX: :checked now matches the option that a browser would select. Without multiple, that is only the last option with a selected attribute in a select, and if there are none and the select shows a single option, the first option that is not disabled. :default still only considers the selected attribute.
  • FIX: Fix [attribute!=value] excluding values that only start with the specified value, and in XML documents, type values that contain a newline.
  • FIX: Match the values of every attribute that the HTML specification lists as ASCII case insensitive (rel, method, lang, dir, …) without ASCII case sensitivity on HTML elements in HTML documents, not just type. Non-HTML elements are matched case sensitively.
  • FIX: :dir() now matches non-HTML elements, such as SVG and MathML, by the direction they inherit from their parent (the dir attribute only applies to HTML elements), and HTML elements inside them, such as in an SVG foreignObject, by the direction of their ancestors.
  • FIX: Fix :dir() ignoring the value of an input with dir="auto" and a missing or empty type.
  • FIX: :dir() now uses a table generated from Unicode 18 instead of unicodedata, so results no longer depend on the Unicode version of the Python in use, and unassigned code points use their default direction.
  • FIX: :dir() now uses the value of an input with dir="auto" when type is hidden, password, submit, reset, or button, as the HTML specification does.
  • FIX: dir="auto" and bdi now analyze the text of non-HTML elements, such as SVG and MathML, and only ignore HTML elements such as script, style, and bdi. The text directly in an iframe is analyzed as well, and the contents of a template, which are not part of the document, are not.
  • FIX: :dir() no longer lets the contents of a template inherit direction from the template or its ancestors, as they are not part of the document. They are left to right unless they specify otherwise.
  • FIX: :dir() now matches a bdi element that is the root by its text instead of assuming left to right.
  • FIX: :dir() now treats any element without a parent element as left to right, not just the root. Before, all but the first top level element of a fragment parsed with html.parser never matched.
  • FIX: :dir() now accepts any identifier, as CSS requires, including escaped ones. Values other than ltr and rtl do not match anything.
  • FIX: Respect namespaces provided by the parser when the root is not an HTML element, such as an svg element extracted from an html5lib document. Previously every element in such a tree was treated as an HTML element, which affected namespace selectors, namespaced attributes, and HTML specific pseudo-classes.
  • FIX: Fix :lang() treating an element with an empty lang or xml:lang attribute as having the language of a tagged ancestor.
  • FIX: Cache forms without a default button when matching :default to avoid quadratic time on forms with many non-default submit candidates.
  • FIX: Fix :in-range and :out-of-range matching elements whose value, min, or max has a trailing newline; per HTML, such values are not valid, so they are treated like a missing value and cannot be out of range.
  • FIX: Fix :in-range and :out-of-range raising ValueError when a date, month, week, or local date and time input has a year with more digits than Python will convert; such a year is now treated as invalid.
  • FIX: Fix :in-range and :out-of-range not recognizing a datetime-local value, min, or max that uses a single space instead of T to separate the date and time.
  • FIX: Search a form only once for checked radio buttons when matching :indeterminate to avoid quadratic time on forms with many radio button groups.
  • FIX: :lang() now uses the lang attribute of SVG elements, as the HTML specification does (with xml:lang taking precedence). Previously only xml:lang was considered for elements outside the HTML namespace.
  • FIX: :defined no longer matches HTML elements with an is attribute (customized built-in elements), which, like custom elements, are undefined until they are registered.
  • FIX: Cache the index of each child when matching the general sibling combinator (a ~ b and :has(~ b)) to avoid quadratic time when the first matching sibling is far into a long list of siblings.
  • FIX: Match attribute values with the i modifier using ASCII case insensitivity.
  • FIX: Treat an input with an unknown type, such as type="foo", as a text input in :placeholder-shown, :read-write, :read-only and :dir(), as an invalid type is in the Text state in the HTML specification.
  • FIX: Fix :enabled and :disabled never matching input elements with type="hidden".
  • FIX: :required no longer matches input elements of types the required attribute does not apply to (hidden, range, color, submit, image, reset and button). Like in browsers, they match :optional.
  • FIX: Cache whether an element is or has a matching ancestor when matching the descendant combinator (a b) to avoid time that grows with the depth of the document to the power of the number of combinators.

3.0.4

  • FIX: Keep own and descendant text separate when combining :-soup-contains() and :-soup-contains-own().
  • FIX: Cache resolved directionality when matching :dir() to avoid quadratic time on deeply nested dir="auto" elements.
  • FIX: Fix auto handling in regard to :dir() selector. When an element with dir="auto" (or a <bdi>) contains no strong direction characters, it should be assumed as left-to-right and not assume the direction of the parent.
  • FIX: Match numeric input ranges correctly when values or bounds use scientific notation.
  • FIX: Fix :in-range and :out-of-range raising ValueError for week inputs whose week-year is 10000 or greater.
  • FIX: Fix :nth-last-child(an+b of S) matching the wrong elements when the first sibling tested does not match S.
  • FIX: escape() now only leaves non-ASCII identifier code points unescaped, as defined by the CSS specification. All other non-ASCII characters are escaped.
  • FIX: Allow unescaped U+0080 - U+009F characters in identifiers to match browser behavior.
  • FIX: Fix :in-range and :out-of-range treating time and datetime-local values with seconds as invalid.

3.0.3

  • FIX: When matching with >, the BeautifulSoup object should not count as a parent.
  • FIX: Fix case where relative sibling matching under :has(~) would incorrectly match a sibling that came before the target element.

3.0.2

  • FIX: Python versions less than 3.11.5 have broken possessive quantifiers, so require at least 3.11.5 for Soup Sieve 3.0+. 3.0 and 3.0.1 will be yanked from PyPI to avoid having the 3.0 series installed on Python < 3.11.5 which will cause the library to be broken.

3.0.1

  • FIX: Fix regression related to [attribute!=value] where previously it would match if the attribute was not present and recent changes broke that. Essentially, [attribute!=value] should be the same as :not([attribute=value]).

3.0

  • BREAK: :has(), by default, now behaves according to CSS more strictly, disallowing complex selectors that use combinators and prevents nesting :has() within :has(). This gives a safer, more performant default for Soup Sieve. If in a safe environment, these restrictions can be lifted by passing the new NOSTRICT flag restoring behavior to before 3.0.
  • BREAK: Custom selectors must be provided in order. If one custom selector depends on another custom selector, the custom selector dependency must be defined first in the dictionary. This eliminates recursive processing of custom selectors. Users are encouraged to pre-compile custom selectors via my_selectors = soupsive.CustomSelectors({custm: selector, ...}).
  • NEW: Drop Python 3.10.
  • NEW: Aggressively use possessive quantifiers and atomic groups in CSS pattern parsing to reduce backtracking.
  • NEW: Eliminate recursion within the parser and the matcher.
  • NEW: Expose new parameter max_selectors that can be used to control the maximum allowed selectors in a given input.
  • FIX: A CSS escape that is a surrogate, or past the Unicode range, is U+FFFD. (#307)

2.10

  • NEW: Support Python 3.15.
  • NEW: Add new ignore option to API methods that allows the specification of specific pseudo-classes to be ignored.
  • NEW: Tighten restrictions such that namespaces and custom objects must always be a Mapping, previously lists of tuples were also allowed.
  • NEW: Use a singleton for null selectors internally via called Null of type SelectorNull.
  • NEW: For performance, Soup Sieve will no longer try and coerce bad attribute values to useable strings.
  • NEW: Add NOCACHE flag that can be used to disable caching optimizations selectors and possibly other future caching optimizations. Provided for disabling and also disabling if issues are found with the new caching approach.
  • FIX: Improve performance of ~ for various cases by employing caching.
  • FIX: Improve performance of nth-* family of selectors in certain scenarios by employing caching.
  • FIX: Ensure custom is properly passed down from API functions to compilation.

2.9.2

  • FIX: Fix issue where :is() and :where() were not accounting for empty selectors in the max selector count as they should (@arpitjain099).
  • FIX: Fix issue where :has() was allowing empty selectors in some circumstances even though it is not forgiving.
  • FIX: Reduce selector object size when :is() and :where() contain empty selectors.

2.9.1

  • FIX: Correct [attr^=""], [attr$=""], and [attr*=""] to match nothing when the value is empty, per CSS Selectors Level 4 substring matching, which previously matched any element merely having the attribute (@chuenchen309).

2.9

  • NEW: Drop Python 3.9 support.
  • NEW: Lazy compile selector patterns to improve initial import speed.
  • FIX: Correct :nth-child/:nth-of-type (and -last- variants) for An+B values whose sequence steps onto index 0 or onto the last child (e.g. :nth-child(2n-2), :nth-child(n-1), :nth-child(n+5)), which previously matched the wrong elements or nothing at all (@gaoflow).
  • FIX: More efficient CSS ID matching (@kaimandalic).
  • FIX: Fix inefficient trimming of comments and white space (@kaimandalic).

2.8.4

  • FIX: Fix another inefficient attribute pattern (@mauriceng98).
  • FIX: Limit total number of selectors processed in a pattern to prevent massive selector requests (@mauriceng98).

2.8.3

  • FIX: Fix inefficient attribute pattern.

2.8.2

  • FIX: Ensure custom selectors or namespace dictionaries reject non-string keys (@mundanevision20).
  • FIX: Fix handling of :in-range and :out-of-range with end of year weeks (@mundanevision20).
  • FIX: Fix a potential infinite loop in the pretty printing debug function (@mundanevision20).

2.8.1

  • FIX: Changes in tests to accommodate latest Python HTML parser changes.

2.8

  • NEW: Drop support for Python 3.8.
  • NEW: Add support for Python 3.14.
  • NEW: Deploy with PyPI's "Trusted Publisher".

2.7

  • NEW: Add :open pseudo selector.
  • NEW: Add :muted pseudo selector.
  • NEW: Recognize the following pseudo selectors: :autofill, :buffering, :fullscreen, :picture-in-picture, :popover-open, :seeking, :stalled, and :volume-locked. These selectors, while recognized, will not match any element as they require a live environment to check element states and browser states. This just prevents Soup Sieve from failing when any of these selectors are specified.
  • NEW: A number of existing pseudo-classes are no longer noted as experimental.
  • FIX: Typing fixes.

2.6

  • NEW: Add official support for Python 3.13.
  • NEW: Add support for & as scoping root per the CSS Nesting Module, Level 1. When & is used outside the context of nesting, it is treated as the scoping root (equivalent to :scope).
  • FIX: Improve error message when an unrecognized pseudo-class is used.

2.5

  • NEW: Update to support Python 3.12.
  • NEW: Drop support for Python 3.7.

2.4.1

  • FIX: Attribute syntax for case insensitive flag optionally allows a space, it does not require one.

2.4

  • NEW: Update to support changes related to :lang() in the official CSS spec. :lang("") should match unspecified languages, e.g. lang="", but not lang=und.
  • NEW: Only :is() and :where() should allow forgiving selector lists according to latest CSS (as far as Soup Sieve supports "forgiving" which is limited to empty selectors).
  • NEW: Formally drop Python 3.6.
  • NEW: Formally declare support for Python 3.11.

2.3.2.post1

  • FIX: Documentation for installation from source is outdated.

2.3.2

  • FIX: Fix some typos in error messages.

2.3.1

  • FIX: Ensure attribute selectors match tags that have new line characters in attributes. (#233)

2.3

  • NEW: Officially support Python 3.10.
  • NEW: Add static typing.
  • NEW: :has(), :is(), and :where() now use a forgiving selector list. While not as forgiving as CSS might be, it will forgive such things as empty sets and empty slots due to multiple consecutive commas, leading commas, or trailing commas. Essentially, these pseudo-classes will match all non-empty selectors and ignore empty ones. As the scraping environment is different than a browser environment, it was chosen not to aggressively forgive bad syntax and invalid features to ensure the user is alerted that their program may not perform as expected.
  • NEW: Add support to output a pretty print format of a compiled SelectorList for debug purposes.
  • FIX: Some small corner cases discovered with static typing.

2.2.1

  • FIX: Fix an issue with namespaces when one of the keys is self.

2.2

  • NEW: :link and :any-link no longer include <link> due to a change in the level 4 selector specification. This actually yields more sane results.
  • FIX: BeautifulSoup, when using find, is quite forgiving of odd types that a user may place in an element's attribute value. Soup Sieve will also now be more forgiving and attempt to match these unexpected values in a sane manner by normalizing them before compare. (#212)

2.1

  • NEW: Officially support Python 3.9.
  • NEW: Drop official support for Python 3.5.
  • NEW: In order to avoid conflicts with future CSS specification changes, non-standard pseudo classes will now start with the :-soup- prefix. As a consequence, :contains() will now be known as :-soup-contains(), though for a time the deprecated form of :contains() will still be allowed with a warning that users should migrate over to :-soup-contains().
  • NEW: Added new non-standard pseudo class :-soup-contains-own() which operates similar to :-soup-contains() except that it only looks at text nodes directly associated with the currently scoped element and not its descendants.
  • FIX: Import bs4 globally instead of in local functions as it appears there are no adverse affects due to circular imports as bs4 does not immediately reference soupsieve functions and soupsieve does not immediately reference bs4 functions. This should give a performance boost to functions that had previously included bs4 locally.

2.0.1

  • FIX: Remove unused code.

2.0

  • NEW: SelectorSyntaxError is derived from Exception not SyntaxError.
  • NEW: Remove deprecated comments and icomments from the API.
  • NEW: Drop support for EOL Python versions (Python 2 and Python < 3.5).
  • FIX: Corner case with splitting namespace and tag name that have an escaped |.

1.9.6

Last version for Python 2.7

  • FIX: Prune dead code.
  • FIX: Corner case with splitting namespace and tag name that have an escaped |.

1.9.5

  • FIX: :placeholder-shown should not match if the element has content that overrides the placeholder.

1.9.4

  • FIX: :checked rule was too strict with option elements. The specification for :checked does not require an option element to be under a select element.
  • FIX: Fix level 4 :lang() wildcard match handling with singletons. Implicit wildcard matching should not match any singleton. Explicit wildcard matching (* in the language range: *-US) is allowed to match singletons.

1.9.3

  • FIX: [attr!=value] pattern was mistakenly using :not([attr|=value]) logic instead of :not([attr=value]).
  • FIX: Remove undocumented _QUIRKS mode flag. Beautiful Soup was meant to use it to help with transition to Soup Sieve, but never released with it. Help with transition at this point is no longer needed.

1.9.2

  • FIX: Shortcut last descendant calculation if possible for performance.
  • FIX: Fix issue where Doctype strings can be mistaken for a normal text node in some cases.
  • FIX: A top level tag is not a :root tag if it has sibling text nodes or tag nodes. This is an issue that mostly manifests when using html.parser as the parser will allow multiple root nodes.

1.9.1

  • FIX: :root, :contains(), :default, :indeterminate, :lang(), and :dir() will properly account for HTML iframe elements in their logic when selecting or matching an element. Their logic will be restricted to the document for which the element under consideration applies.
  • FIX: HTML pseudo-classes will check that all key elements checked are in the XHTML namespace (HTML parsers that do not provide namespaces will assume the XHTML namespace).
  • FIX: Ensure that all pseudo-class names are case insensitive and allow CSS escapes.

1.9

  • NEW: Allow :contains() to accept a list of text to search for. (#115)
  • NEW: Add new escape function for escaping CSS identifiers. (#125)
  • NEW: Deprecate comments and icomments functions in the API to ensure Soup Sieve focuses only on CSS selectors. comments and icomments will most likely be removed in 2.0. (#130)
  • NEW: Add Python 3.8 support. (#133)
  • FIX: Don't install test files when installing the soupsieve package. (#111)
  • FIX: Improve efficiency of :contains() comparison.
  • FIX: Null characters should translate to the Unicode REPLACEMENT CHARACTER (U+FFFD) according to the specification. This applies to CSS escaped NULL characters as well. (#124)
  • FIX: Escaped EOF should translate to U+FFFD outside of CSS strings. In a string, they should just be ignored, but as there is no case where we could resolve such a string and still have a valid selector, string handling remains the same. (#128)

1.8

  • NEW: Add custom selector support. (#92)(#108)
  • FIX: Small tweak to CSS identifier pattern to ensure it matches the CSS specification exactly. Specifically, you can't have an identifier of only -. (#107)
  • FIX: CSS string patterns should allow escaping newlines to span strings across multiple lines. (#107)
  • FIX: Newline regular expression for CSS newlines should treat \r\n as a single character, especially in cases such as string escapes: \\\r\n. (#107)
  • FIX: Allow -- as a valid identifier or identifier start. (#107)
  • FIX: Bad CSS syntax now raises a SelectorSyntaxError, which is still currently derived from SyntaxError, but will most likely be derived from Exception in the future.

1.7.3

  • FIX: Fix regression with tag names in regards to case sensitivity, and ensure there are tests to prevent breakage in the future.
  • FIX: XHTML should always be case sensitive like XML.

1.7.2

  • FIX: Fix HTML detection type selector.
  • FIX: Fixes for :enabled and :disabled.
  • FIX: Provide a way for Beautiful Soup to parse selectors in a quirks mode to mimic some of the quirks of the old select method prior to Soup Sieve, but with warnings. This is to help old scripts to not break during the transitional period with newest Beautiful Soup. In the future, these quirks will raise an exception as Soup Sieve requires selectors to follow the CSS specification.

1.7.1

  • FIX: Fix issue with :has() selector where a leading combinator can only be provided in the first selector in a relative selector list.

1.7

  • NEW: Add support for :in-range and :out-of-range selectors. (#60)
  • NEW: Add support for :defined selector. (#76)
  • FIX: Fix pickling issue when compiled selector contains a NullSelector object. (#70)
  • FIX: Better exception messages in the CSS selector parser and fix a position reporting issue that can occur in some exceptions. (#72, #73)
  • FIX: Don't compare prefixes when evaluating attribute namespaces, compare the actual namespace. (#75)
  • FIX: Split whitespace attribute lists by all whitespace characters, not just space.
  • FIX: :nth-* patterns were converting numbers to base 16 when they should have been converting to base 10.

1.6.2

  • FIX: Fix pattern compile issues on Python < 2.7.4.
  • FIX: Don't use \d in Unicode Re patterns as they will contain characters outside the range of [0-9].

1.6.1

  • FIX: Fix warning about not importing Mapping from collections.abc.

1.6

  • NEW: Add closest method to the API that matches closest ancestor.
  • FIX: Add missing select_one reference to module's __all__.

1.5

  • NEW: Add select_one method like Beautiful Soup has.
  • NEW: Add :dir() selector (HTML only).
  • FIX: Fix issues when handling HTML fragments (elements without a BeautifulSoup object as a parent).
  • FIX: Fix internal nth range check.

1.4.0

  • NEW: Throw NotImplementedError for at-rules: @page, etc.
  • NEW: Match nothing for :host, :host(), and :host-context().
  • NEW: Add support for :read-write and :read-only.
  • NEW: Selector patterns can be annotated with CSS comments.
  • FIX: \r, \n, and \f cannot be escaped with \ in CSS. You must use Unicode escapes.

1.3.1

  • FIX: Fix issue with undefined namespaces.

1.3

  • NEW: Add support for :scope.
  • NEW: :user-invalid, :playing, :paused, and :local-link will not cause a failure, but all will match nothing as their use cases are not possible in an environment outside a web browser.
  • FIX: Fix [attr~=value] handling of whitespace. According to the spec, if the value contains whitespace, or is an empty string, it should not match anything.
  • FIX: Precompile internal patterns for pseudo-classes to prevent having to parse them again.

1.2.1

  • FIX: More descriptive exceptions. Exceptions will also now mention position in the pattern that is problematic.
  • FIX: filter ignores NavigableString objects in normal iterables and Tag iterables. Basically, it filters all Beautiful Soup document parts regardless of iterable type where as it used to only filter out a NavigableString in a Tag object. This is viewed as fixing an inconsistency.
  • FIX: DEBUG flag has been added to help with debugging CSS selector parsing. This is mainly for development.
  • FIX: If forced to search for language in meta tag, and no language is found, cache that there is no language in the meta tag to prevent searching again during the current select.
  • FIX: If a non BeautifulSoup/Tag object is given to the API to compare against, raise a TypeError.

1.2

  • NEW: Add Python 2.7 support.
  • NEW: Remove old pre 1.0 deprecations.

1.1

  • NEW: Adds support for [attr!=value] which is equivalent to :not([attr=value]).
  • NEW: Add support for :active, :focus, :hover, :visited, :target, :focus-within, :focus-visible, :target-within, :current()/:current, :past, and :future, but they will never match as these states don't exist in the Soup Sieve environment.
  • NEW: Add support for :checked, :enabled, :disabled, :required, :optional, :default, and :placeholder-shown which will only match in HTML documents as these concepts are not defined in XML.
  • NEW: Add support for :link and :any-link, both of which will target all <a>, <area>, and <link> elements with an href attribute as all links will be treated as unvisited in Soup Sieve.
  • NEW: Add support for :lang() (CSS4) which works in XML and HTML.
  • NEW: Users must install Beautiful Soup themselves. This requirement is removed in the hopes that Beautiful Soup may use this in the future.
  • FIX: Attributes in the form prefix:attr can be matched with the form [prefix\:attr] without specifying a namespaces if desired.
  • FIX: Fix exception when [type] is used (with no value).

1.0.2

  • FIX: Use proper CSS identifier patterns for tag names, classes, ids, etc. Things like #3 or #-3 should not match and should require #\33 or #-\33.
  • FIX: Do not raise NotImplementedError for supported pseudo classes/elements with bad syntax, instead raise SyntaxError.

1.0.1

  • FIX: When giving a tag to select, it should only return the children of that tag, never the tag itself.
  • FIX: For informational purposes, raise a NotImplementedError when an unsupported pseudo class is used.

1.0

  • NEW: Official 1.0.0 release.

1.0.0b2

  • NEW: Drop document flags. Document type can be detected from the Beautiful Soup object directly.
  • FIX: CSS selectors should be evaluated with CSS whitespace rules.
  • FIX: Processing instructions, CDATA, and declarations should all be ignored in :contains and child considerations for :empty.
  • FIX: In Beautiful Soup, the document itself is the first tag. Do not match the "document" tag by returning false for any tag that doesn't have a parent.

1.0.0b1

  • NEW: Add support for non-standard :contains() selector.
  • FIX: Compare pseudo class names case insensitively when matching unexpected cases.
  • FIX: Don't allow attribute case flags when no attribute value is defined.

0.6

  • NEW: mode attribute is now called flags to allow for other options in the future.
  • FIX: More corner cases for nth selectors.

0.5.3

  • FIX: Previously, all pseudo classes' selector lists were evaluated as one big group, but now each pseudo class's selector lists are evaluated separately.
  • FIX: CSS selector tokens are not case sensitive.

0.5.2

  • FIX: Add missing s flag to attribute selector for forced case sensitivity of attribute values.
  • FIX: Relax attribute pattern matching to allow non-essential whitespace.
  • FIX: Attribute selector flags themselves are not case sensitive.
  • FIX: type attribute in HTML is handled special. While all other attributes values are case sensitive, type in HTML is usually treated special and is insensitive. In XML, this is not the case.

0.5.1

  • FIX: Fix namespace check for :nth-of-type.

0.5

  • NEW: Deprecate commentsiter and selectiter in favor of icomments and iselect. Expect removal in version 1.0.

0.4

  • NEW: Initial prerelease.