What’s New

css-select

Languages & Runtimes

css-select release notes.

Latest v7.0.0 · by css-selectWebsitefb55/css-select

Changelog

v7.0.0

Added
  • Added support for the :lang() pseudo-class
  • Added support for of in nth-* pseudo-classes, e.g. :nth-last-child(3n+2 of .a)
Changed
  • Package is now ESM only with "type": "module"; CommonJS require() is only supported in modern environments
  • Minimum Node.js version is now 20.19.0
  • :enabled now only matches form elements
Removed
  • Removed the deprecated _compileToken export; use _compileUnsafe instead
  • Removed the deprecated re-exports of aliases, filters, and pseudos; use the pseudos option instead
  • Removed ./package.json subpath export
Breaking Changes
  • ESM only: the package now sets "type": "module"; CommonJS require() is only supported in modern environments #1746
    • Minimum Node.js version is now 20.19.0
  • Cleaned up deprecations
    • Removed the deprecated _compileToken export. Use _compileUnsafe instead
    • Removed the deprecated re-exports of aliases, filters, and pseudos. Use the pseudos option instead
    • Removed ./package.json subpath export
  • :enabled now only matches form elements
New Features
  • Added support for the :lang() pseudo-class
  • Added support for of in nth-* pseudo-classes, e.g. :nth-last-child(3n+2 of .a)

Full Changelog: https://github.com/fb55/css-select/compare/v6.0.0...v7.0.0

v5.2.0

Added
  • Cache results for subtrees to speed up :contains and :has
  • Add support for :read-only and :read-write pseudos
Changed
  • Improve support for large documents
Fixed
  • Allow whitespace in :empty
  • Filter queried elements inside template element
  • Handle template tags in selectOne
New Features
  • Cache results for subtrees; vastly speeds up :contains and :has #1025 – by @fb55
  • Add support for :read-only and :read-write pseudos #1497 – by @jed
  • Improved support for large documents #1132 – by @fb55
Fixes
  • Allow whitespace in :empty #795 – by @fb55
  • Filter queried elements inside template element #981 – by @andolf
  • Handle template tags in selectOne #1001 – by @fb55
New Contributors

Full Changelog: https://github.com/fb55/css-select/compare/v5.1.0...v5.2.0

v5.1.0

Added
  • Add a relativeSelector option to control whether selectors are relative to the passed context or can match parent elements outside of the context
  • Added an option to disable relative selectors (#766) 1c1f7f2
    • By default, selectors are relative to the passed context, which means that no parent elements of the context will be matched. (Eg. a b c with context b will never give any results.) If the relativeSelector option is set to false, selectors won't be absolutized and selectors can test for parent elements outside of the context.
    • See https://github.com/fb55/css-select/issues/709 for context.

https://github.com/fb55/css-select/compare/v5.0.1...v5.1.0

v5.0.0

Added
  • Add a pseudos option to allow users to specify pseudo-classes
Changed
  • Update node types due to changes in domhandler
  • Change error message for unknown pseudo classes
Fixed
  • Throw an error for :host-context pseudo-class
Removed
  • Remove support for deep imports in the dual CJS and ESM package
Deprecated
  • Extending filters, pseudos and aliases is now deprecated
Breaking
  • domhandler's node types have changed. Some of these changes were inherited by css-select #754
  • css-select is now a dual CJS and ESM package #756
    • Deep imports are no longer permitted
  • Throw an error for :host-context #755
    • The error message for unknown pseudo classes has changed.
Features
  • Added a pseudos option #757
    • This option allows users to specify pseudo-classes.
    • Extending filters, pseudos and aliases is now deprecated.

https://github.com/fb55/css-select/compare/v4.3.0...v5.0.0

v4.3.0

Added
  • Add quirks mode option where .class and #id selectors are case-insensitive
  • Add optional prevElementSibling adapter method
Fixed
  • Throw errors for namespaced selectors with better descriptions
What's Changed
  • feat: Upgrade to css-what@6, add quirks mode option by @fb55 in https://github.com/fb55/css-select/pull/657
    • In quirks mode, .class and #id selectors are case-insensitive.
  • feat: Add optional prevElementSibling adapter method by @fb55 in 78776e8
  • fix: Throw errors for namespaced selectors by @fb55 in 255e965
    • Namespaced selectors (eg. *|div, [foo|bar] already caused errors before this release. We now parse them properly and throw errors with better descriptions.

Full Changelog: https://github.com/fb55/css-select/compare/v4.2.1...v4.3.0

v4.2.0

Added
  • Support for :where pseudo class as alias for :is
What's Changed
New Contributors

Full Changelog: https://github.com/fb55/css-select/compare/v4.1.3...v4.2.0