v0.38.0
Added
-
This version adds initial support for the
:haspseudo-selector. It is a great addition that enables finding elements containing matching children.Examples for selectors:
"div:has(h1)""div:has(h1, p, span)""div:has(p.foo)""div:has(img[src='https://example.com'])""tr:has(*:fl-contains('TEST'))"
Note that combinators like
">"are not allowed yet.Thank you @bvobart for this feature!
Fixed
-
Add
:styleoption documentation toFloki.text/2. Thanks @s3cur3 for the fix. -
Fix deprecation warnings for upcoming Elixir 1.19.
-
Prevent from crashing when selector is an empty string.
Removed
-
Remove support for Elixir 1.14 and OTP 23.
-
Remove deprecated functions and function clauses that were accepting strings (binaries).
Affected functions:
parse/1- removed functionmap/2- removed functionattr/4- removed clausefind/2- removed clausetext/3- removed clausetext/3- removed clauseattribute/2- removed clausefilter_out/2- removed clause
HTML must be parsed before searching. Functions like
Floki.find/2,Floki.attribute/2, and other HTML manipulation functions no longer work directly with HTML strings. The HTML must be parsed first usingFloki.parse_fragment/2orFloki.parse_document/2.Before:
html = "<div class='foobar'><p>Hello</p></div>" Floki.find(html, "p") Floki.attribute(html, "div", "class")After:
html = "<div class='foobar'><p>Hello</p></div>" parsed_html = Floki.parse_fragment!(html) Floki.find(parsed_html, "p") Floki.attribute(parsed_html, "div", "class")
Pull requests
- Implement parsing rules for the
:haspseudo class selector by @philss in https://github.com/philss/floki/pull/623 - feat: implement :has pseudo-selector functionality by @bvobart in https://github.com/philss/floki/pull/624
- Bump ex_doc from 0.37.3 to 0.38.2 by @dependabot in https://github.com/philss/floki/pull/625
- Bump credo from 1.7.11 to 1.7.12 by @dependabot in https://github.com/philss/floki/pull/619
- Bump benchee from 1.3.1 to 1.4.0 by @dependabot in https://github.com/philss/floki/pull/618
- Add
:styleflag to text/2` docs by @s3cur3 in https://github.com/philss/floki/pull/627 - Remove support for Elixir 1.14 by @philss in https://github.com/philss/floki/pull/626
- Remove deprecations by @philss in https://github.com/philss/floki/pull/628
- Remove deprecation warnings for the upcoming Elixir 1.19 by @philss in https://github.com/philss/floki/pull/630
- Prevent
find/2from crashing with empty selector by @philss in https://github.com/philss/floki/pull/631 - Prepare to release v0.38 by @philss in https://github.com/philss/floki/pull/629
New Contributors
- @bvobart made their first contribution in https://github.com/philss/floki/pull/624
- @s3cur3 made their first contribution in https://github.com/philss/floki/pull/627
Full Changelog: https://github.com/philss/floki/compare/v0.37.1...v0.38.0